Improved Few-Shot Jailbreaking Can Circumvent Aligned Language Models and Their Defenses
Xiaosen Zheng, Tianyu Pang, Chao Du, Qian Liu, Jing Jiang, Min Lin
Abstract
Recently, Anil et al. (2024) show that many-shot (up to hundreds of) demonstrations can jailbreak state-of-the-art LLMs by exploiting their long-context capability. Nevertheless, is it possible to use few-shot demonstrations to efficiently jailbreak LLMs within limited context sizes? While the vanilla few-shot jailbreaking may be inefficient, we propose improved techniques such as injecting special system tokens like [/INST] and employing demo-level random search from a collected demo pool. These simple techniques result in surprisingly effective jailbreaking against aligned LLMs (even with advanced defenses). For examples, our method achieves>80% (mostly>95%) ASRs on Llama-2-7B and Llama-3-8B without multiple restarts, even if the models are enhanced by strong defenses such as perplexity detection and/or SmoothLLM, which is challenging for suffix-based jailbreaking. In addition, we conduct comprehensive and elaborate (e.g., making sure to use correct system prompts) evaluations against other aligned LLMs and advanced defenses, where our method consistently achieves nearly 100% ASRs. Our code is available at https://github.com/sail-sg/I-FSJ.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
20 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- GuidedBench: Measuring and Mitigating the Evaluation Discrepancies of In-the-wild LLM Jailbreak Methods cites Tree of Attacks: Jailbreaking Black-Box LLMs Automatically
- GuidedBench: Measuring and Mitigating the Evaluation Discrepancies of In-the-wild LLM Jailbreak Methods cites Catastrophic Jailbreak of Open-source LLMs via Exploiting Generation
- GuidedBench: Measuring and Mitigating the Evaluation Discrepancies of In-the-wild LLM Jailbreak Methods cites AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models
- Lifelong Safety Alignment for Language Models cites AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models
- Tree of Attacks: Jailbreaking Black-Box LLMs Automatically cites AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models
- Catastrophic Jailbreak of Open-source LLMs via Exploiting Generation cites Language Models are Few-Shot Learners
- Catastrophic Jailbreak of Open-source LLMs via Exploiting Generation cites Training language models to follow instructions with human feedback
- MixAT: Combining Continuous and Discrete Adversarial Training for LLMs cites Tree of Attacks: Jailbreaking Black-Box LLMs Automatically
- MixAT: Combining Continuous and Discrete Adversarial Training for LLMs cites AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models
- Training language models to follow instructions with human feedback cites Language Models are Few-Shot Learners
- AdvPrefix: An Objective for Nuanced LLM Jailbreaks cites Tree of Attacks: Jailbreaking Black-Box LLMs Automatically
- AdvPrefix: An Objective for Nuanced LLM Jailbreaks cites Catastrophic Jailbreak of Open-source LLMs via Exploiting Generation
- AdvPrefix: An Objective for Nuanced LLM Jailbreaks cites Training language models to follow instructions with human feedback
- AdvPrefix: An Objective for Nuanced LLM Jailbreaks cites AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models
- AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models cites Training language models to follow instructions with human feedback
Cited by top-tier papers20
- AdvPrefix: An Objective for Nuanced LLM JailbreaksSicheng Zhu, Brandon Amos, Yuandong Tian, Chuan Guo et al.NeurIPS 2025 · 25 citations
- Lifelong Safety Alignment for Language ModelsHaoyu Wang, Yifei Zhao, Zeyu Qin, Chao Du et al.NeurIPS 2025 · 18 citations
- PIG: Privacy Jailbreak Attack on LLMs via Gradient-based Iterative In-Context OptimizationYidan Wang, Yanan Cao, Yubing Ren, Fang Fang et al.ACL 2025 · 12 citations
- MixAT: Combining Continuous and Discrete Adversarial Training for LLMsCsaba Dékány, Stefan Balauca, Dimitar I. Dimitrov, Robin Staab et al.NeurIPS 2025 · 12 citations
- GuidedBench: Measuring and Mitigating the Evaluation Discrepancies of In-the-wild LLM Jailbreak MethodsRuixuan Huang, Xunguang Wang, Zongjie Li, Daoyuan Wu et al.ICLR 2026 · 11 citations
Builds on28
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
- Tree of Attacks: Jailbreaking Black-Box LLMs AutomaticallyAnay Mehrotra, Manolis Zampetakis, Paul Kassianik, Blaine Nelson et al.NeurIPS 2024 · 835 citations
- AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language ModelsXiaogeng Liu, Nan Xu, Muhao Chen, Chaowei XiaoICLR 2024 · 722 citations
- Catastrophic Jailbreak of Open-source LLMs via Exploiting GenerationYangsibo Huang, Samyak Gupta, Mengzhou Xia, Kai Li et al.ICLR 2024 · 481 citations
Related papers
- Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical EvidenceShaopeng Fu, Liang Ding, Jingfeng Zhang, Di WangNeurIPS 2025 · 15 citations
- Defensive Prompt Patch: A Robust and Generalizable Defense of Large Language Models against Jailbreak AttacksChen Xiong, Xiangyu Qi, Pin-Yu Chen, Tsung-Yi HoACL Findings 2025 · 9 citations
- What Really Matters in Many-Shot Attacks? An Empirical Study of Long-Context Vulnerabilities in LLMsSangyeop Kim, Yohan Lee, Yongwoo Song, Kimin LeeACL 2025
- Robust Prompt Optimization for Defending Language Models Against Jailbreaking AttacksAndy Zhou, Bo Li, Haohan WangNeurIPS 2024 · 198 citations
- Virtual Context Enhancing Jailbreak Attacks with Special Token InjectionYuqi Zhou, Lin Lu, Ryan Sun, Pan Zhou et al.EMNLP Findings 2024 · 8 citations
