You can edit almost every page by Creating an account and confirming your email.

Jailbreaking LLMs

From EverybodyWiki Bios & Wiki


Jailbreaking History and Techniques in Large Language Models

History

The term "jailbreaking," originally used in the context of mobile devices to describe the removal of manufacturer restrictions, began to be applied to large language models (LLMs) in early 2023. This shift was prompted by the emergence of prompt-based exploits that bypassed safety filters in systems. One of the first widely publicized jailbreaks was the "DAN" (Do Anything Now) prompt, which tricked the model into role-playing an unfiltered persona capable of generating prohibited content.

Academic formalization of LLM jailbreaking began in mid-2023, with Chao et al. demonstrating that black-box adversaries could reliably induce harmful responses from closed-source models using fewer than 20 queries per attack target [1]. This work established a foundation for subsequent research on query-efficient, alignment-violating attacks. Community red-teamers and open-source contributors simultaneously began documenting and sharing jailbreak prompts, further accelerating interest and scrutiny.

By 2024, the field of jailbreaking had expanded significantly. A wave of research introduced systematic methodologies and evaluation tools. Notable benchmarks such as JailbreakBench [2] and AdvBench [3] provided standardized criteria for attack success, model robustness, and transferability. Attack methods evolved beyond simple prompts to include tree-based search [4], dense-to-sparse optimization [5], and adversarial suffix generation [6].

Industry Response

Industry responses to jailbreaking escalated alongside the attacks. Initially, model providers issued reactive filter updates, blocking specific prompt patterns as they emerged. Over time, more robust mitigations were introduced, including alignment fine-tuning, reinforcement learning from human feedback (RLHF), adversarial training, and content moderation layers.

By late 2024, companies began adopting red-teaming as part of the model release pipeline, often in collaboration with external security researchers. Still, papers such as Wei et al. [7] and Anil et al. [8] argued that existing safety training often failed to generalize, making LLMs susceptible to carefully crafted inputs.

Today, jailbreak research and defenses remain a dynamic arms race between model developers and adversaries, raising ongoing debates about security, transparency, and ethical deployment of language technologies.

Attack Methods

Jailbreaking attacks on LLMs can be broadly categorized into manual and automatic approaches [3].

Manual Jailbreaking

Manual jailbreaks were most prevalent in the early stages of LLM deployment, especially before automated adversarial optimization tools became common. These approaches rely on human creativity and iterative interaction with models to craft effective jailbreak prompts. The process typically involves manually rewriting prompts based on the model’s outputs, exploiting contextual loopholes or misinterpretations [3]. Consequently, manual attacks are often labor-intensive and less scalable than their automated counterparts.

Notable techniques include:

  • Pretending: Alters the conversation’s roleplay context (e.g., simulating a fictional character or hypothetical scenario) to bypass filters while maintaining the original malicious intent [9].
  • Attention Shifting: Redirects the focus of the prompt away from the actual request, often by embedding it in irrelevant or misleading context [9].
  • Privilege Escalation: Emulates system-level or administrative personas to exploit hidden capabilities or override safety rules [9].
  • Obfuscation: Uses leetspeak, intentional typos, or encoding techniques to evade string-matching filters [10].
  • Prompt Segmentation: Splits adversarial intent into smaller, less suspicious chunks that only reveal malicious intent when interpreted collectively [9].
  • Nested Prompting: Embeds instructions within other benign-seeming prompts to exploit parsing limitations and bypass safeguards [11].

Automatic Jailbreaking

Automatic jailbreaks use algorithmic or LLM-driven mechanisms to generate and optimize adversarial prompts with minimal human intervention. These approaches are increasingly scalable, adaptive, and effective across multiple model architectures [3].

