Before Attention Sinks Form: Hidden-State Geometry Reveals and Modulates Their Formation
Organizations: College of AI, Tsinghua University
Abstract
Attention sinks are usually studied after they have formed. We ask whether a measurable hidden-state change appears beforehand and whether changing that geometry alters what happens later. To remove network depth as a shortcut, we compare prompts in the same model and at the same layer. When sink timing varies across prompts, simple spectral summaries of the hidden states add information beyond current attention, with the clearest prompt-specific signal in a short window about two to three layers before sink formation. The predictive strength varies across cohorts, so we treat the spectrum as a readout of a pre-sink state change rather than a universal warning statistic. The signal is broader than one measured extreme activation. We then modify only the singular values of the post-layer hidden states after current attention has already been computed. These interventions change later sink behavior in Qwen2.5, GLM-Z1, and GPT-OSS relative to norm-matched random spectral perturbations. In Qwen2.5, the immediate suppressive effect is accompanied by a reduction in next-layer query--key preference for position~0, and the learned spectral directions remain stable when estimated from substantially less training data. Together, the results show that attention sinks are preceded by a short spectral reorganization of hidden states, and directly perturbing this geometry can causally alter subsequent sink formation.
Figures & tables
| Question | What is compared | Main result | What it means |
|---|---|---|---|
| Does the spectrum add information before a sink forms? | Current attention only ( ) vs. current attention plus spectrum ( ), with model and layer matched. | Exact 1: AP ( AP , ). Strict within-cell: Within 2 ; Within 3 ; Within 4 . | The extra information is clearest about two to three layers before the sink. |
| Does changing the spectrum change later sink behavior? | For the learned direction, opposite signs ( vs. ) are compared at the same perturbation size. That directional gap is then tested against gaps from norm-matched random spectral directions. | Later-sink directional gap: Qwen2.5: , ; GLM-Z1: , ; GPT-OSS: , two-sided ; 30/30 fresh prompts have the same positive sign. | Yes, but the direction and size of the effect depend on model and state. |
| What changes immediately after the Qwen2.5 edit? | Opposite signs of the learned spectral direction are compared at the same perturbation size; source-layer attention is unchanged. | Next-layer position-0 attention changes by . The QK-preference change tracks the attention change: , with 97.7% sign agreement. | The immediate suppressive effect is associated with lower next-layer preference for position 0. |
| Can the edit direction be estimated from less data? | Directions estimated from reduced training sets are compared with the full-data direction or with an independently estimated half-sample direction. | Qwen2.5: disjoint-half direction cosine . GPT-OSS: half-data effect vs. full-data effect (effect ratio ). | The learned direction and its downstream effect are stable under substantial data reduction. |
| Question | What is compared | Main result | Takeaway |
|---|---|---|---|
| Does the spectrum add information? | Attention only vs. attention + spectrum, with model and layer matched. | Exact 1: AP ; AP . | Spectrum adds information beyond current attention. |
| When is the clearest prompt-specific signal? | Ranking is evaluated only among prompts in the same model and current layer. | Within 2: ; Within 3: ; Within 4: . | The clearest signal is about two to three layers before the sink. |
| Does the result depend on threshold-derived attention features? | Continuous attention only vs. continuous attention + spectrum. | Exact 1: AP ; Within 2: ; Within 6: , with CI including zero. | The short-range result does not come from reusing the onset threshold. |
| Is the effect size stable across prompt cohorts? | The same frozen Qwen3 analysis is evaluated on the expanded cohort and on the unseen post-audit subset. | , Exact 2: AP ; unseen : . | The short transition persists as a pattern, but predictive strength is cohort dependent. |
| Test | What is compared | Main result | Takeaway |
|---|---|---|---|
| Qwen2.5 intervention | Opposite signs of the learned direction at ; the resulting gap is tested against matched random directions. | Future sink-strength gap ; empirical . | Changing the spectrum suppresses later sink strength in this setting. |
| GLM-Z1 intervention | Opposite signs of the learned direction at ; the same matched-random test is used. | Future sink-strength gap ; empirical . | Independent cross-model support; the sign is again suppressive. |
| GPT-OSS frozen test | Frozen L10 learned direction at ; later sink strength is averaged over full-attention layers 11, 13, and 15. | Gap ; two-sided ; 30/30 prompts positive. | Fresh-cohort confirmation with the opposite sign. |
| Qwen2.5 next-layer trace | Opposite signs of the learned direction at the same budget, inspected at the next attention layer. | Position-0 attention: ; QK–attention correlation: ; 97.7% sign agreement. | The immediate suppressive effect tracks lower position-0 QK preference. |
| Direction stability | Directions estimated from reduced data vs. full-data or independent half-sample estimates. | Qwen2.5 disjoint-half cosine ; GPT-OSS: half-data effect vs. full-data . | The learned direction is not fragile to training-set reduction. |
| Cross-layer change | Upstream edits propagated to the same hidden state vs. a direct local edit. | GPT-OSS: 96–100% spectral projection retained, hidden cosine – ; Qwen2.5: 24% retained, cosine . | Later blocks can preserve perturbation size while changing its direction and downstream effect. |
| Setting | Boundary | Consequence |
|---|---|---|
| Gemma / Llama | Sink appears very early or is present at the first measured layer. | Little or no ordinary pre-sink interval is available. |
| Qwen3, | 499/500 prompts first cross at layer 7. | Prompt-specific matched-depth timing is effectively non-identifiable. |
| Qwen2.5, | All 429 crossing prompts first cross at layer 4. | No onset-depth variation exists among crossing prompts. |
| GLM-Z1, | Onset remains spread across several layers. | The strict same-layer analysis remains estimable and again localizes to Within 2–3. |
| Fresh GLM-4 / Qwen3 causal preparation | The pre-specified near/far support required by the frozen direction rule is absent. | The planned comparison is not replaced post hoc with a different grouping. |
| GPT-OSS / Qwen3.6 | Position-0 visibility depends on attention type / sink-like states can disappear and reappear. | The ordinary single persistent-onset target is not architecture invariant. |
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
| Family | Variables / operational definition |
|---|---|
| QK preference | Sink log-probability mean/max, sink-versus-best-competitor log-probability margin mean/max, and attention entropy mean/min. |
| Value magnitude | Sink-position value-vector norm mean/max across attention heads. |
| Attention–value | Sink attention-weighted value contribution mean/max and its ratio to the total attention-output norm mean/max. |
| Branch scales | Attention-output/input Frobenius-norm ratio, MLP-output/input ratio, and block-update/input ratio. |
| Compact hidden outlier | Hidden maximum absolute activation, hidden max/RMS ratio, and sink hidden-token norm ratio. |
| Hidden outlier + concentration | Compact hidden-outlier family plus hidden top-1 and top-5 elementwise squared-energy ratios. |
| Model | Prompts | Observed sink behavior | Role | |
|---|---|---|---|---|
| Qwen2.5-7B | 50 | 64 | sinks often form near layer 4, with prompt variation | main |
| Qwen3-8B | 50 | 64 | sinks form mainly near layers 3 or 7 | main |
| GLM-4-32B | 50 | 64 | delayed formation with limited timing variation | main |
| GLM-Z1-32B | 50 | 64 | sink timing varies substantially across prompts | main |
| Gemma 3-12B | 20 | 64 | sinks appear early and strengthen later | boundary |
| Llama 3.1-8B | 20 | 64 | sinks are present at the first measured layer | boundary |
| Target | AP | CI | |||
|---|---|---|---|---|---|
| Exact | 1 | .857 | .913 | +.056 | [.028,.087] |
| Exact | 2 | .826 | .867 | +.042 | [.011,.073] |
| Exact | 3 | .691 | .799 | +.108 | [.034,.162] |
| Exact | 4 | .754 | .824 | +.070 | [.010,.135] |
| Exact | 6 | .850 | .854 | +.005 | [ ,.040] |
| Within | 1 | .857 | .913 | +.056 | [.026,.088] |
| Target | AP | CI | ||
|---|---|---|---|---|
| Exact 1 | .833 | .918 | +.085 | [.051,.123] |
| Within 2 | .793 | .889 | +.096 | [.055,.137] |
| Within 3 | .787 | .867 | +.080 | [.042,.121] |
| Within 4 | .802 | .896 | +.094 | [.045,.141] |
| Within 6 | .899 | .912 | +.013 | [ ,.031] |
| Model | Exact 1 | Within 2 | Within 3 | Within 4 | Exact-1 AP [CI] |
|---|---|---|---|---|---|
| GLM-4 | 1/3 | 1/3 | 1/3 | 1/3 | [ ] |
| GLM-Z1 | 5/43 | 7/84 | 8/118 | 9/151 | [ ] |
| Qwen2.5 | 1/36 | 2/72 | 3/108 | 4/144 | [ ] |
| Qwen3 | 1/10 | 2/20 | 3/30 | 3/30 | [ ] |
| Target | Centered pooled | Z-scored pooled | Cell macro | Cell row-weighted |
|---|---|---|---|---|
| Exact 1 | ||||
| Within 2 | ||||
| Within 3 | ||||
| Within 4 |
| Excluded model | Exact 1 | Within 2 | Within 3 | Within 4 |
|---|---|---|---|---|
| GLM-4 | ||||
| GLM-Z1 | ||||
| Qwen2.5 | ||||
| Qwen3 |
| Target | Mean | Median | Range | Positive |
|---|---|---|---|---|
| Exact 1 | +.150 | .000 | [ ] | 2/5 |
| Within 2 | +.122 | +.009 | [ ] | 3/5 |
| Within 3 | +.087 | +.040 | [ ] | 4/5 |
| Within 4 | +.019 | [ ] | 3/5 |
| Model | Onset fraction range | Median-onset range | Label counts across 24 cells |
|---|---|---|---|
| Qwen2.5 | [.72,1.00] | 4–4 | fixed-depth partial 19; clustered 5 |
| Qwen3 | [1.00,1.00] | 7–7 | deterministic 14; clustered 10 |
| GLM-4 | [1.00,1.00] | 5–8 | deterministic 15; clustered 9 |
| GLM-Z1 | [.98,1.00] | 6–11 | dispersed 15; deterministic 5; clustered 4 |
| Onset definition | Within 2 | Within 3 | Within 4 | Within 6 |
|---|---|---|---|---|
| K1 | ||||
| K2 |
| Budget | Natural gap | Random 95% interval | Empirical |
|---|---|---|---|
| .025 | .0308 | ||
| .050 | .0308 | ||
| .100 | .0462 |
| Quantity | Value |
|---|---|
| Prompts | 30 |
| Natural high-minus-low effect | |
| Bootstrap 95% CI | |
| Prompt sign consistency | 30 positive / 0 zero / 0 negative |
| Random median | |
| Random 2.5–97.5 percentile range |
| Setting | Eligible prompts | Any crossing | First-crossing raw layers (counts) | Next-checkpoint persistence |
|---|---|---|---|---|
| 50 | 45 | 15 (41), 47 (2), 55 (1), 59 (1) | — | |
| 50 | 27 | 15 (11), 47 (6), 55 (5), 59 (5) | 5/27 | |
| 45 | 17 | 47 (2), 55 (5), 59 (10) | 5/17 |
| Analysis | Comparison / setting | Main quantitative result | Role in the paper |
|---|---|---|---|
| Observational evidence | |||
| Primary pooled horizon grid | Current attention vs. attention plus spectrum , matched by model and current layer | Exact 1–6 AP: , , , , . Within 1–6: , , , , . The Exact/Within intervals exclude zero through horizon 4 and include zero at horizon 6. | Shows a short-range spectral increment beyond current attention. |
| Strict within-cell timing | AP is computed only among prompts in the same model and current layer | Exact 1: ; Within 2: ; Within 3: ; Within 4: . | Localizes the clearest prompt-specific signal to roughly two to three layers. |
| Continuous-attention control | Remove all threshold-derived sink-score features from the attention baseline | Exact 1: ( ); Within 2: ( ); Within 3: ; Within 4: ; Within 6: . | Rules out reuse of the onset threshold as the explanation for the short-range gain. |
| Expanded Qwen3 cohort | Frozen analysis on 500 prompts, followed by an unseen 372-prompt post-audit subset | , Exact 2: ; continuous-attention-only: . Unseen , Exact 2: ; continuous-only: . | Shows a strong short-window result in the expanded cohort but weaker out-of-audit predictive strength. |
| Sustained-onset sensitivity | Require two consecutive sink-like layers instead of first crossing | Strict within-cell: Exact 1 ; Within 2 ; Within 3 ; Within 4 ; Within 6 . | Shows that the two–three-layer localization is not specific to first crossing. |
| Claim | Main evidence | Limitation |
|---|---|---|
| The hidden-state spectrum changes before a sink forms | Same-layer versus prediction; removal of threshold-derived attention features; prompt shuffling; nonlinear attention baselines; expanded Qwen3 cohort | The primary estimate is pooled, model-level support is uneven, and the stricter Qwen3 post-audit holdout shows weaker cohort-dependent prediction. |
| The clearest prompt-specific signal appears about two to three layers before sink formation | Full horizon grid; removal of model–layer means; evaluation inside matched groups; sustained-sink definitions; GLM-Z1 result | The pooled signal extends farther, and two to three layers is not a universal causal window. |
| The spectral change is broader than one measured extreme activation | Compact outlier controls; capacity-matched activation measurements; random projections; Qwen3 timing experiment | These prediction tests do not identify a unique causal mechanism. |
| Changing the spectrum can change later sink formation | Post-layer singular-value edits; norm-matched random directions; Qwen2.5 and GLM-Z1 results; frozen 30-prompt GPT-OSS confirmation; half-data direction stability | The sign and size depend on model and state, and larger edits can cause broader functional changes. |
| The immediate Qwen2.5 suppression enters the next attention computation through a lower position-0 QK preference | Layer-1 post-block edit; layer-2 prompt–head QK-margin trace; source-attention invariance | This is a local diagnostic in one model and does not establish a universal QK mechanism. |
| Later transformer layers change the perturbation | GPT-OSS layer-8/9/10 propagation; Qwen2.5 layer-0-to-1 propagation | The cross-layer experiment covers two model families and is not claimed as a universal law. |
Attention Sinks
Attention sinks are tokens that attract disproportionate Transformer attention, shaping information flow, long-context behavior, and model efficiency.
See all 55 papers