arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.00236cs.CRcs.AI
收藏

注意力是攻击之处

Attention Is Where You Attack

Amazon(亚马逊);The Pennsylvania State University(宾夕法尼亚州立大学)

Aviral Srivastava, Sourav Panda

AI总结:

本文提出注意力重分布攻击(ARA),通过Gumbel-softmax优化在概率单纯形上攻击softmax注意力,成功绕过安全对齐,实现高准确率的恶意请求执行。

摘要:

安全对齐的大语言模型依赖于RLHF和指令微调来拒绝有害请求,但其内部机制仍不明确。本文引入注意力重分布攻击(ARA),一种白盒对抗攻击,通过识别安全关键的注意力头并构造非语义对抗性标记,将注意力从安全相关位置转移。不同于以往在语义或输出logit层面的攻击方法,ARA通过在目标头上的Gumbel-softmax优化攻击softmax注意力的几何结构。在LLaMA-3-8B-Instruct、Mistral-7B-Instruct-v0.1和Gemma-2-9B-it上,ARA仅需5个标记和500次优化步骤即可绕过安全对齐,实现36%的ASR在Mistral-7B和30%在LLaMA-3上,而Gemma-2保持在1%。我们的主要发现是消融与重分布之间的脱节:零出顶部安全头最多导致1次翻转,而ARA针对对应安全密集层可使72/200提示翻转,60/200在LLaMA-3上。这表明安全并非这些头的可移除组件,而是通过它们执行的注意力路由产生。移除一个头可通过残差流补偿,而重定向其注意力则会传播受损信号。

英文摘要:

Safety-aligned large language models rely on RLHF and instruction tuning to refuse harmful requests, yet the internal mechanisms implementing safety behavior remain poorly understood. We introduce the Attention Redistribution Attack (ARA), a white-box adversarial attack that identifies safety-critical attention heads and crafts nonsemantic adversarial tokens that redirect attention away from safety-relevant positions. Unlike prior jailbreak methods operating at the semantic or output-logit level, ARA targets the geometry of softmax attention on the probability simplex using Gumbel-softmax optimization over targeted heads. Across LLaMA-3-8B-Instruct, Mistral-7B-Instruct-v0.1, and Gemma-2-9B-it, ARA bypasses safety alignment with as few as 5 tokens and 500 optimization steps, achieving 36% ASR on Mistral-7B and 30% on LLaMA-3 against 200 HarmBench prompts, while Gemma-2 remains at 1%. Our principal mechanistic finding is a dissociation between ablation and redistribution: zeroing out the top-ranked safety heads produces at most 1 flip among 39 to 50 baseline refusals, while ARA targeting the corresponding safety-heavy layers flips 72/200 prompts on Mistral-7B and 60/200 on LLaMA-3. This suggests that safety is not localized in these heads as removable components, but emerges from the attention routing they perform. Removing a head allows compensation through the residual stream, while redirecting its attention propagates a corrupted signal downstream.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