arXiv:2610.13078cs.AIOct 2026

Manuscript Offprint

arXiv:2610.13078

Attention Sees, MLP Refuses: Tracing the Attention-to-MLP Safety Pathway in LLMs

Zixuan Weng, Haoqi He, Weifei Jin, Yue Huang, Yang Bai

ABSTRACT

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.

1 INTRODUCTION

Safety-aligned large language models (LLMs) must refuse harmful requests while remaining useful on benign inputs (Xie et al., 2025; Brahman et al., 2024). Yet jailbreaks induce harmful compliance, while over-refusals block benign requests. Behavioral benchmarks measure these outcomes (Chao et al., 2024; Zou et al., 2023; Röttger et al., 2024; Cui et al., 2025; Han et al., 2024), but do not reveal whether a failure occurs because harmfulness is not recognized or because recognized harmfulness fails to produce refusal. Mechanistic studies have identified refusal-related directions and features (Arditi et al., 2024; Yu et al., 2025; Wang et al.), safety-relevant attention heads and layers (Zhou et al., 2025; Li et al., 2025), and representation- or activation-level interventions that change model behavior (Lee et al.; Zhou et al., 2024; Zou et al., 2024; Shen et al., 2025; Oozeer et al., 2025). Related work further shows that harmfulness and refusal can be represented separately (Zhao et al., 2025). These studies characterize where safety-relevant information is represented, but not how that information is transformed into safe behavior. Recognizing harmfulness does not imply that the model will use that information to produce a refusal. Moreover, safety alignment can be fragile over the first few output tokens (Qi et al., 2025), suggesting that the fragile part may not be harmfulness representation itself, but the computation that turns it into refusal. We therefore ask a pathway question: How does a Transformer turn harmfulness recognition into refusal? Specifically, which modules expose harmfulness information, which write refusal evidence, and how are these contributions functionally linked across the network?

We study this “recognition → writing” pathway through residual-stream updates in decoder-only Transformers, and characterize its two ends with two complementary quantities. Harmfulness recognition asks whether an Attention or MLP update carries information that distinguishes harmful from benign prompts. Refusal writing asks whether adding this update to the residual stream makes the model more inclined to refuse rather than comply. Comparing this change between harmful and benign inputs measures its harm selectivity. Across 18 Base–Instruct pairs spanning six Qwen, Llama, and Gemma model families and ranging from 1B to 27B parameters, we find a consistent functional asymmetry: at the base stage, Attention updates already expose stronger harmfulness signals, especially in early layers; whereas in post-trained models, MLP updates dominate harm-selective refusal writing. Intervention experiments support a functional link between these two contributions: intervening on upstream Attention shifts the refusal readout, while restoring the original downstream MLP updates substantially weakens this shift.

This distinction helps explain what post-training changes and when refusal evidence becomes prominent. Harmfulness information is already decodable in Base models, and probe AUC does not systematically increase after post-training. In contrast, harm-selective MLP net writing increases in all 18 model pairs, while the median fraction of positive harm-selective MLP writing contributed by the final quarter of the network rises from 23.01% to 63.86%. Thus, post-training primarily strengthens refusal writing rather than improving the model's recognition of harmfulness. A similar distinction appears during generation. Across six reasoning-enabled Qwen3/Qwen3.5 models, harmfulness remains decodable at reasoning process, while strong MLP refusal writing concentrates at answer onset. In other words, the model can continue to recognize harmfulness while delaying refusal writing.

We translate this explanation into Sentinel, a diagnostic method that combines a perception score P for Attention-side harmfulness signals with a decision score D for MLP-side refusal writing. Some jailbreaks show weak signals at both stages; others retain stronger recognition but exhibit weaker writing relative to correctly refused harmful prompts. Compared with normally answered benign inputs, over-refused benign inputs have higher recognition scores and typically stronger writing as well. These joint profiles reveal internal differences that output labels alone cannot distinguish. Because P and D are available before response decoding, we further use them to route conditional reminders. Across eight models, joint routing achieves lower aggregate error across jailbreak and false-refusal evaluations than either single-signal routing or the tested fixed reminders.

Overall, viewing safety alignment as a recognition-to-writing pathway connects several observations: why alignment remains necessary even though harmfulness information is already readable in Base models, why alignment concentrates on the few tokens near answer onset, and why jailbreaks and over-refusals, opposite in behavior, can both be attributed to a shift at one end of the pathway. These findings suggest that improving safety may require strengthening refusal writing, rather than harmfulness representations alone. Our contributions are threefold: (1) we reframe safety alignment as a module-level pathway from recognition to writing, (2) we characterize its organization across post-training and generation and test the functional link between Attention-side recognition and downstream MLP writing through causal interventions, and (3) we turn this account into Sentinel, a diagnostic method that routes conditional reminders before decoding.