[论文解读] Jailbreak Antidote: Runtime Safety-Utility Balance via Sparse Representation Adjustment in Large Language Models
Jailbreak Antidote 是一种运行时防御机制,通过在学习到的安全方向上稀疏地调整约 5% 的内部隐藏状态,在大型语言模型中实现了安全与实用性的平衡。该方法在零推理开销下实现了最先进水平的防御成功率,优于基于提示和微调的方法,同时保持了模型的实用性。
As large language models (LLMs) become integral to various applications, ensuring both their safety and utility is paramount. Jailbreak attacks, which manipulate LLMs into generating harmful content, pose significant challenges to this balance. Existing defenses, such as prompt engineering and safety fine-tuning, often introduce computational overhead, increase inference latency, and lack runtime flexibility. Moreover, overly restrictive safety measures can degrade model utility by causing refusals of benign queries. In this paper, we introduce Jailbreak Antidote, a method that enables real-time adjustment of LLM safety preferences by manipulating a sparse subset of the model's internal states during inference. By shifting the model's hidden representations along a safety direction with varying strengths, we achieve flexible control over the safety-utility balance without additional token overhead or inference delays. Our analysis reveals that safety-related information in LLMs is sparsely distributed; adjusting approximately 5% of the internal state is as effective as modifying the entire state. Extensive experiments on nine LLMs (ranging from 2 billion to 72 billion parameters), evaluated against ten jailbreak attack methods and compared with six defense strategies, validate the effectiveness and efficiency of our approach. By directly manipulating internal states during reasoning, Jailbreak Antidote offers a lightweight, scalable solution that enhances LLM safety while preserving utility, opening new possibilities for real-time safety mechanisms in widely-deployed AI systems.
研究动机与目标
- 为解决在部署的 LLM 中平衡安全与实用性这一关键挑战,尤其是在遭受越狱攻击的情况下。
- 克服现有防御方法的局限性,例如高延迟、计算开销大以及因过度保守而导致的实用性降低。
- 实现在推理过程中无需重训练或修改提示词即可实现无延迟、动态的安全调整。
- 探究 LLM 中与安全相关的信息是否稀疏分布,并可通过选择性神经元调整有效操控。
- 开发一种轻量化、可扩展且灵活的机制,用于生产环境中 LLM 系统的运行时安全控制。
提出的方法
- 该方法通过在良性和有害提示的隐藏状态上应用主成分分析(PCA),识别出一个安全方向。
- 在推理过程中,通过仅修改投影到该安全方向上投影值最大的一组神经元,将对抗性提示的隐藏表示向安全方向移动。
- 调整由缩放因子 α 控制,用于调节安全偏移的强度。
- 通过选择投影到安全方向上幅度最大的 top-k% 神经元来实现稀疏性,从而最小化对模型实用性的干扰。
- 该方法在推理时运行,无需额外的标记生成或模型微调,保持了推理速度。
- 该方法按输入动态应用,支持根据不同的安全需求实现运行时自适应。
实验结果
研究问题
- RQ1LLM 中与安全相关的信息是否可以被有效定位到内部表示的一个稀疏子集?
- RQ2对内部状态进行轻量级、运行时调整在多大程度上能提升对越狱攻击的防御效果?
- RQ3安全与实用性的权衡如何随内部状态修改的稀疏性和强度而变化?
- RQ4该方法是否能在防御有效性与推理效率两方面均优于基于提示工程和微调的防御方法?
- RQ5该方法是否可逆,从而允许在对抗性实验或对齐调优中可控地弱化安全性?
主要发现
- Jailbreak Antidote 在九种参数规模从 2B 到 72B 的 LLM 上实现了超过 90% 的防御成功率(DSR),优于六个基线方法。
- 仅调整 5% 的内部状态即可达到与修改 100% 状态相当的安全性能,证明了安全表征的稀疏性。
- 即使在高安全级别下,该方法仍保持较高的胜率(衡量良性任务性能的指标),表明对模型实用性的降级极小。
- 当 α < 0 时,该方法可逆转安全效应,使 DSR 低于基线水平,证实了其可逆性与动态控制能力。
- 基于投影幅度选择 top-k 神经元的方法优于随机选择,证明了精准定位关键神经元的重要性。
- 该方法不引入额外的标记生成或推理延迟,适用于生产环境中实时部署。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。