AttnGCG:通过注意力操纵增强对 LLMs 的越狱攻击
AttnGCG: Enhancing Jailbreaking Attacks on LLMs with Attention Manipulation
AI总结:
本文提出 AttnGCG 方法,通过操纵基于 transformer 的 LLMs 的注意力分数来增强 GCG 越狱攻击效果,在 Llama-2 和 Gemma 系列上分别提升约 7% 和 10%,并具备强大的黑盒迁移性与可解释性。
摘要:
本文研究了基于 transformer 的大型语言模型(LLMs)对越狱攻击的漏洞,特别聚焦于基于优化的贪婪坐标梯度(GCG)策略。我们首先观察到攻击的有效性与模型的内部行为之间存在正相关。例如,当模型更加关注旨在确保 LLM 安全对齐的系统提示时,攻击往往效果较差。基于这一发现,我们引入了一种增强方法,通过操纵模型的注意力分数来促进 LLM 越狱,我们将其称为 AttnGCG。在实验中,AttnGCG 在不同的 LLMs 上表现出攻击效果的一致提升,在 Llama-2 系列中平均增加约 7%,在 Gemma 系列中增加约 10%。我们的策略还展示了对未见有害目标和 GPT-3.5 及 GPT-4 等黑盒 LLMs 的强大攻击可迁移性。此外,我们注意到我们的注意力分数可视化更具可解释性,使我们能够更好地洞察目标注意力操纵如何促进更有效的越狱。我们在 https://github.com/UCSC-VLAA/AttnGCG-attack 发布了代码。
英文摘要:
This paper studies the vulnerabilities of transformer-based Large Language Models (LLMs) to jailbreaking attacks, focusing specifically on the optimization-based Greedy Coordinate Gradient (GCG) strategy. We first observe a positive correlation between the effectiveness of attacks and the internal behaviors of the models. For instance, attacks tend to be less effective when models pay more attention to system prompts designed to ensure LLM safety alignment. Building on this discovery, we introduce an enhanced method that manipulates models' attention scores to facilitate LLM jailbreaking, which we term AttnGCG. Empirically, AttnGCG shows consistent improvements in attack efficacy across diverse LLMs, achieving an average increase of ~7% in the Llama-2 series and ~10% in the Gemma series. Our strategy also demonstrates robust attack transferability against both unseen harmful goals and black-box LLMs like GPT-3.5 and GPT-4. Moreover, we note our attention-score visualization is more interpretable, allowing us to gain better insights into how our targeted attention manipulation facilitates more effective jailbreaking. We release the code at https://github.com/UCSC-VLAA/AttnGCG-attack.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。