GPTFUZZER: Red Teaming Large Language Models with Auto-Generated Jailbreak Prompts

Jiahao Yu, Xingwei Lin, Zheng Yu, Xinyu XingarXiv 2023 · DOI

Abstract

Ensuring Large Language Models (LLMs) do not generate harmful content is a critical challenge. While safety alignment techniques like Reinforcement Learning from Human Feedback (RLHF) are standard, they remain vulnerable to "jailbreak" prompts—adversarial inputs that bypass safety filters. Historically, these prompts were manually crafted and labor-intensive to maintain. This paper introduces GPTFUZZER, a black-box fuzzing framework that automates jailbreak generation. By evolving human-written templates through Monte Carlo Tree Search (MCTS) and LLM-guided mutation, GPTFUZZER achieves over 90% attack success rates against state-of-the-art models like ChatGPT and Llama-2, highlighting the need for more robust automated red-teaming.

Introduction

As LLMs become integrated into various applications, preventing the generation of illegal, biased, or harmful content is paramount. Developers use alignment techniques to make models "safe," but adversarial users often find workarounds using complex personas or fictional scenarios. These "jailbreaks" have traditionally been "artisanal"—hand-crafted and difficult to scale. Moreover, as models are updated (e.g., from GPT-3.5-turbo-0301 to 0631), manual prompts often lose effectiveness. GPTFUZZER addresses this by automating the discovery and evolution of jailbreak templates.

Comparison of a normal prompt and a jailbreak prompt designed to bypass safety filters.

Methodology

GPTFUZZER adapts the principles of software fuzzing (like American Fuzzy Lop) to natural language processing.

Seed Selection and Mutation

The framework starts with a pool of human-written templates. It employs MCTS-Explore, a strategy that balances exploitation of successful templates with exploration of new mutation paths. To mutate these templates, GPTFUZZER uses an LLM (ChatGPT) as a "mutator" with five specialized operators:

  • Generate: Creating new templates in a similar style.
  • Crossover: Merging two successful templates.
  • Expand/Shorten: Altering prompt complexity.
  • Rephrase: Changing wording while maintaining intent.

Automated Judgment

To evaluate attack success at scale, the authors fine-tuned a local RoBERTa model to classify LLM responses as "jailbroken" or "rejected." This model achieved 96.16% accuracy, significantly outperforming OpenAI’s Moderation API and simple keyword matching.

Key Insights

A significant finding is that safety is a "moving target." While newer model versions are more resistant to static, human-written jailbreaks, they remain highly vulnerable to automated variations generated by GPTFUZZER.

A modified jailbreak prompt successfully bypasses safety filters on a newer model version where the original failed.

Furthermore, even "invalid" seeds—templates that initially fail to jailbreak a model—can be evolved into potent attacks. The study also noted that longer, more complex prompts (often resulting from "Crossover" or "Expand" mutations) are more effective, suggesting that LLMs may be vulnerable to "context-overload" or distraction within intricate scenarios.

Results and Transferability

GPTFUZZER achieved over 90% Attack Success Rate (ASR) against ChatGPT and Llama-2-7B-Chat. On average, it required only 22 queries to find a successful jailbreak for Llama-2. Notably, prompts evolved on one set of models showed high transferability to unseen commercial models like Claude-2 (90% ASR) and PaLM2 (95% ASR).

Conclusion

GPTFUZZER demonstrates that the "arms race" in LLM safety can be automated. By systematically evolving adversarial prompts, it exposes persistent vulnerabilities in state-of-the-art models. This work underscores the importance of continuous, automated red-teaming to keep pace with evolving LLM capabilities and safety measures.

Summary updated

BibTeX
@misc{yu2023gptfuzzer,
  author = {Jiahao Yu and Xingwei Lin and Zheng Yu and Xinyu Xing},
  title = {{GPTFUZZER: Red Teaming Large Language Models with Auto-Generated Jailbreak Prompts}},
  year = {2023},
  eprint = {2309.10253},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.10253},
}
Figure