Damon Who
Damon Who

Posted on

Unveiling Many-Shot Jailbreaking: A New Challenge for LLMs

2 Apr 2024

Read the paper

We've explored a technique known as “jailbreaking”—a method designed to circumvent the safety guardrails established by developers of large language models (LLMs). This method, dubbed “many-shot jailbreaking”, has shown effectiveness across various models, including those developed by Anthropic, along with others in the AI industry. Prior to public disclosure, we shared details of this vulnerability with other AI developers and have since implemented countermeasures.

The essence of many-shot jailbreaking capitalizes on the expanded context window of LLMs, which has significantly increased over the past year. Initially, LLMs could process inputs akin to a long essay (~4,000 tokens), but now, some models handle inputs as extensive as several novels (1,000,000 tokens or more).

Why Publishing This Research Matters

  • Prompting Quicker Fixes: By sharing our findings, we aim to expedite the development of strategies to counter many-shot jailbreaking.
  • Encouraging Open Sharing: We advocate for a culture of transparency among LLM providers and researchers to collectively address such vulnerabilities.
  • Anticipating Independent Discovery: Given the current evolution of AI, it’s plausible that similar jailbreaking methods could emerge independently.
  • Mitigating Potential Risks: Although current LLMs may not present catastrophic risks, future advancements could. Addressing these vulnerabilities now is crucial.

Understanding Many-Shot Jailbreaking

Many-shot jailbreaking involves embedding a faux dialogue within a prompt, where an AI assistant appears to comply with harmful requests. This setup, when scaled to a large number of dialogues, can override the model's safety training and elicit dangerous responses.

Why It Works

This technique leverages “in-context learning,” where a model draws on information within the prompt itself to generate responses. Our research suggests that the efficacy of many-shot jailbreaking mirrors the statistical patterns observed in in-context learning for benign tasks.

Mitigation Efforts

While restricting the context window size could outright prevent many-shot jailbreaking, we seek solutions that preserve the utility of larger inputs. Our efforts include fine-tuning models against recognizable patterns of jailbreaking attempts and exploring prompt-based mitigations to significantly reduce the success rate of such attacks.


The expanding capabilities of LLMs bring about new challenges, such as many-shot jailbreaking. Our commitment to advancing model safety and security drives us to uncover and address these vulnerabilities, fostering a safer AI ecosystem.

For full technical insights, refer to our comprehensive paper here.

Top comments (0)