Query-Based Adversarial Prompt Generation
Jonathan Hayase, Ema Borevkovic, Nicholas Carlini, Florian Tramèr, Milad Nasr
Abstract
Recent work has shown it is possible to construct adversarial examples that cause an aligned language model to emit harmful strings or perform harmful behavior. Existing attacks work either in the white-box setting (with full access to the model weights), or through transferability: the phenomenon that adversarial examples crafted on one model often remain effective on other models. We improve on prior work with a query-based attack that leverages API access to a remote language model to construct adversarial examples that cause the model to emit harmful strings with (much) higher probability than with transfer-only attacks. We validate our attack on GPT-3.5 and OpenAI's safety classifier; we can cause GPT-3.5 to emit harmful strings that current transfer attacks fail at, and we can evade the safety classifier with nearly 100% probability.
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.
24 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
- 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 AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts
- Improved Few-Shot Jailbreaking Can Circumvent Aligned Language Models and Their Defenses cites Tree of Attacks: Jailbreaking Black-Box LLMs Automatically
- Improved Few-Shot Jailbreaking Can Circumvent Aligned Language Models and Their Defenses cites Catastrophic Jailbreak of Open-source LLMs via Exploiting Generation
- Improved Few-Shot Jailbreaking Can Circumvent Aligned Language Models and Their Defenses cites AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models
- GASP: Efficient Black-Box Generation of Adversarial Suffixes for Jailbreaking LLMs cites Tree of Attacks: Jailbreaking Black-Box LLMs Automatically
- GASP: Efficient Black-Box Generation of Adversarial Suffixes for Jailbreaking LLMs cites AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts
- GASP: Efficient Black-Box Generation of Adversarial Suffixes for Jailbreaking LLMs cites AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models
Cited by top-tier papers24
- Stealing part of a production language modelNicholas Carlini, Daniel Paleka, Krishnamurthy Dj Dvijotham, Thomas Steinke et al.ICML 2024 · 157 citations
- Improved Few-Shot Jailbreaking Can Circumvent Aligned Language Models and Their DefensesXiaosen Zheng, Tianyu Pang, Chao Du, Qian Liu et al.NeurIPS 2024 · 96 citations
- Jailbreaking Large Language Models Against Moderation Guardrails via Cipher CharactersHaibo Jin, Andy Zhou, Joe D. Menke, Haohan WangNeurIPS 2024 · 55 citations
- PaCE: Parsimonious Concept Engineering for Large Language ModelsJinqi Luo, Tianjiao Ding, Kwan Ho Ryan Chan, Darshan Thaker et al.NeurIPS 2024 · 20 citations
- GASP: Efficient Black-Box Generation of Adversarial Suffixes for Jailbreaking LLMsAdvik Raj Basani, Xiao ZhangNeurIPS 2025 · 16 citations
Builds on9
- Towards Evaluating the Robustness of Neural NetworksNicholas Carlini, David A. WagnerS&P 2017 · 9,786 citations
- AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated PromptsTaylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace et al.EMNLP 2020 · 1,162 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
- Are aligned neural networks adversarially aligned?Nicholas Carlini, Milad Nasr, Christopher A. Choquette-Choo, Matthew Jagielski et al.NeurIPS 2023 · 412 citations
- QueryAttack: Jailbreaking Aligned Large Language Models Using Structured Non-natural Query LanguageQingsong Zou, Jingyu Xiao, Qing Li, Zhi Yan et al.ACL Findings 2025 · 4 citations
- No, of Course I Can! Deeper Fine-Tuning Attacks That Bypass Token-Level Safety MechanismsJoshua Kazdan, Abhay Puri, Rylan Schaeffer, Lisa Yu et al.ICLR 2026
- Uncovering Safety Risks of Large Language Models through Concept Activation VectorZhihao Xu, Ruixuan Huang, Changyu Chen, Xiting WangNeurIPS 2024 · 83 citations
- Emulated Disalignment: Safety Alignment for Large Language Models May Backfire!Zhanhui Zhou, Jie Liu, Zhichen Dong, Jiaheng Liu et al.ACL 2024
