↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Block 7 of 12 12 heads · 64-D · learned absolute positions · KV cache 64 = 4 sinks + 60 recent, or the last 64
Loading recorded attention…

What an attention sink is

In trained language models many heads put a large share of their attention on the very first token, whatever that token says. Xiao et al. called it an attention sink. A softmax has to hand out a total weight of 1; a head with nothing useful to read in the current context still has to put that weight somewhere, and the first token, which every query can see, becomes the place. Its value contributes little, so the head in effect does nothing.

This page shows the sinks of GPT-2 small (12 blocks of 12 heads) on two public-domain passages, Boscombe Valley (557 tokens) and Caucus-race (481 tokens), and what happens when a fixed-size KV cache has to throw tokens away. The same passage is run three ways: Full cache, one pass over everything; Sinks + window, token by token with a 64-entry cache that keeps the first 4 tokens and the last 60; and Window only, token by token with a cache of the last 64.

The first-token map

The First token panel has one dot per block and head, shaded by the mean weight the head puts on token 0 over the passage. Block 1 hardly uses it: about 1 % of the attention on average. Deeper blocks lean on it heavily: in blocks 3 to 12 of the Boscombe passage, 54 of the 120 heads put more than half of their attention there, although token 0 is just “IV”, a chapter number. Xiao et al. found that it is the position that matters, not the word: replacing the first tokens of a text with line breaks kept the effect.

Clicking a dot opens that block and head on the head card, which draws the last 8 query rows of the passage against a selection of its keys.

Why a window breaks

Generating with a cache of entries means each query sees a set of keys instead of all earlier ones. The two cached runs differ only in that set:

Once the passage is longer than 64 tokens, the window-only cache evicts token 0. The weight that heads used to park there has to go to the remaining keys, whose values were never meant to receive it, and the layer's output changes. The KV cache strips show both caches at the selected query, one square per cached key, with the first 4 slots of the sinks cache separated.

The Next-token loss chart shows the result. From position 63 on, once eviction starts, the mean loss on the Boscombe passage is 3.32 nats with the full context, 3.96 with sinks + window and 8.72 with the window alone; on the Caucus-race passage 3.07, 3.88 and 9.11. Keeping just four extra tokens recovers most of what the window lost.

StreamingLLM

That is the method Xiao et al. proposed: keep the KV entries of the first few tokens permanently and a rolling window of recent ones. It needs no retraining. They report stable language modelling with Llama-2, MPT, Falcon and Pythia over up to 4 million tokens, and up to 22.2 times the speed of recomputing a sliding window from scratch at every step. They also found that adding a dedicated placeholder token during pre-training, a sink by design, improves streaming further.

Why sinks form

Several studies came at the effect from different sides. Bondarenko et al. traced the large activation outliers that make Transformers hard to quantise to heads learning a no-op: to give the other tokens near-zero weight, they push their softmax inputs ever larger. Sun et al. found a few massive activations, up to 100,000 times larger than the rest, that stay nearly constant across inputs, act as fixed biases and draw attention to their tokens. Darcet et al. saw the same behaviour in vision Transformers, which repurpose high-norm background patches for internal computation, and gave them spare register tokens instead. Gu et al. showed that sinks emerge during pre-training once optimisation is effective, act more like key biases than content, and stem at least partly from the softmax normalisation: with sigmoid attention without normalisation, sinks did not emerge in models up to 1B parameters.

Sinks by design

If heads need somewhere to put unused weight, a model can provide it. gpt-oss gives each head a learned bias in the softmax denominator, a sink logit that takes a share of the weight and contributes no value:

The Transformer Explainer's gpt-oss tab records these learned sinks. The Diff tab cancels attention noise by subtracting a second map, and the Gated tab gates each head's output; the KV-cache eviction tab of the Efficiency Explainer keeps heavily attended tokens rather than only the first ones.

Papers

  1. Efficient Streaming Language Models with Attention Sinks Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han, Mike Lewis · ICLR 2024 Names the attention sink and introduces StreamingLLM, the sinks + window cache on this page.
  2. When Attention Sink Emerges in Language Models: An Empirical View Xiangming Gu et al. · ICLR 2025 How sinks arise in pre-training, why they behave like key biases, and how removing the softmax normalisation prevents them.
  3. Massive Activations in Large Language Models Mingjie Sun, Xinlei Chen, J. Zico Kolter, Zhuang Liu · COLM 2024 A few huge, nearly constant activations that act as biases and concentrate attention on their tokens.
  4. Quantizable Transformers: Removing Outliers by Helping Attention Heads Do Nothing Yelysei Bondarenko, Markus Nagel, Tijmen Blankevoort · NeurIPS 2023 Links activation outliers to heads that learn a no-op, and fixes them with clipped softmax and gated attention.
  5. Vision Transformers Need Registers Timothée Darcet, Maxime Oquab, Julien Mairal, Piotr Bojanowski · ICLR 2024 The same effect in vision Transformers, and extra register tokens to absorb it.
  6. gpt-oss-120b & gpt-oss-20b Model Card OpenAI (Sandhini Agarwal et al.) · arXiv 2025 A model with a learned sink bias in every head's softmax.

See also