Attention Sees, MLP Refuses: Tracing the Attention-to-MLP Safety Pathway in LLMs
作者: Zixuan Weng, Haoqi He, Weifei Jin, Yue Huang, Yang Bai
分类: cs.AI
发布日期: 2026-10-09
备注: Preprint
💡 一句话要点
提出安全路径追踪方法以解决LLMs的拒绝问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 安全对齐 拒绝机制 注意力机制 MLP 越狱攻击 模型分析 深度学习
📋 核心要点
- 现有的安全对齐大型语言模型在拒绝良性请求时存在过度拒绝的问题,且容易受到越狱攻击。
- 论文提出了一种新的路径分析方法,通过分离有害性识别与拒绝计算,深入理解模型的拒绝机制。
- 实验结果表明,结合注意力和MLP的信号能够有效降低模型的拒绝错误率,提升模型的安全性。
📝 摘要(中文)
安全对齐的大型语言模型(LLMs)仍然容易受到越狱攻击,并可能过度拒绝良性请求。理解这些失败需要区分有害性识别与拒绝计算。我们将此重新框架为路径问题,并在解码器仅限的Transformer中对残余流更新进行可测量分析。研究发现,早期层的注意力更新更容易解码有害性,而MLP更新则更强烈地影响对齐模型中的有害拒绝写作。后训练增强了所有18对的MLP拒绝写作,而有害性解码能力并未系统性改善。基于这些发现,我们引入了Sentinel,它结合了注意力衍生的感知分数P与MLP衍生的决策分数D,能够更好地表征越狱和过度拒绝现象。
🔬 方法详解
问题定义:本论文旨在解决安全对齐大型语言模型在拒绝良性请求时的过度拒绝和越狱问题。现有方法未能有效区分有害性识别与拒绝计算,导致模型在安全性上存在漏洞。
核心思路:论文通过将有害性识别与拒绝写作分开,提出了一种可测量的路径分析方法,重点关注Transformer模型中的残余流更新,尤其是注意力和MLP模块的作用。
技术框架:整体架构包括对18对Base-Instruct的实验分析,利用注意力更新和MLP更新的对比,评估其在有害性解码和拒绝写作中的贡献。引入Sentinel模型,结合注意力感知分数P与MLP决策分数D进行联合分析。
关键创新:最重要的技术创新在于将注意力更新与MLP更新的作用分离,首次系统性地揭示了二者在拒绝机制中的不同角色,特别是MLP在拒绝写作中的重要性。
关键设计:在实验中,后训练增强了MLP拒绝写作的能力,且注意力更新在早期层更易解码有害性。Sentinel模型通过条件路由结合两种信号,显著降低了模型的整体错误率。实验还表明,重置下游MLP更新能有效减少由上游注意力干预引起的拒绝偏移。
🖼️ 关键图片
📊 实验亮点
实验结果显示,结合注意力和MLP信号的Sentinel模型在八个模型中实现了更低的整体错误率,相较于单一信号路由,错误率显著降低。此外,后训练增强了MLP拒绝写作能力,而有害性解码能力未系统性改善,表明模型在拒绝机制上的复杂性。
🎯 应用场景
该研究的潜在应用领域包括安全对齐的语言模型开发、智能助手、内容审核系统等。通过提升模型的拒绝准确性和安全性,可以有效减少误拒绝和越狱攻击的风险,增强用户体验和信任度。未来,该方法可能在更广泛的AI系统中得到应用,推动安全AI的发展。
📄 摘要(原文)
Safety-aligned large language models (LLMs) remain vulnerable to jailbreaks and can over-refuse benign requests. Understanding these failures requires distinguishing harmfulness recognition from the computation that writes refusal. We reframe this as a pathway question and make it measurable on residual-stream updates in decoder-only Transformers, separating the harmfulness information a module update exposes from the change it produces in readable refusal evidence. Across 18 Base-Instruct pairs spanning Qwen, Llama, and Gemma, harmfulness is decoded more readily from attention updates, particularly in early layers, whereas MLP updates contribute more strongly to harm-selective refusal writing in aligned models. Post-training strengthens MLP refusal writing in all 18 pairs without systematically improving harmfulness decodability, while positive MLP writing becomes more concentrated in deeper layers after post-training. Across six reasoning-enabled models, harmfulness remains decodable during reasoning while strong refusal writing concentrates at answer onset, a pattern that persists with reasoning disabled. Causal interventions further support this pathway: resetting downstream MLP updates to their clean values substantially reduces the refusal shift caused by upstream attention interventions. Building on these findings, we introduce Sentinel, which combines an attention-derived perception score P with an MLP-derived decision score D. Their joint profiles characterize jailbreaks and over-refusals, and conditional routing with both signals achieves a lower aggregate error rate than single-signal routing and evaluated fixed reminders across eight models.