TL;DR
Attention sinks—where Large Language Models (LLMs) heavily allocate attention to the very first token in a sequence—are not a training glitch, but a vital defense mechanism. This paper demonstrates both theoretically and empirically that attention sinks prevent "over-mixing" and representational collapse, acting as an approximate "no-op" (no-operation) that stabilizes token embeddings across deep layers and long contexts.
What Problem Does This Paper Address?
In Transformer architectures, the attention mechanism is the sole vehicle for mixing information across tokens. A widely observed but poorly understood phenomenon in frontier LLMs is the emergence of "attention sinks," where attention heads focus intensely on seemingly meaningless initial tokens (typically the ⟨bos⟩ or beginning-of-sequence token).
While prior research focused on exploiting or mitigating these sinks to optimize KV-caching or streaming, this paper addresses the fundamental question: Why do LLMs naturally learn this behavior via gradient descent without any explicit priors? The authors investigate the functional role these sinks play in processing long contexts and deep architectures.
Methods
The authors combine theoretical analysis with rigorous empirical validation:
- Theoretical Extensions: They extend existing mathematical frameworks for "over-squashing" and rank collapse to multi-head attention architectures, mapping out how token sensitivity propagates through layers via Jacobian matrices.
- Perturbation Analysis: They introduce small token perturbations (e.g., changing "greatest" to "best" in a prompt) in Gemma 7B to measure how changes ripple through the network's hidden states with and without a sink token present.
- Controlled Pre-training: To isolate variables, they train 120M-parameter LLaMA-style models from scratch, systematically varying the context lengths (from 128 to 2048 tokens) and data-packing configurations (such as causal masking vs. intra-document masking).
Datasets
- Pre-training Corpora: Custom 5B and 30B token datasets were used to train the synthetic 120M-parameter models.
- Evaluation Prompts: The authors utilized a 170-sample multi-domain dataset from Gu et al. (2025) (
probe_valid.jsonl) to track attention allocation metrics. - Downstream Benchmarks: Standard evaluation suites including ARC-e, ARC-c, PIQA, SIQA, HellaSwag, Winogrande, and the long-context Ruler benchmark (4096 context length) were used to measure the downstream impact of removing sinks.
Key Insights and Ideas
- Sinks as "Approximate No-Ops": When an attention head has no relevant information to update for a given token, it needs a safe place to direct its attention weight. By dumping attention onto the
⟨bos⟩token—which naturally develops an exceptionally low value vector norm—the head ensures the token's embedding remains virtually unchanged, effectively acting as an "if-else" gating mechanism. - Mitigating Representational Collapse: Without an attention sink, attention maps become overly smooth and uniform. This causes the model to "over-mix" information, leading to representational collapse where tokens later in a sequence lose their distinct identity and blend into an uninformative average.
- Scale and Context Drive Sinks: The necessity for an attention sink is directly tied to model depth and context length. As models grow larger or ingest longer sequences, the mathematical pressure to prevent over-mixing increases, making the formation of strong sinks an inevitable byproduct of gradient descent.
Key Results
- Scaling with Model Size: In the LLaMA 3.1 family, the percentage of attention heads exhibiting strong sinks ($\epsilon = 0.8$) scales dramatically with model size: 45.97% in the 8B model, 73.49% in the 70B model, and a massive 78.29% in the 405B model.
- Catastrophic Performance Drops: Removing the
⟨bos⟩token at inference time severely degrades model capabilities. On standard benchmarks, performance plummets, and on the long-context Ruler benchmark, Gemma 7B's accuracy drops from 82.57% to 0.00%. - Position Over Identity: When models are trained entirely without a
⟨bos⟩token, an attention sink still forms naturally at the very first token of the sequence. This proves that the structural position (the first slot under a causal mask) is what provides the defense against over-mixing, rather than the semantic identity of the token itself.
Limitations and Future Work
To keep the mathematical proofs for multi-head over-squashing tractable, the authors assume that queries and keys are independent of the value vectors when pushing partial derivatives through the softmax function. Real-world dynamics are more tightly coupled. Additionally, the authors note that future work should explore how alternative attention sparsification techniques and different positional encodings (like RoPE) interact with the formation and stability of these sinks over extreme context windows.
Summary updated