arXiv:2410.02298cs.CRcs.CL2024-10ICLR被引 25

通过调整模型内部5%状态实现安全与实用性的实时平衡。

Jailbreak Antidote: Runtime Safety-Utility Balance via Sparse Representation Adjustment in Large Language Models

  • 仅修改模型5%的隐藏状态,沿安全方向调节即可控制输出安全程度。
  • 在9个不同规模模型上测试,对10种攻击方法均有效,延迟为零。
  • 适合需要实时安全调控的部署场景,如客服机器人、内容审核系统。

随着大语言模型(LLMs)在各类应用中日益普及,确保其安全性和实用性至关重要。越狱攻击会诱使模型生成有害内容,威胁这一平衡。现有防御方法如提示工程和安全微调常带来计算开销、推理延迟,并缺乏运行时灵活性;过度限制又会导致模型拒绝正常请求,降低实用性。本文提出Jailbreak Antidote,通过在推理过程中操纵模型内部状态的稀疏子集,实现对安全偏好进行实时调整。通过沿安全方向以不同强度改变模型隐藏表示,可在不增加额外标记开销或推理延迟的情况下灵活控制安全-实用平衡。分析表明,大模型中的安全信息稀疏分布;仅调整约5%的内部状态即等效于修改全部状态。在九个模型(参数量从20亿到720亿)上,针对十种越狱攻击方法、对比六种防御策略的实验验证了该方法的有效性与高效性。通过直接干预推理过程中的内部状态,Jailbreak Antidote提供了一种轻量、可扩展的安全增强方案,兼顾安全性与实用性,为广泛部署的AI系统开辟了实时安全机制的新路径。

原文摘要 · Abstract (English)

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.

安全防护大模型实时控制

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。