SafeDecoding: Defending against Jailbreak Attacks via Safety-Aware Decoding
Zhangchen Xu, Fengqing Jiang, Luyao Niu, Jinyuan Jia, Bill Yuchen Lin, Radha Poovendran
摘要
As large language models (LLMs) become increasingly integrated into real-world applications such as code generation and chatbot assistance, extensive efforts have been made to align LLM behavior with human values, including safety. Jailbreak attacks, which aim to provoke unintended and unsafe behaviors from LLMs, remain a significant LLM safety threat. We analyze tokens, which are the smallest unit of text that can be processed by LLMs and make the following observations: (1) probabilities of tokens representing harmful responses are higher than those of harmless responses, and (2) responses containing safety disclaimers appear among the top tokens when token probabilities are sorted in descending order. In this paper, we leverage (1) and (2) to develop SafeDecoding, a safety-aware decoding strategy for LLMs, to defend against jailbreak attacks. We perform extensive experiments to evaluate SafeDecoding against six SOTA jailbreak attacks (GCG, AutoDAN, PAIR, DeepInception, SAP30, and template-based attack) on five LLMs (Vicuna, Llama2, Guanaco, falcon, and Dolphin) using four benchmark datasets (AdvBench, HEx-PHI, MT-Bench, and Just-Eval). Our results show that SafeDecoding significantly reduces attack success rate and harmfulness of jailbreak attacks without compromising the helpfulness of responses to benign user queries while outperforming six defense methods (Perpelexity, Paraphrase, Retokenization, Self-Reminder, ICD, and Self-Examination).
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 89 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- GPT-4 Is Too Smart To Be Safe: Stealthy Chat with LLMs via Cipher 引用了 How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs
- How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs 引用了 GPT-4 Is Too Smart To Be Safe: Stealthy Chat with LLMs via Cipher
- GPT-4 Is Too Smart To Be Safe: Stealthy Chat with LLMs via Cipher 引用了 Training language models to follow instructions with human feedback
- ArtPrompt: ASCII Art-based Jailbreak Attacks against Aligned LLMs 引用了 Training language models to follow instructions with human feedback
- LLMs know their vulnerabilities: Uncover Safety Gaps through Natural Distribution Shifts 引用了 How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs
- QLoRA: Efficient Finetuning of Quantized LLMs 引用了 Training language models to follow instructions with human feedback
- Refuse Whenever You Feel Unsafe: Improving Safety in LLMs via Decoupled Refusal Training 引用了 Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!
- Refuse Whenever You Feel Unsafe: Improving Safety in LLMs via Decoupled Refusal Training 引用了 How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs
- Refuse Whenever You Feel Unsafe: Improving Safety in LLMs via Decoupled Refusal Training 引用了 Training language models to follow instructions with human feedback
- Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To! 引用了 Training language models to follow instructions with human feedback
- Mission Impossible: A Statistical Perspective on Jailbreaking LLMs 引用了 GPT-4 Is Too Smart To Be Safe: Stealthy Chat with LLMs via Cipher
- Mission Impossible: A Statistical Perspective on Jailbreaking LLMs 引用了 Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!
- Mission Impossible: A Statistical Perspective on Jailbreaking LLMs 引用了 How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs
- Mission Impossible: A Statistical Perspective on Jailbreaking LLMs 引用了 Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks
- Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks 引用了 How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMs
- Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks 引用了 Training language models to follow instructions with human feedback
引用它的顶会 Paper89
- GPT-4 Is Too Smart To Be Safe: Stealthy Chat with LLMs via CipherYouliang Yuan, Wenxiang Jiao, Wenxuan Wang, Jen-tse Huang 等ICLR 2024 · 441 次引用
- Refuse Whenever You Feel Unsafe: Improving Safety in LLMs via Decoupled Refusal TrainingYouliang Yuan, Wenxiang Jiao, Wenxuan Wang, Jen-tse Huang 等ACL 2025 · 65 次引用
- LLMs know their vulnerabilities: Uncover Safety Gaps through Natural Distribution ShiftsQibing Ren, Hao Li, Dongrui Liu, Zhanxu Xie 等ACL 2025 · 53 次引用
- Mission Impossible: A Statistical Perspective on Jailbreaking LLMsJingtong Su, Julia Kempe, Karen UllrichNeurIPS 2024 · 38 次引用
- ArtPrompt: ASCII Art-based Jailbreak Attacks against Aligned LLMsFengqing Jiang, Zhangchen Xu, Luyao Niu, Zhen Xiang 等ACL 2024 · 36 次引用
它引用的 Paper8
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida 等NeurIPS 2022 · 24,707 次引用
- QLoRA: Efficient Finetuning of Quantized LLMsTim Dettmers, Artidoro Pagnoni, Ari Holtzman, Luke ZettlemoyerNeurIPS 2023 · 5,863 次引用
- Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!Xiangyu Qi, Yi Zeng, Tinghao Xie, Pin-Yu Chen 等ICLR 2024 · 1,104 次引用
- Robust Prompt Optimization for Defending Language Models Against Jailbreaking AttacksAndy Zhou, Bo Li, Haohan WangNeurIPS 2024 · 198 次引用
- How Johnny Can Persuade LLMs to Jailbreak Them: Rethinking Persuasion to Challenge AI Safety by Humanizing LLMsYi Zeng, Hongpeng Lin, Jingwen Zhang, Diyi Yang 等ACL 2024 · 64 次引用
相关 Paper
- Safety Guardrails of Large Language Models Are Vulnerable to Value-Driven Adversarial PromptingXiaohao Luo, Ying Wei, Zhijun LiACL Findings 2026
- Why Not Act on What You Know? Unleashing Safety Potential of LLMs via Self-Aware Guard EnhancementPeng Ding, Jun Kuang, Zongyu Wang, Xuezhi Cao 等ACL Findings 2025
- Catastrophic Jailbreak of Open-source LLMs via Exploiting GenerationYangsibo Huang, Samyak Gupta, Mengzhou Xia, Kai Li 等ICLR 2024 · 481 次引用
- SecDecoding: Steerable Decoding for Safer LLM GenerationJiayou Wang, Rundong Liu, Yue Hu, Huijia Wu 等EMNLP Findings 2025
- A Comprehensive Study of Jailbreak Attack versus Defense for Large Language ModelsZihao Xu, Yi Liu, Gelei Deng, Yuekang Li 等ACL Findings 2024 · 69 次引用
