越狱解毒剂:通过大语言模型中的稀疏表示调整实现运行时安全与效用平衡
Jailbreak Antidote: Runtime Safety-Utility Balance via Sparse Representation Adjustment in Large Language Models
AI总结:
本文提出Jailbreak Antidote方法,通过在推理时稀疏调整大语言模型约5%的内部状态,实现无需额外开销的实时安全与效用平衡,并在多个模型和攻击场景下验证了其有效性。
摘要:
随着大语言模型(LLMs)在各种应用中变得不可或缺,确保其安全性和效用性至关重要。越狱攻击通过操纵LLMs生成有害内容,对这一平衡构成了重大挑战。现有的防御方法,如提示工程和安全微调,通常引入计算开销、增加推理延迟,并且缺乏运行时灵活性。此外,过于严格的安全措施可能因拒绝良性查询而降低模型效用。在本文中,我们提出了Jailbreak Antidote,一种通过在推理过程中操纵模型内部状态的稀疏子集来实现LLM安全偏好实时调整的方法。通过沿安全方向以不同强度移动模型的隐藏表示,我们在不增加额外token开销或推理延迟的情况下实现了对安全与效用平衡的灵活控制。我们的分析表明,LLMs中与安全相关的信息是稀疏分布的;调整约5%的内部状态与修改整个状态同样有效。在九个LLMs(参数量从20亿到720亿)上的大量实验,针对十种越狱攻击方法进行评估,并与六种防御策略进行比较,验证了我们方法的有效性和效率。通过在推理过程中直接操纵内部状态,Jailbreak Antidote提供了一种轻量级、可扩展的解决方案,在保持效用的同时增强LLM安全性,为广泛部署的AI系统中的实时安全机制开辟了新的可能性。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。