[论文解读] Defensive Prompt Patch: A Robust and Interpretable Defense of LLMs against Jailbreak Attacks
本文提出防御性提示补丁(DPP),一种基于提示的防御方法,通过使用分层遗传搜索迭代优化可解释的后缀提示,提升大语言模型对越狱攻击的鲁棒性。DPP在LLAMA-2-7B-Chat上将攻击成功率降至3.8%,在Mistral-7B-Instruct-v0.2上降至2.0%,同时仅造成极小的性能损失,相较于现有方法在安全性和功能性之间实现了更优平衡。
Safety, security, and compliance are essential requirements when aligning large language models (LLMs). However, many seemingly aligned LLMs are soon shown to be susceptible to jailbreak attacks. These attacks aim to circumvent the models' safety guardrails and security mechanisms by introducing jailbreak prompts into malicious queries. In response to these challenges, this paper introduces Defensive Prompt Patch (DPP), a novel prompt-based defense mechanism specifically designed to protect LLMs against such sophisticated jailbreak strategies. Unlike previous approaches, which have often compromised the utility of the model for the sake of safety, DPP is designed to achieve a minimal Attack Success Rate (ASR) while preserving the high utility of LLMs. Our method uses strategically designed interpretable suffix prompts that effectively thwart a wide range of standard and adaptive jailbreak techniques. Empirical results conducted on LLAMA-2-7B-Chat and Mistral-7B-Instruct-v0.2 models demonstrate the robustness and adaptability of DPP, showing significant reductions in ASR with negligible impact on utility. Our approach not only outperforms existing defense strategies in balancing safety and functionality, but also provides a scalable and interpretable solution applicable to various LLM platforms.
研究动机与目标
- 为现有基于提示的防御方法中为追求安全性而牺牲模型性能这一关键缺陷提供解决方案。
- 开发一种强大、可解释且可扩展的防御机制,以应对标准与自适应越狱攻击。
- 在保持多种大语言模型平台高模型性能的前提下,将攻击成功率(ASR)降至最低。
- 在无需模型微调或梯度访问的前提下实现有效防御,完全在输入提示层面运行。
- 通过可解释的提示设计与消融验证,提供透明且稳定的防御机制。
提出的方法
- DPP使用分层遗传搜索算法,对附加在每个输入查询末尾的后缀提示进行优化。
- 优化过程由两个数据集引导:拒绝数据集(用于提升对齐性)和有用性数据集(用于保持性能)。
- 每个候选防御提示通过双分值机制进行评估:防御得分(越低越好)和性能得分(越高越好)。
- 该算法通过选择、变异和重组低分提示,迭代演化提示种群,以提升鲁棒性与性能。
- 最终的DPP作为固定后缀提示在推理阶段部署,确保极低的推理开销并具备广泛的兼容性。
- 通过设计人类可读且语义有意义的提示,增强可解释性,区别于黑盒或基于梯度的防御方法。
实验结果
研究问题
- RQ1基于提示的防御能否在不降低模型性能的前提下实现低攻击成功率?
- RQ2DPP在应对标准与自适应越狱技术(包括AutoDAN、PAIR和TAP)时表现如何?
- RQ3DPP在不同大语言模型架构(如LLAMA-2-7B-Chat和Mistral-7B-Instruct-v0.2)上是否具备鲁棒性?
- RQ4将DPP作为后缀提示使用,相较于作为前缀使用,在防御效果与性能方面是否更具优势?
- RQ5DPP机制能否实现可解释性与稳定性,从而在安全关键应用中实现透明化与可审计性?
主要发现
- 在LLAMA-2-7B-Chat模型上,DPP将攻击成功率降低至3.8%,显著优于现有防御方法。
- 在Mistral-7B-Instruct-v0.2模型上,DPP实现仅2.0%的ASR,展现出强大的跨模型泛化能力。
- DPP保持了高模型性能,在Mistral-7B-Instruct-v0.2上取得75.06%的胜率,优于DRO,尽管后者性能略低。
- 消融研究证实,将DPP作为后缀使用,其防御效果与性能均优于作为前缀使用。
- DPP在六种不同越狱攻击(包括GCG、AutoDAN和TAP)中实现了最低的平均ASR,证明其卓越鲁棒性。
- 该方法具备可解释性,最终的DPP提示语义清晰且人类可读,显著提升了透明度与可信度。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。