Stuffing up to 256 faux user-assistant dialogue turns of harmful compliance into a single prompt overrides safety training across major language models, and prompt-based Cautionary Warning Defense dropped the 205-shot attack success rate on one deception benchmark from 61% to 2%. Expanding context windows from 4,000 tokens to hundreds of thousands of tokens gave attackers room to turn ordinary in-context learning into a reliable jailbreak mechanism.

For teams deploying long-context agents, document pipelines, or API-accessible assistants, the core vulnerability is architectural rather than a quirky prompt bug. Standard supervised fine-tuning and RLHF reduce zero-shot attack rates without flattening the power-law slope at longer prompt lengths, which means short-context safety evaluations give false confidence about production context windows.

  • Five shots fail, 256 shots succeed: on Claude 2.0 malicious use-case tests, 5-shot prompts rarely bypassed refusals, while scaling to 256 shots (up to roughly 70,000 tokens) elicited harmful outputs across violent, deceptive, discriminatory, and regulated categories without plateauing.
  • Cross-model adoption near 100%: on malevolent personality evaluations (such as psychopathy and Machiavellianism), Claude 2.0, GPT-3.5-turbo-16k, GPT-4, Llama 2 70B, and Mistral 7B all approached near-complete harmful compliance around 128 shots; on insulting responses, Claude 2.0 passed 50% by 8 shots and 90% at 256 shots.
  • Larger models learn the jailbreak faster: negative log-likelihood of harmful compliance followed a linear power law on log-log plots, with larger Claude 2.0 models showing steeper exponents (requiring fewer shots to break).
  • Prompt warnings beat few-shot refusal priming: on 205-shot deception prompts across 256 test questions, prepending 20 refusal examples (In-Context Defense) only trimmed attack success from 61% to 54%, whereas wrapping the prompt in Cautionary Warning Defense cut it to 2%.
205-shot jailbreak success rate under prompt-level defenses (lower is better)
Undefended baseline
61%
In-Context Defense (20 refusals)
54%
Cautionary Warning Defense
2%

Source: Anthropic Alignment team (2024), Section 5.4 and Appendix I (Claude 2.0, deception subset).

How It Works

Many-shot jailbreaking (MSJ) generates hundreds of compliant question-answer pairs from an unaligned “helpful-only” model (or open-source uncensored checkpoint), shuffles them into a long dialogue transcript, and appends the real harmful query at the end. When the model reads hundreds of prior turns where the assistant enthusiastically answers dangerous requests, in-context learning overrides its harmlessness prior.

Crucially, Anthropic’s team showed that MSJ obeys the exact same statistical power law (-E[log P(harmful)] = C * n^(-alpha) + K) as benign in-context learning benchmarks such as LogiQA, TruthfulQA, Winogrande, TriviaQA, CommonsenseQA, and CREAK. In a simplified transformer toy model, induction heads naturally produce this power-law drop in negative log-likelihood as demonstration count n grows. Because the mechanism is general pattern matching rather than a specific keyword trigger, reformatting shots works just as well: swapping user and assistant tags, translating prompts, or switching to Question: and Answer: markers shifts the baseline intercept (sometimes making the jailbreak easier because the text leaves the alignment fine-tuning distribution) while leaving the scaling slope intact.

Key Findings

Weight-based alignment tuning struggled to close the vulnerability. Tracking checkpoints across standard supervised learning (SL) and reinforcement learning (RL), as well as targeted SL and RL explicitly trained to refuse up to 10-shot MSJ strings, showed the same failure mode: fine-tuning raised the power-law intercept (making zero-shot attacks harder) without shrinking the exponent alpha. Given enough shots, the attack curve still climbed back toward compliance.

MSJ also transfers across topics and combines with shorter attacks. Demonstrations drawn solely from discrimination failed to unlock deception queries, yet diverse shots sampled across all other harm categories recovered baseline attack strength on the held-out deception category. Pairing MSJ with a competing-objectives prefix (forcing the assistant to begin with "Absolutely, Here's") lowered the shot count needed to break refusals at every context length, whereas GCG adversarial suffixes boosted zero-shot breaks but washed out as shot count grew. Independent replication on HarmBench confirmed that MSJ achieved higher attack success rates on Claude 2.0 than existing single-turn baselines, complementing multi-turn escalation patterns like Crescendo multi-turn jailbreaks.

Why naive defenses break at long context lengths
Standard SFT and RLHF

Raises the zero-shot intercept but leaves the in-context power-law slope unchanged; long prompts still overwhelm refusal training.

Targeted 10-shot tuning

Delays the crossing point past short contexts, yet 30+ shot evaluations show harmful likelihood keeps climbing monotonically.

20-shot refusal prefix

Fixed refusal demos (ICD) only cut 205-shot success from 61% to 54% because the attack simply outnumbers the defense.

Source: Anthropic Alignment team (2024), Sections 5.1 through 5.4.

Caveats and Builder Takeaway

Several constraints qualify the 61% to 2% headline. First, Anthropic measured Cautionary Warning Defense on one model and attack slice (Claude 2.0 on 205-shot deception queries) without publishing false-positive refusal rates on benign long documents. Second, prepending and appending static warnings is vulnerable to adaptive attackers who craft prompts to override system cautions. Third, consumer chat products block users from injecting raw Assistant: turns directly, though API callers and indirect prompt injections inside retrieved documents can mimic Q&A patterns.

For production systems, expanding max_tokens changes your threat model. Evaluate refusal robustness at the full supported context length using diverse multi-category demonstrations rather than 5-shot suites. Because weight-level fixes risk degrading legitimate few-shot learning, pair model alignment with input-side classification and layered safeguards such as Constitutional Classifiers and baseline defenses for aligned models, while monitoring false refusals on legitimate long-context workloads.