Diverse and effective red-teaming with automatically generated rewards and multi-step reinforcement learningDiverse and Effective Red Teaming with Auto-generated Rewards and Multi-step Reinforcement Learning
Per-example RBR plus multi-step RL red-teams GPT-4 Turbo, with jailbreak success rate 0.86 and diversity 0.15 (Table 2).
The attacker generates prompts that cause GPT-4 Turbo with safety guardrails to produce behavior the judge deems undesirable, and wants diverse attacks rather than a single one. Indirect injection embeds instructions in third-party inputs (web pages or function call returns). Jailbreaks induce responses that violate safety policies. The paper does not call this setting white-box or black-box. Success is determined by per-example RBR or the Moderation API.
- Automated red teaming needs to produce both diverse and effective attacks. The authors say RL repeatedly gives nearly identical successful attacks, while few-shot prompting is more diverse but has low success probability. Indirect prompt injection lacks a single reviewer covering multiple goals.
- Split red teaming into generating diverse attack goals, then training an attack model to accomplish these goals. An LLM produces per-example instructions and criteria, and the criteria become rule rewards. Multi-step RL rewards style difference from historical attacks and penalizes overly long outputs.
- Target GPT-4 Turbo. Table 1 (function calling test) 10-step average success rates: one-shot 0.02, Multistep RL 0.42. Table 2 jailbreaks: Vanilla RL success rate 0.96, diversity 0.02; Multistep RL 0.86, 0.15.
- The authors note that red-team terminology is broad, methods make different assumptions so comparison is difficult, and diversity and realism metrics still need future work; variance across runs is large and sensitive to reward shaping; automated judges serve as both reward and evaluation, with reward hacking risk. Experiments attack GPT-4 Turbo, the attack model is GPT-3.5 scale, each method trained 3 times.
- Evaluated models
- GPT-4 Turbo
- Benchmarks
- Anthropic Harmlessindirect prompt injection goals (browsing train, function-call test)
- Metrics
- Success RateAttack DiversityAttack Style Diversity
A paper proposes an automated red-teaming method that decomposes the task into generating diverse attack goals and generating effective attacks for each goal. The trained RL attack model can generate attacks that are more diverse and have higher success rates than previous general red-teaming methods. The paper uses large language models with per-goal prompts and rewards to generate diverse attack goals, including rule-based rewards (RBR) that judge whether an attack succeeds for a specific goal. The attack model is trained with multi-step reinforcement learning, rewarding attacks that differ from previous attempts, thereby further increasing diversity while maintaining effectiveness. The method is used to generate prompt injection attacks and prompts that induce unsafe responses, and the authors claim it is more effective and significantly more diverse than previous general red-teaming methods on both types.
Related events and news
1 events · 1 news mentions
News that mentions this paper
PIPETTE:红队策略覆盖决定注入防御效果
- CSA Labs Researchcites the paper's id or linkCSA 研究笔记:提示注入红队数据对加固智能体的价值取决于策略覆盖而非数量
[12] Beutel, A., Xiao, K., Heidecke, J., and Weng, L. “Diverse and Effective Red Teaming with Auto-generated Rewards and Multi-step Reinforcement Learning.” arXiv:2412.18693, December 2024.
Paper analysis
What problem does this paper attempt to solve?
The authors split red teaming into diverse goal generation and effective attack training, balancing both with per-example rule rewards and multi-step style diversity RL.
Automated red-teaming struggles to make attacks both diverse and effective simultaneously.
- Scenario: The authors believe LLMs can be induced by adversarial attacks to produce harmful content, leak private information, amplify biases, hallucinate, and are susceptible to prompt injection; finding failures and iterating improvements requires red-teaming. When training red-team models with RL, the reward causes the model to overfit, repeatedly producing nearly identical successful attacks; zero-shot or few-shot prompting is more diverse but has much lower success probability.
- Existing limitations: The authors say previous methods typically optimize only one of diversity or effectiveness. Gradient attacks often yield soft tokens or suffixes, with unnatural text unlike requests from real users or even adversarial users. Indirect prompt injection has no single review covering diverse goals, and automated red-teaming relying on generic toxicity rewards is hard to apply.
- Core approach: Split the system into generating diverse attack goals, then train RL red-team models for those goals. Per-example, zero-shot rule-based rewards (RBR) replace a single toxicity reward; multi-step RL additionally rewards differences in style or strategy from historical attacks. Tasks are indirect prompt injection in third-party inputs, and jailbreaks inducing unsafe responses. The authors say to their knowledge this is the first paper giving an automated red-teaming method for indirect prompt injection.
- Threat model:
- Goal: Given a generative model M, train an attacker to produce diverse and effective prompts p such that M(p)→y is judged by reviewer R as undesired behavior, rather than just finding one attack.
- Knowledge: The paper calls gradient attacks with access to architecture, parameters, and training pipeline white-box. This problem setting does not use terms like white-box or black-box; the attacker obtains rewards by querying M's responses and review signals. The experiments do not describe access to GPT-4 Turbo gradients.
- Capability: The attacker generates p. For indirect injection, the attack is inserted into third-party inputs, such as web browsing or function call returns, then given to M; for jailbreaks, it directly requests responses that violate safety policies.
- Victim system: In experiments, M is GPT-4 Turbo with safety guardrails. The attack model starts from an instruction-following model without safety guardrails, at the scale of GPT-3.5. Success is judged by an automated reviewer.
What related research exists?
Related work includes gradient adversarial attacks, RL or contextual red teaming, and concurrent search and diversity regularization; the authors separate unnatural suffixes from this paper.
Gradient adversarial attacks
- Carlini and Wagner [2017], Madry et al. [2017] optimize directly when the loss is differentiable; Guo et al. [2021] use Gumbel-Softmax for discrete outputs; Ebrahimi et al. [2017], Wallace et al. [2019a], Shin et al. [2020] take loss derivatives with respect to text operations in vector space.
- Mehrabi et al. [2022] modify Universal Adversarial Triggers to make harmful triggers in multi-turn dialogue harder to detect. Zou et al. learn triggers that make models output affirmative statements to unsafe requests, and report that sequences on open-source models transfer nontrivially to commercial models.
- Wallace et al. [2019a], Jones et al. [2023], Zou et al., Wichers et al. [2024], Sitawarin et al. [2024], Andriushchenko et al. [2024] work well when optimizing to a set of known bad content. The authors separate this from their work: these attacks are often soft-token or unrealistic text; the authors think they help understand robustness boundaries, while this paper focuses on diverse, realistic attacks useful for understanding weaknesses and training.
Red teaming
- Dinan et al. [2019], Ganguli et al. [2022], Perez et al. [2022], Markov et al. [2023] use red teaming to find weaknesses. The authors say models trained via red teaming are more robust to adversarial attacks [Dinan et al., 2019, Ziegler et al., 2022]; human-in-the-loop dynamic collection can improve performance [Vidgen et al., 2020, Kiela et al., 2021].
- Human-machine collaboration includes Xu et al. [2021]; Wallace et al. [2019b] and Ziegler et al. [2022] build tools that highlight high-salience tokens. FLIRT [Mehrabi et al., 2023] relies only on in-context learning, starting with a few human attacks and growing with new attacks, ranked by effectiveness, diversity, and low toxicity.
- Perez et al. [2022] fine-tune an attack model with RL, with rewards from a toxicity classifier scoring outputs; Casper et al. [2023] incorporate training that classifier into the pipeline. The authors compare: this paper uses automatically generated rule rewards to judge whether attacks succeed on diverse goals.
Concurrent work
Samvelyan et al. [2024] use genetic-search-like generation for attacks, which can produce diverse attacks but needs more curation of the diversity component.
Hong et al. [2024] add diversity regularization in RL to prevent collapse; this paper uses it as a baseline in experiments.
Ge et al. [2023] is superficially multi-step but closer to alternating red teaming and training on red-team data. The authors think it can and should be combined with any red-team method.
Baseline methods: one-shot instruction-following model without safety guardrails; Vanilla RL from Perez et al. [2022] (Moderation API and length penalty only); Curiosity from Hong et al. [2024]. The authors state the injection task has no general reward, so it cannot be compared with the latter two.
Benchmarks/datasets: jailbreak uses Anthropic Harmless [Bai et al., 2022]; indirect injection uses goals generated per Section 4, attached to browsing or function call data.
The authors position this paper as: separating diverse goal generation from effective attack generation, training a red-team model with per-example rewards and style-oriented multi-step diversity rewards. Wallace et al. [2024], Reid et al. [2024] mention generating indirect prompt injections; the authors say to their knowledge, this paper provides the automated red-team method.
How does the paper address this problem?
First automatically generate attack goals with rule rewards, then train an attack model with multi-step RL, rewarding success, closeness to examples, style difference, and shorter length.
Overall it is a two-stage approach: AG generates attack goals, Am turns goals into effective and stylistically diverse attacks under RL.
Problem setting and decomposition
- A generative model M maps prompt p to response y. The attacker wants a judge R(M(p); p) to deem the output unsafe or undesirable behavior.
- The authors split a single attacker: g is sampled from AG, Am(g)→p. Training maximizes expected reward over the goal distribution. The authors note diversity is hard to define, and later operationalize it with cosine similarity and a style subspace.
- Goals enter Am in two ways: natural language instructions or one-shot examples, and judgment criteria in the reward.
Automatic generation of goals and rule rewards
- Few-shot generation: An LLM produces instructions and criteria. The former go into the attack model prompt as instructions or examples; the latter are written as RBR questions for that goal. Appendix A.1 gives templates. The authors say this step does not require seed attacks to succeed, only to be diverse, and they did not heavily tune prompts.
- Rewriting from data: Use few-shot prompts on existing data to rewrite each example into a goal and criteria. Jailbreak experiments use Anthropic Harmless. The authors say using that data directly is unlikely to elicit unsafe responses, but it covers diverse safety concerns. Appendix A.2 gives prompts, A.3 gives red-team model prompt templates.
- RBR follows Glaese et al. [2022], Achiam et al. [2023], Mu et al. [2024]: an LLM classifies according to policy text. The observation here is that LLMs can do zero-shot classification, so many targeted RBRs can be generated automatically.
Attack success and few-shot anchoring
- RBR asks the LLM a yes/no question, reward is P(yes). Indirect injection uses only RBR: RAttSuccess(y)=RRBR(y; xr).
- Unsafe content must also violate general policy, using the OpenAI Moderation API. The two are averaged, each multiplied by 0.5. The authors note multiplication is also possible, with different learning dynamics.
- Example attack xg serves as an anchor to avoid drifting toward diverse but unsuccessful seeds. Embedding φ uses text-embedding-ada-002, cosine similarity through sigmoid (x0=0.75, k=10) gives RFewshot. Appendix B.1.1 gives details.
Multi-step RL and style diversity
- The authors say even with goal diversity, attacks can still look similar in style, like gradient methods finding only a small set of suffixes. So the red-team model generates attacks sequentially, each step conditioned on historical attacks and historical success rewards.
- Step 0 gets p0 from examples; afterwards Am produces pT conditioned on xg, historical attacks, and historical RAttSuccess. Algorithm 1 in Appendix B constructs the next user reply to the red-team model based on whether it succeeded and whether it is too close to history.
- The diversity reward is only used for T>0. The direct form is 1 minus the maximum cosine similarity with historical attacks. The authors want similarity to target style or strategy, not goals: perform QR decomposition on the one-shot goal embeddings in the batch, use that basis to remove the goal subspace, obtaining φstyle.
- The style diversity reward is RDiv=1−maxt∈[0,T−1]sim(ϕstyle(pt),ϕstyle(pT)). Because history length changes the similarity range, normalize by batch mean and standard deviation, then through sigmoid (k=5, x0=0, smoothing ε=0.1).
Multi-objective reward and training choices
- Length penalty Rlen: no penalty below min len=100, equal penalty above max len=200, then scaled to [0.5, 1]. The authors say otherwise the model would increase diversity by adding arbitrary text; they also think shorter, simpler attacks are more likely to be noticed by humans.
- The authors say multiplication best pushes the model to satisfy all terms without giving up any: R=RAttSuccess× RFewshot× RDiv× Rlen. RFewshot is only used for the first step, RDiv only for later steps; inapplicable terms are set to a constant. The paper does not give the value of that constant.
- Rewards should not be too close to 0, to avoid affecting training; Rlen has lower priority than other terms, so it is scaled to [0.5, 1]. RL uses γ=0, not passing later-step rewards back to earlier steps. These choices are kept fixed across experiments. Multi-step training uses T=5 per example.
What experiments did the paper conduct?
The authors say multistep RL better trades off success rate and diversity; jailbreak Vanilla RL has success rate 0.96 and diversity 0.02 (Table 2).
Experimental Setup
- Models: The attacked model is GPT-4 Turbo with safety guardrails. The attack model is GPT-3.5-scale, starting from an instruction-following model without safety guardrails; the one-shot baseline is this starting point, using the same kind of one-shot prompt at inference time. Embeddings are text-embedding-ada-002. The general safety score for jailbreak uses the OpenAI Moderation API. RBR is obtained by an LLM answering yes/no and taking P(yes); the paper does not state the name of this LLM.
- Data: Injection targets are generated by GPT-4 Turbo according to Section 4, with types including links, images, specific phrases, answering questions, specific styles, and others. Attacks are inserted into web browsing or function call returns. Training uses 4664 examples (browsing), testing uses 1102 examples (function calling). Jailbreak uses the existing Anthropic Harmless split, removing examples with more than one user message, then uses 3-shot to generate goal and criteria; training 5000, testing 654. The model used to generate jailbreak goals is not stated in the paper.
- Methods and baselines: one-shot; single-step RL with RBRs + Few-shot reward; Multistep RL (trained with T=5, diversity not limited to the style subspace); Multistep RL with Style Subspace. For jailbreak there are additionally Vanilla RL (only Moderation API and length penalty) and Curiosity (λE=0.01, λSelfBLEU=λCosSim=1, relative to the most recent 10 batches of attacks, and retaining the length penalty).
- Metrics: Success Rate; Attack Diversity and Attack Style Diversity, which the main text says are measured by cosine similarity. Jailbreak success is defined as the maximum value across Moderation API categories being no lower than 0.5. Injection uses the generated RBR for automatic scoring; the paper does not state the threshold for judging P(yes) as success.
- Protocol: Test temperature=0, each held-out target runs T=10 steps, including methods not trained with multiple steps. The main text says three versions are trained per method and the mean and error bars are plotted. Table 1–2 are averages over all 10 inference steps; among them one-shot has no ±, RL methods have ±.
- Scope of comparison: Injection has no general reward that can score all examples, so the paper therefore cannot compare with Vanilla RL or Curiosity.
Main Results
The targets in the table below are all GPT-4 Turbo. The injection column is the function calling test. Values are 10-step averages, from Table 1 and Table 2. The diversity column is Attack Diversity, not Style Diversity.
Swipe horizontally to read the table
Method Injection success rate Injection diversity Jailbreak success rate Jailbreak diversity Baseline One-shot 0.02 0.23 0.01 0.24 Vanilla RL not reported not reported 0.96 ± 0.05 0.02 ± 0.02 Curiosity Baseline not reported not reported 0.69 ± 0.42 0.08 ± 0.02 RL with RBRs + Few-shot 0.32 ± 0.10 0.21 ± 0.03 0.89 ± 0.05 0.11 ± 0.01 Multistep RL 0.42 ± 0.04 0.20 ± 0.04 0.86 ± 0.09 0.15 ± 0.03 Multistep RL with Style Subspace 0.35 ± 0.03 0.20 ± 0.01 0.79 ± 0.13 0.14 ± 0.02 - The authors state that one-shot is diverse but the success rate is close to 0, and Vanilla RL has a high success rate but diversity close to 0; RBR and few-shot reward increase diversity with a limited drop in success rate; multistep RL further increases diversity while maintaining a relatively high success rate. Curiosity has larger variance, its diversity improvement is generally smaller than the paper's method, and its success rate is high at the first step and then declines. The paper does not give step-by-step values for Curiosity.
- The authors state that if the most effective attack in each jailbreak trajectory is taken, the attack success rate of Vanilla RL and the multi-step RL methods is 100%. The authors state that the maximum success rate on the injection task is <50%.
- The Figure 4 caption writes diverse (larger cosine similarity). The main text associates higher Attack Diversity with more diverse, and calls Vanilla RL's low score close to zero diversity. The direction of "larger cosine similarity" in the caption is not consistent with the direction of high versus low diversity in the table; below, references follow the table column names, and the table values are not rewritten as cosine similarity.
Inference Steps and Style Metrics
- The main text says Figure 4(a) plots t=0, 2, 4, 7, 9 for each method, with later steps in lighter color, and says the RL methods have large variance. The endpoint values in the figure are not listed point by point in the main text.
- Injection: The authors state that after training with the multistep diversity reward, attacks become more diverse as inference steps increase; methods not trained this way show no benefit from multistep inference even with diversity prompts (Figure 4(b)). When optimizing the style subspace, they are more diverse on the style metric; on the overall diversity plot, the authors state that direct Multistep RL appears more diverse.
- Jailbreak: The authors state that the diversity of the paper's method increases over 10 inference steps (Figure 5(b)). Figure 8–9 place overall diversity and style diversity side by side; the authors state that Multistep RL is relatively better on the overall metric and Style Subspace is relatively better on the style metric.
Target Following, Cumulative Success, and Qualitative
- Using RBR rather than Moderation to judge whether a jailbreak hits a specific target: Vanilla RL is 0, Curiosity is 0.01, single-step RBR+few-shot is 0.15, multistep methods are 0.03. The authors state that the combined reward is harder, and the red-team model often only optimizes Moderation and ignores RBR, so these values are relatively low.
- Appendix Figure 6 plots cumulative success rate by the most effective attack up to the current step. The caption states that the paper's method (light blue) still maintains a high success rate; the main text states it often increases with the number of steps. Point-by-point readings of this figure are not listed in the paper.
- Appendix C.4 and C.5 give injection and jailbreak examples, labeled as success and failure. The authors state that single-step RBR injection attacks stay close to the examples and change little across steps, while multistep, especially the style subspace, can change the text and differ in topic. In jailbreak, Curiosity is diverse on the metric but appears relatively consistent to humans; the paper's method still often ignores RBR, and its diversity is still higher than the baseline.
Other Ablations and Analyses
- Injection Style Diversity: one-shot 0.78; RBR+few-shot 0.56±0.15; Multistep RL 0.50±0.14; Style Subspace 0.62±0.06 (Table 1). The latter method's style score is higher than the other RL methods and lower than one-shot.
- Jailbreak Style Diversity: one-shot 0.67; Vanilla RL 0.05±0.07; Curiosity 0.21±0.09; RBR+few-shot 0.31±0.04; Multistep RL 0.38±0.14; Style Subspace 0.48±0.04 (Table 2).
- Figure 7 and Appendix C.2 separate the RBR and few-shot rewards on the jailbreak task, with 1 run per configuration. The authors state that the few-shot reward increases diversity more than RBR; multiple steps further increase diversity and slightly lower the success rate. The paper does not give the coordinate values of this figure.
- The authors state that in jailbreak, when the red-team model averages Moderation and RBR, it leans toward Moderation; injection has no second success reward, so this problem does not arise (Appendix C.2).
- Injection is trained on browsing responses and tested on function calling responses; Table 1 is this test setting, and the paper does not separately report same-distribution test numbers.
- The authors state that there is no single consensus metric for how to measure diversity, and the community still needs to improve the metric (Section 6.2.1).
What are some points that can be further explored?
The authors note inconsistent evaluation criteria, RL sensitivity to runs and reward shaping, and that automated judges may be subject to reward hacking.
Limitations and future directions noted by the authors
- Jailbreak and red teaming remain broad terms, methods have different implicit assumptions about what attacks are worth finding, making comparison difficult; consistent evaluation and metrics for concepts like diversity and realisticness are needed (Section 7).
- The authors focus on comparison with the most relevant methods and when each method works (Section 7).
- The method is sensitive, as is common in RL: large variance across runs, sensitive to reward shaping. The authors think this does not prevent use, but hope to make the method easier and more reliable in the future (Section 7).
- Automated judges serve as both red-team reward and evaluation, creating reward hacking: judged success may reveal a weakness in the defense model or a weakness in the judge. The authors say narrower RBRs have some anecdotal encouraging evidence to mitigate this, but it is an open problem in the field (Section 7).
- Training uses γ=0, not using later-step rewards for optimization planning; the authors consider this worthwhile future work (Appendix B.1.2).
Experimental coverage
- The attacked model is GPT-4 Turbo; the attack model is GPT-3.5 scale, an instruction-following model without safety guardrails, also used as the RL starting point (Section 6).
- Tasks are indirect prompt injection (4664 training, 1102 test; trained on browsing responses, tested on function call responses) and safety jailbreak (Anthropic Harmless, 5000 training, 654 test) (Section 6.1–6.2).
- Each method is trained three times; testing uses temperature=0, 10 steps per goal; multi-step methods train with T=5. Tables 1–2 are averages over these 10 steps (Section 6).
- Jailbreak success uses the maximum over Moderation API categories, threshold 0.5; injection uses generated RBR, training reward is P(yes). The paper does not report agreement between these automated judges and human judgments, nor the P(yes) threshold for injection success.
- Jailbreak baselines include one-shot, Vanilla RL, and Curiosity. The paper states the injection task has no general reward, so it cannot be compared with Vanilla RL and Curiosity (Section 6.1).
Summarize the main content of the paper
Split goal generation from attack generation, train a red-team model with per-example RBR and multi-step style rewards, and report success rates and diversity on injection and jailbreak.
The authors train a red team LLM so that automated attacks are simultaneously more effective and more diverse, and apply it to indirect prompt injection and safety jailbreaks.
- Problem: RL red teaming tends to repeat the same successful attack; few-shot prompting is diverse but has low success probability. Indirect injection has no single universal reviewer, and previous general toxicity rewards do not apply.
- Method: First, an LLM generates instructions and criteria, or rewrites from Anthropic Harmless; criteria become per-example RBRs. Then train the attack model. The reward is attack success, embedding similarity to few-shot examples, style difference relative to historical attacks, and length penalty, multiplied together. During multistep generation, condition on past attacks; style similarity first removes the target subspace.
- Setup: The attacked model is GPT-4 Turbo with safety guardrails, and the attack model is GPT-3.5 scale. Injections are trained on browsing data (4664 examples) and tested on function calls (1102 examples). Jailbreaks train on 5000 examples and test on 654. Testing temperature=0, 10 steps per target; RL methods are trained three times. Jailbreak success threshold is 0.5 on the Moderation API; the binarization threshold for injection success rate is not specified in the paper.
- Results: On the function call test, 10-step average success rates: one-shot 0.02, Multistep RL 0.42±0.04, Style Subspace 0.35±0.03 (Table 1). The authors say the maximum success rate for this task is <50%. In jailbreaks, Vanilla RL success rate is 0.96±0.05 and Attack Diversity 0.02±0.02; Multistep RL is 0.86±0.09 and 0.15±0.03 (Table 2). When taking the most effective attack within a trajectory, the authors say Vanilla RL and multi-step RL have 100% success rate. RBR-based jailbreak hit rates: single-step 0.15, multistep 0.03; the authors say the model often ignores RBR and turns to Moderation.
- Authors' Conclusions: Separating goal generation from attack generation, and using generated goals as per-example rewards and multistep style rewards, can trade off diversity and effectiveness on both tasks. The authors also believe evaluation criteria, RL sensitivity to runs and reward shaping, and reviewer exploitation still require future work.