RobustKV:通过 KV 驱逐防御大语言模型的越狱攻击
RobustKV: Defending Large Language Models against Jailbreak Attacks via KV Eviction
AI总结:
本文提出 RobustKV,通过基于注意力分数驱逐 KV 缓存中低重要性 token 来削弱隐藏有害查询,从而防御自适应越狱攻击并保持模型良性任务性能。
摘要:
越狱攻击通过将有害查询隐藏在越狱提示中,绕过 LLM 的内置安全防护。现有防御主要侧重于缓解越狱提示的影响,但由于越狱提示可以采用任意、自适应的形式,这些防御往往并不充分。本文提出 RobustKV,这是一种采用根本不同思路的新型防御方法:从键值(KV)缓存中选择性地移除有害查询的关键 token。直观而言,越狱提示若要生效,其 token 必须获得足够的“重要性”(以注意力分数衡量),这将不可避免地降低被隐藏的有害查询中 token 的重要性。因此,RobustKV 通过策略性地驱逐排名最低 token 的 KV,削弱有害查询在 KV 缓存中的存在,从而阻止 LLM 生成恶意响应。使用基准数据集和模型进行的大量评估表明,RobustKV 可有效对抗最先进的越狱攻击,同时保持 LLM 在良性查询上的通用性能。此外,RobustKV 为对手制造了一个有趣的规避困境,迫使其在规避 RobustKV 与绕过 LLM 内置安全防护之间取得平衡。这种权衡有助于 RobustKV 对自适应攻击保持鲁棒性。(警告:本文包含 LLM 生成的潜在有害内容。)
英文摘要:
Jailbreak attacks circumvent LLMs' built-in safeguards by concealing harmful queries within jailbreak prompts. While existing defenses primarily focus on mitigating the effects of jailbreak prompts, they often prove inadequate as jailbreak prompts can take arbitrary, adaptive forms. This paper presents RobustKV, a novel defense that adopts a fundamentally different approach by selectively removing critical tokens of harmful queries from key-value (KV) caches. Intuitively, for a jailbreak prompt to be effective, its tokens must achieve sufficient `importance' (as measured by attention scores), which inevitably lowers the importance of tokens in the concealed harmful query. Thus, by strategically evicting the KVs of the lowest-ranked tokens, RobustKV diminishes the presence of the harmful query in the KV cache, thus preventing the LLM from generating malicious responses. Extensive evaluation using benchmark datasets and models demonstrates that RobustKV effectively counters state-of-the-art jailbreak attacks while maintaining the LLM's general performance on benign queries. Moreover, RobustKV creates an intriguing evasiveness dilemma for adversaries, forcing them to balance between evading RobustKV and bypassing the LLM's built-in safeguards. This trade-off contributes to RobustKV's robustness against adaptive attacks. (warning: this paper contains potentially harmful content generated by LLMs.)
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。