Study reveals batch prompting causes safety failures in large models and proposes batch-aware alignment mitigationSafety in Batches? Understanding and Mitigating Safety Failures in Batch Prompting
When harmful questions are embedded in a benign batch, the average ASR across six models for Batch Prompting on JailbreakBench is 62.2%.
A black-box, single-step jailbreak in the standard single-user setting: the attacker concatenates one harmful question with several benign questions into a single prompt and submits it directly, without accessing model internals or performing additional optimization. The goal is to make the model answer harmful questions it would refuse under individual prompting. The victim system is the aligned LLM being called.
- Batch prompting sends multiple questions to the model at once to reduce inference costs, but the authors state that harmful questions that would be rejected individually can elicit harmful answers when embedded among benign questions. The authors argue that refusal should remain consistent regardless of the number and composition of questions in a single call, a point that has not been sufficiently examined from a safety perspective.
- The authors combine one harmful question with benign questions into a black-box, single-step input, comparing against ICL and long-context attacks. Four public reward models are used to examine reward differences, and refusal vectors are used to see whether refusal signals are diluted. Batch-aware SFT and DPO are compared on two open-source models.
- Table 2: Average ASR across six models for Batch Prompting, 62.2% on JailbreakBench and 66.6% on StrongREJECT. Table 5: After DPO, Llama's average ASR across positions on JBB and SR is 0.5% and 0.6%.
- The authors state they did not pursue the strongest attack; whether adaptive structures can bypass batch-aware alignment is left for future work; reward analysis uses public proxies. Evaluation covers six models, two harmful benchmarks, and seven black-box baselines, with DPO reported only for Llama-3.1-8B and Phi-4-14B.
- Evaluated models
- Llama-3.1-8BPhi-4-14BQwen-3-8BGPT-5.3-ChatClaude-4.6-SonnetGemini-3-FlashLlama Guard4OpenAI ModerationAzure AI Content Safety
- Benchmarks
- JailbreakBenchStrongREJECTGSM8KAlpacaCoinFlipAdvBenchBeaverTails
- Metrics
- ASRdetection ratereward gaprefusal scoreGSM8K accuracyPPL
The paper points out that batch prompting, a common inference strategy, has an independent safety failure mode: a harmful question that is consistently refused when asked alone may elicit a harmful answer when embedded in a batch of benign questions. The authors analyze the causes from two perspectives: weakened alignment signals and diluted refusal signals, and validate across multiple open-source and frontier commercial models that batch prompting, as a simple black-box attack, consistently achieves high attack success rates. The research further shows that batch-aware preference optimization can effectively mitigate this vulnerability, and the authors propose that batch-aware alignment is a necessary component for robust deployment. Code has been released.
Paper analysis
What problem does this paper attempt to solve?
Harmful questions that would be rejected individually can elicit harmful answers when placed in a batch of benign questions.
Batch prompting preserving utility does not mean harmful questions are still refused in batches.
- Scenario: The authors state that Batch Prompting (Cheng et al., 2023) places multiple questions in a single call to reduce redundant computation of shared prefixes; subsequent work claims utility can be comparable to single-question prompting. The authors argue that identification and refusal of harmful intent should not change with the number and composition of questions in a single call. Figure 1 shows a question refused individually yielding a harmful answer when embedded among benign questions.
- Existing gaps: The authors state that long-context safety, in-context learning (ICL) vulnerabilities, and specific template attacks cannot directly explain this phenomenon. Batch inputs contain only questions, no harmful QA demonstrations, and benign questions can be short and semantically unrelated.
- Core observation: The authors analyze from two perspectives: the reward difference in preference alignment shrinks, and internal refusal signals are diluted at inference time. They state this cannot be reduced to ICL or attributed solely to longer context.
- This paper's approach: Treat the structure as a black-box attack to measure ASR, then use batch-aware preference optimization to restore weakened preference differences.
- Threat model:
- Goal: jailbreaking. Make the model answer harmful questions it would refuse under individual prompting, not to pollute other users' outputs (Appendix A).
- Knowledge: The paper calls it simple black-box, single-step; no access to model internals and no additional optimization (Section 4.1).
- Capability: In the standard single-user setting, the attacker constructs a prompt themselves and submits it directly. Ablations also vary batch size, harmful question position, and whether benign questions are semantically related to the harmful question (Section 4.2).
- Victim system: The aligned LLM being called, including open-source models and frontier commercial models. Whether answers are harmful is determined by majority vote of three guard models (Section 4).
What related research exists?
The paper distinguishes this phenomenon from ICL, long context, multi-user injection, and several template-based jailbreaks.
The authors distinguish this failure from efficiency-oriented batch prompting, ICL, long context, and other jailbreaks that rely on demonstrations, long text, or templates.
Batch prompting
- Cheng et al. (2023): Bundles multiple queries into a single call, avoiding repeated computation of the shared prefix in each inference.
- Utility and applications: Lin et al. (2024), Son et al. (2024), and Wang et al. (2025) discuss models processing batch inputs while maintaining utility comparable to single queries. The appendix also lists applications such as medical summarization and entity resolution (Zhang et al., 2024; Fan et al., 2024; Ji et al., 2025; Saengsiripaiboon et al., 2025). The authors state that these works focus on efficiency and task utility, without discussing safety.
- Yue and Yao (2025): Prompt injection in multi-user batch processing services, where one user's malicious input contaminates answers received by other users. The authors explicitly distinguish two points: this paper involves a single user submitting one prompt; the goal is jailbreaking, not contaminating others' outputs.
ICL and long context
- ICA (Wei et al., 2026) and Many-Shot Jailbreaking (Anil et al., 2024): Use harmful question-answer demonstrations or a large number of shots to steer the model toward harmful answers. Anil et al. report that effectiveness follows a power law with the number of shots. The authors note that batch prompting has no answer demonstrations, only questions.
- Long-context safety: Kim et al. (2025) report that safety decreases as context lengthens, independent of content type. Shah et al. (2025) and Lu et al. (2025) report that long contexts semantically related to harmful questions more easily weaken safety. The authors note that such attacks require constructing very long and relevant contexts; batch prompting uses short, possibly irrelevant questions.
Other jailbreak structures
- Templates and question chains: CodeChameleon (Lv et al., 2024), FlipAttack (Liu et al., 2025b), JAIL-CON (Jiang et al., 2025), Sandwich (Upadhayay and Behzadan, 2024), SequentialBreak (Saiem et al., 2025). The authors state that the latter two rely on scenario nesting, intent confusion, or language mixing; this paper only places benign questions in a standard batch format.
- Cognitive load: Working Memory Attack (Upadhayay et al., 2025) embeds harmful requests in computational tasks requiring step-by-step reconstruction; Xu et al. (2024) increase load with complex reasoning, low-resource languages, metaphors, and hypothetical scenarios. The authors note that these attacks typically present a complex task first, whereas batch prompting has the harmful question followed by benign questions.
- Attention diversion: Ding et al. (2024a), Du et al. (2025), and Pu et al. (2025) link higher attack success to decreased attention on harmful keywords. The authors state that batch prompting does not share this attack surface: the caption of Figure 8 states that successful samples have higher attention on the harmful question.
Baselines and benchmarks
- Baseline methods: CodeChameleon, FlipAttack, JAIL-CON, Working Memory Attack, ICA, Many-Shot Jailbreaking, NINJA (Shah et al., 2025). The appendix states that official default configurations are used, e.g., ICA with 12 shots, Many-Shot with 128 shots, and NINJA with medium context (5,000 words).
- Benchmarks: JailbreakBench (Chao et al., 2024) with 100 harmful questions; StrongREJECT (Souly et al., 2024) with 313. The benign questions in the main experiments come from GSM8K (Cobbe et al., 2021).
The authors position this work as a distinct failure mode: the safety degradation cannot be reduced to ICL or long context, nor is it the same as the multi-user injection of Yue and Yao (2025).
How does the paper address this problem?
The authors analyze this failure in terms of a narrowed reward gap and diluted refusal signals, and mitigate it with batch-aware DPO.
The authors directly treat batch prompting as an attack surface: one input contains one harmful question and multiple benign questions, with no harmful answer demonstration provided. They then explain it from both the reward and internal representation sides, and use batch-aware DPO to recover the preference gap.
Input Structure and Control Design
- Construction: Concatenate one harmful question with multiple benign questions. The main experiment uses a batch size of 12, with benign questions taken from GSM8K; the harmful question is placed at position 1 for Phi-4-14B and at position 2 for the other models (Appendix B.5). Figure 12 shows the full template, which includes a per-question answer format and instructions that suppress refusal phrasing.
- What is compared: Section 2 compares ICL attacks, long-context attacks, and batch prompting on the same victim model, recording average token count, shot count, and ASR. The harmful shots for ICL come from Circuit Breaker; there is also a set of benign shots from GSM8K (Appendix B.2).
- Length separation: First, scale the batch size up to very large values; second, fix 12 questions and only insert irrelevant, non-QA text to lengthen the context (Appendix B.2).
Reward Perspective: Alignment Signal Weakens
- Proxy: Four public reward models assign scalar scores to "user question–model answer" pairs: ArmoRM, SkyworkRM-Llama, SkyworkRM-Qwen, URM. The authors state that the reward model actually used by the target LLM is unavailable, and these models serve only as proxies (Section 3.1, Limitations).
- Three strategies: (A) refuse everything; (B) refuse only the harmful question and answer the rest; (C) comply with everything, which the authors treat as a jailbreak. On safety, (B) is described as a strategy that satisfies both safety and usefulness, while (A) is safe but refuses benign questions.
- Metric: The reward gap ΔR indicates how much the reward model prefers (A) or (B) relative to (C). The x-axis of Figure 3 is batch size. The appendix further uses the harmful question position and the number of harmful questions as controls, to check whether the shrinking gap comes only from the batch template deviating from the training distribution (Appendix B.3).
Representation Perspective: Refusal Signal Diluted
- PCA: Use the harmful/benign single-question anchors from Zheng et al. (2024a), project batch hidden states, and mark the centroids for different batch sizes (Figure 4). The PCA layer is the one with the highest explained variance on PC1 (Table 10: layer 17 for Llama and Phi, layer 24 for Qwen).
- Refusal score: Extract the refusal vector following Arditi et al. (2024), then compute cosine similarity with the hidden state of the last input token. Table 10 specifies the extraction layer and token position: Llama layer 12, last token; Phi layer 16, last token; Qwen layer 20, 9th-to-last token. Comparison targets include JailbreakBench single questions, Alpaca harmless single questions, and semantically unrelated (GSM8K) and semantically related batches.
- Probe: Train two linear probes on layer 17 of Llama-3.1-8B. The local probe reads the last token of the harmful question, and the global probe reads the last token of the entire segment. Training data consists of 520 harmful prompts from AdvBench and 520 harmless prompts from Alpaca, with an 80/20 split; test accuracies are 99.5% and 100%, respectively (Appendix B.4).
Batch-aware Alignment
- Two training methods: Perform SFT and DPO (Rafailov et al., 2023) on Llama-3.1-8B and Phi-4-14B, both using LoRA. SFT shows the model the ideal answers on batches; DPO reinforces the preference gap between safe and unsafe answers in the batch setting. The authors use this comparison to distinguish two hypotheses: the model simply has not seen batch inputs, or the preference signal itself weakens.
- Data and hyperparameters: 500 examples, 5-batch. Harmful Q&A comes from BeaverTails and does not overlap with JailbreakBench or StrongREJECT; benign Q&A comes from Alpaca. Answers are used directly from the original datasets without additional generation. The harmful question position is random, with the five-position counts in Table 13 being 108, 90, 104, 104, 94. LoRA rank 8, alpha 16, applied to q, k, v. Optimizer is AdamW, cosine schedule with warmup. Llama's SFT/DPO converges at 6/2 epochs, Phi at 4/1 epochs (Appendix B.7).
- How external guardrails are tested: Input filtering uses Llama Guard4, OpenAI Moderation API, Azure AI Content Safety API; length-normalized perplexity (Jain et al., 2023) is also tested. This is an evaluation of alternative defenses, not a training method proposed by the authors (Section 5.2).
Success Determination
- ASR: The proportion of attacks that successfully elicit a harmful answer. Llama Guard4, WildGuard, and BeaverDam use majority voting, with at least two votes judging the answer as harmful. The content sent to the judge is the original harmful target, not the original text with the attack template (Appendix B.6).
What experiments did the paper conduct?
JailbreakBench average ASR is 62.2%; after DPO, Llama's JBB position average ASR is 0.5%.
The main result is black-box ASR on six models; the authors additionally conduct composition ablations, comparisons with ICL/long context, and DPO and external guardrails.
Experimental setup
- Models tested: Llama-3.1-8B, Phi-4-14B, Qwen-3-8B, GPT-5.3-Chat, Claude-4.6-Sonnet, Gemini-3-Flash. Checkpoints are Llama-3.1-8B-Instruct, microsoft/phi-4, Qwen3-8B (main results with non-thinking), gpt-5.3-chat-latest, claude-sonnet-4-6, gemini-3-flash-preview (Table 7).
- Data and main setup: JailbreakBench with 100 items, StrongREJECT with 313. Main experiments use batch size 12, benign questions from GSM8K; the harmful question is at position 1 for Phi and position 2 for the other models.
- Baselines: CodeChameleon, FlipAttack, JAIL-CON, WMA, ICA, Many-Shot, NINJA, plus No attack. Implementations follow each method's official default configuration (Appendix B.5).
- Metrics and judge: ASR is the proportion of elicited harmful answers. Majority vote across three models. With GPT-5.3-Chat as reference, the ensemble's precision, recall, F1, and agreement rate are .969, .940, .955, and 94% (Table 12).
- Decoding: greedy, temperature=0. API experiment date is 2026-04-11. The paper does not report the number of repetitions for ASR.
Main results
According to Table 2. Batch Prompting; batch size 12, benign questions from GSM8K, harmful question position as in the experimental setup.
Swipe horizontally to read the table
Model JBB batch JBB no attack SR batch SR no attack Llama-3.1-8B 55.0% 2.0% 71.3% 0.6% Phi-4-14B 65.0% 0.0% 69.0% 0.0% Qwen-3-8B 82.0% 2.0% 85.3% 0.6% GPT-5.3-Chat 52.0% 0.0% 40.6% 0.3% Claude-4.6-Sonnet 66.0% 0.0% 74.1% 0.3% Gemini-3-Flash 53.0% 0.0% 59.1% 0.6% - The authors state that Batch Prompting achieves the highest average ASR on both benchmarks, 62.2% and 66.6%, and is black-box and single-step. Not every column in the table is the highest.
- On JailbreakBench, Llama's JAIL-CON is 88.0%, Qwen's JAIL-CON is 86.0%, and Gemini's CodeChameleon is 85.0%, all higher than Batch Prompting in the same column. On StrongREJECT, Llama's JAIL-CON is 93.9% and Gemini's CodeChameleon is 93.0%.
- The authors state that on GPT and Claude, existing attacks' ASR converges to near 0. The table does not fully reflect this: on JailbreakBench, CodeChameleon for GPT and Claude is 22.0% and 12.0%, and JAIL-CON for Claude is 34.0%. ICA is 0.0% in all cells of Table 2.
Distinction from ICL and long context
- Table 1, Llama-3.1-8B, JailbreakBench: ICL has 0% ASR at both 128 shots (average 5,606 tokens) and 12 shots (668 tokens); long-context attack averages 6,654 tokens with 40% ASR; batch prompting averages 906 tokens with 55% ASR.
- Lengthening does not raise ASR: In Table 8, ICL with GSM8K benign shots remains 0%. Figure 9 scales batch size to 12, 30, 60, 90, and the authors state ASR does not increase accordingly; the text does not give ASR for each point. Table 9 fixes Qwen-3-8B at 12-batch, increasing tokens from 936 to 4,000, with ASR 82, 79, 78, 78, 79.
- Attention: The caption of Figure 8 states that successful samples have a higher proportion of attention on the harmful question. The authors argue that success cannot be explained by "less attention to harmful content." The paper does not provide specific proportions.
Batch composition
- Size: Figure 6 covers Llama-3.1-8B, Phi-4-14B, and GPT-5.3-Chat. The authors state that ASR rises at small batch sizes and then plateaus; the text does not give values for each point. They state this is consistent with the saturation in Figures 3, 4, and 5, and differs from long-context attacks that scale with length.
- Position: Table 3 is for 7-batch, JailbreakBench. Llama at positions 1, 2, 4, 6, 7 is 41.0%, 48.0%, 42.0%, 19.0%, 5.0%; Phi is 37.0%, 17.0%, 14.0%, 4.0%, 3.0%; GPT-5.3-Chat is 51.0%, 54.0%, 44.0%, 39.0%, 33.0%. The authors state that earlier positions are higher and later positions decline. In the table, the highest cell for Llama and GPT is at position 2, not position 1.
- Semantic relevance: Table 4, JailbreakBench. Irrelevant (GSM8K)/relevant: Llama 55.0%/31.0%, Phi 65.0%/12.0%, GPT-5.3-Chat 52.0%/42.0%. The authors state that irrelevant questions dilute harmfulness more. The paper does not specify which model generated the relevant questions in this table.
Defenses and external guardrails
- Table 5: 12-batch, GSM8K, averaged over harmful question positions, not the single position in Table 2. Llama's JBB/SR: original 41.3%/49.2%, SFT 23.8%/29.8%, DPO 0.5%/0.6%. Phi: original 28.3%/34.5%, SFT 10.0%/9.9%, DPO 0.3%/0.3%. The authors state that DPO reduces ASR below 1%, while SFT only partially mitigates; they also state that training uses 5-batch, BeaverTails+Alpaca, and the evaluated harmful content, benign categories, and batch size all differ.
- Post-training behavior: Table 14's GSM8K accuracy: Llama single-question from 83.3% to 81.7%, 12-batch from 76.4% to 78.7%; Phi single-question from 94.9% to 94.5%, 12-batch from 94.3% to 92.5%. In Table 15, Llama's 12-batch JBB ASR is 0 for all four benign categories after DPO. The appendix states that normalized refusal scores go from 0.147 to 0.404. The caption of Figure 7 states that after DPO the centroid moves back to the harmful region; the converted text does not show point positions.
- External guardrails Table 6: Llama Guard4 detection rate drops from 92.0% for single questions to 27.0% for 9-batch; OpenAI Moderation from 69.0% to 43.0%; Azure from 37.0% to 19.0% (9-batch; 7-batch is 18.0%). Length-normalized PPL goes from 26.886 for single questions to 6.924 for 9-batch, with GSM8K at 10.140. The authors state that external defenses are insufficient. In Table 20, with Qwen-3-8B thinking enabled, batch ASR goes from 82 to 65 (−17), and JAIL-CON from 86 to 68 (−18).
Other ablations and analyses
- Benign categories (Table 18, ASR): Llama's GSM8K/CoinFlip/Alpaca/Multi is 55/57/42/51; Qwen is 82/75/80/72.
- Number of harmful questions (Table 19, 12-batch, JBB): Llama at n=1/2/3 is 55/45/32; in the table, GPT-5.3 is 52/9/0.
- Single-question control with the same instruction (Table 17, JBB): single prompting is Llama 3, Phi 1, GPT 1, Claude 1; same-instruction batch is 55, 65, 52, 66. Vanilla is 2, 0, 0, 0.
- Probes (Table 11, Llama-3.1-8B): local pharmful is 0.907; global scores at batch sizes 2, 4, 6, 8, 10 are 0.846, 0.669, 0.422, 0.391, 0.171.
- Utility (Table 16, GSM8K accuracy): single to 12-batch, Llama 83.3 to 76.4 (−6.9), Phi 94.9 to 94.3 (−0.6), GPT 96.6 to 97.2 (+0.6). The text states that the GPT column is GPT-5.3-Chat.
- Reward gap content comparison: The authors state that when the harmful question is at the end, or when there are more harmful questions in the batch, the reward gap is better preserved (Figures 14, 15). The text does not give specific ΔR for these figures.
What are some points that can be further explored?
The authors state that they did not construct stronger combined attacks, and that the reward analysis relies on unavailable true reward models.
Limitations and future directions noted by the authors
- Not the strongest attack: The Limitations state that the research focuses on identifying and analyzing this vulnerability, not on designing the most effective possible attack.
- Combining existing jailbreaks is out of scope: The same section states that combining batch prompting with existing jailbreak techniques to amplify attacks is possible but beyond the scope of this initial finding.
- Adaptive structures bypassing alignment: The Limitations list "the extent to which adaptive batch structures can bypass batch-aware preference alignment" as a future direction.
- Reward model is only a proxy: The Limitations state that Section 3.1 uses public reward models because the reward model actually used for alignment of the target LLM is unavailable. The authors state that although multiple public models show consistent trends in Appendix B.3, the findings may not fully reflect the internal alignment signals of each target model.
- Conclusion direction: After reporting that DPO can restore weakened safety, the Conclusion lists batch-aware alignment as a direction for future defenses.
Experimental coverage
- Generation models and benchmarks: The tested models are Llama-3.1-8B, Phi-4-14B, Qwen-3-8B, GPT-5.3-Chat, Claude-4.6-Sonnet, and Gemini-3-Flash, 6 in total. Harmful benchmarks are JailbreakBench (100 items) and StrongREJECT (313 items) (Section 4, Table 2).
- Attack comparisons and decoding: Comparisons are 7 black-box methods plus No attack. The main experiment uses batch size 12, greedy, temperature=0; API experiment date is 2026-04-11 (Appendix B.1, B.5). The paper does not report ASR repetition counts.
- Judgment: ASR is determined by majority vote of Llama Guard4, WildGuard, and BeaverDam; agreement with the GPT-5.3-Chat ensemble is 94% (Table 12). The paper does not report the sample size for this agreement analysis.
- Mechanism analysis: Reward differences come from ArmoRM, SkyworkRM-Llama, SkyworkRM-Qwen, and URM (Section 3.1). The models and layers for refusal vectors, PCA, and probes are in Table 10 and Appendix B.4.
- Where mitigation experiments are reported: SFT and DPO training and Table 5 evaluations target Llama-3.1-8B and Phi-4-14B. External guardrails are Llama Guard4, OpenAI Moderation, Azure AI Content Safety, and length-normalized PPL (Table 6). Thinking mode numbers are reported on Qwen-3-8B (Table 20). The paper does not report DPO results on GPT, Claude, or Gemini.
Summarize the main content of the paper
Mixing harmful questions into a benign batch can elicit harmful answers; the authors state that batch-aware DPO can restore the preference signal.
This work examines an input structure originally intended to save inference cost: when multiple questions are sent at once to an aligned LLM, does the safety refusal remain the same as with a single question?
- Problem: A harmful question that would be refused under single prompting can, when placed alongside benign questions, lead the model to give a harmful answer. The authors state this is not an ICL demonstration, nor a long-context attack.
- Approach: The attacker only concatenates questions, provides no harmful answers, and does not inspect model internals. The authors use four public reward models to examine the reward gap among "refuse all / refuse only harmful / comply with all," and use refusal vectors, PCA, and linear probes to examine internal signals. For mitigation, they compare SFT and DPO on batch data.
- Attack numbers: In Table 2, the six-model average ASR for Batch Prompting is 62.2% on JailbreakBench and 66.6% on StrongREJECT. GPT-5.3-Chat is 52.0% and 40.6%, Claude-4.6-Sonnet is 66.0% and 74.1%. In the same table, JAIL-CON and CodeChameleon are higher on some open-source models and Gemini. In Table 1, on Llama-3.1-8B, batch ASR is 55%, while ICL is 0% and long-context attack is 40% on the same page.
- Composition and mitigation: The authors state that small batches already reach a plateau, and ASR is higher when the harmful question is early and benign questions are semantically irrelevant. In Table 5, position-averaged ASR after DPO is 0.5% (JBB) and 0.6% (SR) for Llama, and 0.3% for both for Phi; SFT remains at 23.8%, 29.8%, 10.0%, 9.9%. In Table 6, detection rates of three moderation models decrease as batch size increases.
- Authors' conclusion: Evaluating safety and alignment only on single questions is insufficient. The authors state that the failure stems from weakened alignment preference signals and diluted refusal signals during inference, and that batch-aware preference alignment can close this gap, which they propose as a direction for future defense.