Representative methods include:

  • GCG (Greedy Coordinate Gradient descent): A white-box, gradient-based method that constructs adversarial suffixes token by token to induce policy violations [12].
  • PAIR (Prompt Automatic Iterative Refinement): Uses a looped feedback process to refine jailbreak prompts over multiple attempts, automatically improving success rates through learned edits [1].
  • Tree-of-Attacks: Employs a compositional, tree-structured search strategy to combine modular subprompts, leading to highly effective black-box jailbreaks [4].
  • BEAST: A black-box, gradient-free method that performs greedy token selection based on response likelihoods to discover effective suffixes [13].
  • AdvLLM: Treats jailbreak prompt generation as a language modeling task, training or prompting LLMs themselves to produce adversarial instructions using learned distributions [14].

These methods represent a shift from heuristic hacking toward systematic jailbreak engineering, often leveraging optimization theory, programmatic search, and self-tuning strategies to stay ahead of evolving defenses.

Datasets and Benchmarks

As the study of jailbreaking LLMs has matured, a suite of standardized datasets and evaluation frameworks has emerged to assess attack effectiveness and defense robustness. These resources facilitate reproducible comparisons across models and jailbreak techniques, fostering consistency in safety evaluations.

JailbreakBench, developed by Chao et al. [2], supports both black-box and white-box attack evaluations on open and closed LLMs. It includes a repository of adversarial prompts, a standardized dataset covering 100 behavior targets, and an evaluation pipeline. It tracks metrics such as attack success rate, query efficiency, and alignment violation detection.

AdvBench, introduced by Lin et al. [3], focuses on white-box adversarial attacks targeting safety violations and includes both handcrafted and optimized adversarial suffixes.

RedBench is a community-curated corpus of jailbreak prompts and injection examples collected from red-teaming experiments and independent research.

The OpenLLM Red Team Dataset aggregates adversarial inputs from large-scale public evaluations of open-source LLMs. It includes both prompt-level attacks and response logs.

Common evaluation metrics across benchmarks include:

  • Attack Success Rate (ASR): Proportion of inputs causing unsafe or policy-violating responses.
  • Query Efficiency: Number of model queries required to achieve a successful jailbreak.
  • Toxicity Scores: Harmfulness of outputs, often from classifiers like Detoxify.
  • Alignment Violation Detection: Whether the model response violates developer-imposed safety constraints.

These benchmarks are central to LLM safety research, supporting reproducibility and shared evaluation standards.

Ethical Concerns

Jailbreaking research in LLMs raises profound ethical considerations due to its inherently dual-use nature. While adversarial testing helps identify vulnerabilities, the same techniques can be misused.

A core ethical tension lies in disclosure. JailbreakBench [2] limits access to adversarial payloads to prevent misuse, while others support open dissemination for reproducibility. Responsible red-teaming has emerged, where researchers coordinate with developers to mitigate harm before public release. Studies like Iterative Self-Tuning LLMs [14] and Many-Shot Jailbreaking [8] emphasize the importance of such coordination.

Another concern is benchmark overfitting. Developers may over-optimize for known benchmarks, hiding broader vulnerabilities. There is also the issue of misattribution: not all jailbreak-like outputs result from alignment failures. As Wei et al. argue in Jailbroken: How Does LLM Safety Training Fail? [7], distinguishing genuine policy violations from model confusion remains challenging.

As LLMs are integrated into sensitive domains like education and healthcare, jailbreak research must be governed ethically, balancing security needs with societal risk.

References


