注意力能识别,MLP却会拒绝:追踪大语言模型中的注意力到MLP的安全通路
Attention Sees, MLP Refuses: Tracing the Attention-to-MLP Safety Pathway in LLMs
AI总结:
该研究追踪LLMs中注意力到MLP的安全通路,发现注意力负责识别危害性、MLP负责生成拒绝,据此推出Sentinel,其联合信号路由可降低越狱与过度拒绝的总错误率。
摘要:
经过安全对齐的大语言模型(LLMs)仍易受到越狱攻击,且可能对良性请求过度拒绝。要理解这些失败,需区分危害性识别与生成拒绝的计算过程。我们将此重新定义为通路问题,并在仅解码器Transformer的残差流更新上实现可测量性,区分模块更新暴露的危害性信息与其产生的可读拒绝证据变化。在Qwen、Llama和Gemma的18组Base-Instruct模型对中,危害性更易从注意力更新(尤其是早期层)中解码,而MLP更新在对齐模型中对危害性选择性拒绝生成的贡献更强。后训练在全部18组中增强了MLP的拒绝生成,却未系统性提升危害性可解码性,且后训练后正向MLP生成更集中于深层。在6个具备推理能力的模型中,推理期间仍可解码危害性,而强拒绝生成集中于答案起始处,该模式在推理禁用后仍存在。因果干预进一步支持此通路:将下游MLP更新重置为干净值可大幅减少上游注意力干预导致的拒绝偏移。基于这些发现,我们推出Sentinel,其结合注意力衍生的感知分数P与MLP衍生的决策分数D,二者联合特征可表征越狱与过度拒绝,且在8个模型上,采用二者信号的条件路由实现了比单信号路由及评估的固定提醒更低的总错误率。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。