Batch prompting is a practical inference strategy for large language models, but its safety implications remain underexplored. We show that the success of batch prompting for utility does not extend to safety: a harmful question that is reliably refused in isolation can elicit a harmful response when embedded in a batch of benign questions. We identify this as a distinct safety failure mode, not reducible to known vulnerabilities such as in-context learning or long-context effects, and analyze its causes from two complementary perspectives: alignment signal weakening and refusal signal dilution. Across widely used open-source and frontier commercial models, batch prompting consistently achieves high attack success rates as a simple black-box attack. We further show that batch-aware preference optimization effectively mitigates the vulnerability. These findings highlight a blind spot in current safety alignment and point to batch-aware alignment as a necessary step toward robust deployment.
Batch prompting does not need harmful answer demonstrations, and it does not need a long topic-related context. On Llama-3.1-8B and JailbreakBench, in-context learning stays at 0% ASR even with 128 shots, a long-context attack reaches 40% ASR with about 6,654 tokens, and batch prompting reaches 55% ASR with about 906 tokens and no demonstrations.
| Vulnerability | Avg. tokens | Shots | ASR (%) |
|---|---|---|---|
| In-context learning | 5,606 | 128 | 0 |
| In-context learning | 668 | 12 | 0 |
| Long context | 6,654 | — | 40 |
| Batch prompting | 906 | — | 55 |
Table 1. JailbreakBench, Llama-3.1-8B. Batch prompting is shorter than the long-context baseline and uses no answer demonstrations.
Two measurements point to the same failure. Reward models assign a shrinking gap to safe responses as the batch grows, and the model’s own hidden states move toward the harmless cluster, so the refusal direction weakens.
Alignment signal weakening. The reward gap between refusing and answering every question shrinks as batch size grows, across four reward models. (A) refuses all questions, (B) refuses only the harmful question, and (C) answers all questions.
Representations shift toward harmless inputs. Harmful and harmless single prompts separate in PCA space. Centroids of batch prompts move toward the harmless cluster as the batch grows.
Refusal signal dilution. Cosine similarity to the refusal direction drops toward the harmless baseline as batch size increases. Unrelated benign questions dilute the signal at least as much as related ones.
On six models and two benchmarks, batch prompting has the highest average attack success rate. Several prior attacks fall near zero on GPT-5.3-Chat and Claude-4.6-Sonnet, while batch prompting remains high on both. A response is counted as harmful by majority vote of BeaverDam, WildGuard, and Llama Guard 4.
| Method | JailbreakBench | StrongREJECT | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Llama | Phi | Qwen | GPT | Claude | Gemini | Avg. | Llama | Phi | Qwen | GPT | Claude | Gemini | Avg. | |
| No attack | 2.0 | 0.0 | 2.0 | 0.0 | 0.0 | 0.0 | 0.8 | 0.6 | 0.0 | 0.6 | 0.3 | 0.3 | 0.6 | 0.4 |
| CodeChameleon | 61.0 | 62.0 | 66.0 | 22.0 | 12.0 | 85.0 | 51.3 | 61.0 | 68.1 | 71.2 | 16.0 | 11.8 | 93.0 | 53.5 |
| FlipAttack | 60.0 | 0.0 | 47.0 | 0.0 | 0.0 | 8.0 | 19.2 | 73.8 | 0.0 | 46.0 | 0.0 | 0.0 | 8.0 | 21.3 |
| JAIL-CON | 88.0 | 0.0 | 86.0 | 3.0 | 34.0 | 42.0 | 42.2 | 93.9 | 0.0 | 91.1 | 0.6 | 6.4 | 11.8 | 34.0 |
| WMA | 9.0 | 13.0 | 16.0 | 0.0 | 0.0 | 10.0 | 8.0 | 14.7 | 26.2 | 11.8 | 0.0 | 0.0 | 3.2 | 9.3 |
| ICA | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
| Many-Shot | 0.0 | 0.0 | 8.0 | 0.0 | 4.0 | 0.0 | 2.0 | 0.0 | 0.0 | 1.0 | 0.0 | 2.6 | 0.3 | 0.7 |
| NINJA | 40.0 | 1.0 | 30.0 | 0.0 | 0.0 | 8.0 | 13.2 | 30.4 | 0.6 | 17.9 | 0.3 | 0.0 | 5.1 | 9.1 |
| Batch prompting | 55.0 | 65.0 | 82.0 | 52.0 | 66.0 | 53.0 | 62.2 | 71.3 | 69.0 | 85.3 | 40.6 | 74.1 | 59.1 | 66.6 |
Table 2. Attack success rate (%). Bold is best and underline is second-best in each column. Models: Llama-3.1-8B, Phi-4-14B, Qwen-3-8B, GPT-5.3-Chat, Claude-4.6-Sonnet, Gemini-3-Flash.
ASR climbs quickly and then levels off, so a very large batch is not required. Within a 7-question batch, earlier positions have higher ASR than the last position. Benign questions that are unrelated to the harmful one (GSM8K) yield higher ASR than semantically related questions.
Figure 6. ASR versus batch size. The curve saturates well before the largest batches.
| Model | 1st | 2nd | 4th | 6th | 7th |
|---|---|---|---|---|---|
| Llama-3.1-8B | 41.0 | 48.0 | 42.0 | 19.0 | 5.0 |
| Phi-4-14B | 37.0 | 17.0 | 14.0 | 4.0 | 3.0 |
| GPT-5.3-Chat | 51.0 | 54.0 | 44.0 | 39.0 | 33.0 |
Table 3. ASR (%) by position of the harmful question in a 7-batch prompt. JailbreakBench.
| Model | Unrelated | Related |
|---|---|---|
| Llama-3.1-8B | 55.0 | 31.0 |
| Phi-4-14B | 65.0 | 12.0 |
| GPT-5.3-Chat | 52.0 | 42.0 |
Table 4. ASR (%) when benign questions are unrelated (GSM8K) or semantically related. JailbreakBench.
Training on batch-structured inputs is not enough by itself. Supervised fine-tuning, which only demonstrates the safe response, cuts ASR but leaves a large remainder. Direct preference optimization on the same 500 five-question examples restores the preference for the safe response and brings average ASR below 1% on both benchmarks. Utility on benign GSM8K batches is largely preserved, so the model is not simply refusing every batch.
| Method | Llama-3.1-8B | Phi-4-14B | ||
|---|---|---|---|---|
| JailbreakBench | StrongREJECT | JailbreakBench | StrongREJECT | |
| Original | 41.3 | 49.2 | 28.3 | 34.5 |
| + SFT | 23.8 (−17.5) | 29.8 (−19.4) | 10.0 (−18.3) | 9.9 (−24.6) |
| + DPO | 0.5 (−40.8) | 0.6 (−48.6) | 0.3 (−28.0) | 0.3 (−34.2) |
Table 5. Average ASR (%) across harmful-question positions on 12-batch prompts. Both methods use LoRA on 500 examples.
Figure 7. After DPO (left), batch-prompt centroids move back toward the harmful region relative to the base model (right).
Input filters also lose the harmful question as the batch grows. Detection falls for Llama Guard 4, OpenAI Moderation, and Azure AI Content Safety, and length-normalized perplexity drops toward ordinary math text.
| Input | Llama Guard 4 | OpenAI Moderation | Azure Content Safety | PPL |
|---|---|---|---|---|
| GSM8K | — | — | — | 10.140 |
| Single harmful | 92.0% | 69.0% | 37.0% | 26.886 |
| 3-batch | 63.0% | 57.0% | 22.0% | 10.182 |
| 5-batch | 46.0% | 50.0% | 19.0% | 8.213 |
| 7-batch | 34.0% | 49.0% | 18.0% | 7.360 |
| 9-batch | 27.0% | 43.0% | 19.0% | 6.924 |
Table 6. Detection rate and length-normalized perplexity as batch size grows.
@article{kim2026safety,
title={Safety in Batches? Understanding and Mitigating Safety Failures in Batch Prompting},
author={Kim, Kihyun and Kim, HeeSeon and Lee, Wonjun and Kim, Changick},
journal={arXiv preprint arXiv:2608.02681},
year={2026}
}