This article "Jailbreaking LLMs" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Jailbreaking LLMs. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.

  1. 1.0 1.1 Chao, Patrick; Robey, Alexander; Dobriban, Edgar; Hassani, Hamed; Pappas, George J.; Wong, Eric (2023). "Jailbreaking Black Box Large Language Models in Twenty Queries". arXiv:2310.08419 [cs.LG].
  2. 2.0 2.1 2.2 Chao, Patrick; Debenedetti, Edoardo; Robey, Alexander; Andriushchenko, Maksym; Croce, Francesco; Sehwag, Vikash; Dobriban, Edgar; Flammarion, Nicolas; Pappas, George J.; Tramer, Florian; Hassani, Hamed; Wong, Eric (2024). "JailbreakBench: An Open Robustness Benchmark for Jailbreaking Large Language Models". arXiv:2404.01318 [cs.CR].
  3. 3.0 3.1 3.2 3.3 3.4 Liao, Zhiyu; Chen, Kang; Lin, Yuanguo; Li, Kangkang; Liu, Yunxuan; Chen, Hefeng; Huang, Xingwang; Yu, Yuanhui (2025). "Attack and defense techniques in large language models: A survey and new perspectives". arXiv:2505.00976 [cs.CR].
  4. 4.0 4.1 Mehrotra, Anay; Zampetakis, Manolis; Kassianik, Paul; Nelson, Blaine; Anderson, Hyrum; Singer, Yaron; Karbasi, Amin (2023). "Tree of Attacks: Jailbreaking Black-Box LLMS Automatically". arXiv:2312.02119 [cs.LG].
  5. Hu, Kai; Yu, Weichen; Li, Yining; Chen, Kai; Yao, Tianjun; Li, Xiang; Liu, Wenhe; Yu, Lijun; Shen, Zhiqiang; Fredrikson, Matt (2024). "Efficient LLM Jailbreak via Adaptive Dense-to-sparse Constrained Optimization". arXiv:2405.09113 [cs.LG].
  6. Liao, Zeyi; Sun, Huan (2024). "AmpleGCG: Learning a Universal and Transferable Generative Model of Adversarial Suffixes for Jailbreaking Both Open and Closed LLMS". arXiv:2404.07921 [cs.CL].
  7. 7.0 7.1 Wei, Alexander; Haghtalab, Nika; Steinhardt, Jacob (2023). "Jailbroken: How Does LLM Safety Training Fail?". arXiv:2307.02483 [cs.LG].
  8. 8.0 8.1 Anil, C.; et al. (2024). "Many-shot jailbreaking. NeurIPS 2024" (PDF).
  9. 9.0 9.1 9.2 9.3 Liu, Yi; Deng, Gelei; Xu, Zhengzi; Li, Yuekang; Zheng, Yaowen; Zhang, Ying; Zhao, Lida; Zhang, Tianwei; Wang, Kailong; Liu, Yang (2023). "Jailbreaking ChatGPT via Prompt Engineering: An Empirical Study". arXiv:2305.13860 [cs.SE].
  10. Cui, Tianyu; Wang, Yanling; Fu, Chuanpu; Xiao, Yong; Li, Sijia; Deng, Xinhao; Liu, Yunpeng; Zhang, Qinglin; Qiu, Ziyi; Li, Peiyang; Tan, Zhixing; Xiong, Junwu; Kong, Xinyu; Wen, Zujie; Xu, Ke; Li, Qi (2024). "Risk Taxonomy, Mitigation, and Assessment Benchmarks of Large Language Model Systems". arXiv:2401.05778 [cs.CL].
  11. Ding, Peng; Kuang, Jun; Ma, Dan; Cao, Xuezhi; Xian, Yunsen; Chen, Jiajun; Huang, Shujian (2023). "A Wolf in Sheep's Clothing: Generalized Nested Jailbreak Prompts can Fool Large Language Models Easily". arXiv:2311.08268 [cs.CL].
  12. Li, Jiahui; Hao, Yongchang; Xu, Haoyu; Wang, Xing; Hong, Yu (2024). "Exploiting the Index Gradients for Optimization-Based Jailbreaking on Large Language Models". arXiv:2412.08615 [cs.CL].
  13. Sankar Sadasivan, Vinu; Saha, Shoumik; Sriramanan, Gaurang; Kattakinda, Priyatham; Chegini, Atoosa; Feizi, Soheil (2024). "Fast Adversarial Attacks on Language Models in One GPU Minute". arXiv:2402.15570 [cs.CR].
  14. 14.0 14.1 Tramm, John; Romano, Paul; Shriwise, Patrick; Lund, Amanda; Doerfert, Johannes; Steinbrecher, Patrick; Siegel, Andrew; Ridley, Gavin (2024). "Performance Portable Monte Carlo Particle Transport on Intel, NVIDIA, and AMD GPUs". Text "eprint:2403.12345 " ignored (help); |arxiv= required (help)