esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

What Is an Attention Sink?

What an attention sink is, why the first token usually soaks up spare attention, and why dropping it breaks long or streamed chats, explained for your AI interview.

In short

An attention sink is usually the first token (or first few) that a language model keeps attending to heavily, even when it carries no real meaning. The weights must add up to one, so spare attention lands there, and dropping those tokens from a long chat can make the answers fall apart.

13 min readAdvancedOccasional · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

An attention sink is usually the first token a language model keeps looking at, even when it means nothing. Each token's attention has to add up to one, so the spare attention lands on that first token. If you drop those first tokens to save memory in a long chat, the answers start to fall apart. The fix is simple: keep the first few tokens along with the recent window. That is how I would explain it to a team building a support bot.

What is an attention sink, in plain words?

A language model reads a chat one token at a time. A token is a piece of text, often a word or part of one. When the model writes the next token, it looks back at the tokens before it. Attention is the score that says how much each earlier token matters for that step.

Those scores become weights that add up to exactly one. Think of a bank clerk who must file every incoming form into one of her trays. When a form matches none of them, she still has to drop it somewhere, so she always uses the same tray at the front. In a language model, that front tray is usually the first token, and it is the attention sink.

Key words

Token
A piece of text the model reads, often a word or part of one.
Attention weight
How much one token looks at another when the model picks its next word.
Softmax
The step that turns raw scores into weights that add up to one.
KV cache
Memory that stores each past token's working notes, so the model does not redo that work for every new word.
Window attention
Keeping only the most recent tokens in that cache.

Why does the first token take the spare attention?

One big reason is arithmetic. Softmax forces the weights for each token to add up to one, so a new token has to hand out all of its attention. When nothing earlier is a strong match, the model has learned a habit of parking the surplus on the first token.

  • “Language Models (LMs) assign significant attention to the first token, even if it is not semantically important, which is known as attention sink.”

    Gu et al., ICLR 2025

  • “We attribute the reason to the Softmax operation, which requires attention scores to sum up to one for all contextual tokens.”

    StreamingLLM authors

One reason the first token gets the habit is how text is read: almost every later token can see it, so training keeps reinforcing it as the sink. The model puts a large share of the weight there even when that token is a stray word or a start marker.

Where a new token's attention goes

New token

asks which earlier tokens matter

Softmax

weights must add up to one

Where the weight lands

First token (sink)

large share, little content

Real words

share the small leftover

Blended answer

the sink adds little information

  1. 1The new token scores every token before it.
  2. 2The learned scores send a large share to the first token.
  3. 3The real words share what is left.
  4. 4Little information comes through the sink.
  5. 5The real words shape the answer.
A new token scores every token before it. Softmax makes the weights add up to one. The learned scores send a large share to the first token, and the real words share the rest. The blended answer draws little from the sink.

The sink is not a fixed law. A 2024 study found that its position is tied to the training loss and the data, and that the extra weight it stores may add no information to the answer.

What breaks when the sink is dropped?

Window attention is the cheap way to run a long chat. The cache keeps only the most recent tokens, so memory stays flat once the cache fills. The StreamingLLM paper (a 2023 method for long streams) found that this breaks once the chat outgrows the window: the model collapses once the sequence length exceeds the cache size, even if only the first token's cache was evicted.

Here is a small code demo with made-up scores. It shows the sink first, then removes it and lets the remaining weights share out again.

Python
# A made-up attention row for one new word in a bank's support chat.
import math

tokens = ["<start>", "Refund", "policy", "v2", "Hi", "my", "card", "was"]
scores = [4.1, 0.9, 0.7, 0.2, -0.5, 0.0, 0.6, 0.4]  # made-up match scores

def softmax(values):
    exps = [math.exp(v - max(values)) for v in values]
    total = sum(exps)
    return [e / total for e in exps]

weights = softmax(scores)
for token, weight in zip(tokens, weights):
    print(f"{token:<8} {weight:.2f}")
print(f"{'total':<8} {sum(weights):.2f}")

# Now drop the first token from the cache (window attention) and renormalise.
kept = list(zip(tokens[1:], scores[1:]))
after = softmax([s for _, s in kept])
for (token, _), weight in zip(kept, after):
    print(f"{token:<8} {weight:.2f}")

Output

<start>  0.85
Refund   0.03
policy   0.03
v2       0.02
Hi       0.01
my       0.01
card     0.03
was      0.02
total    1.00
Refund   0.23
policy   0.19
v2       0.12
Hi       0.06
my       0.09
card     0.17
was      0.14

With the sink, the first token takes 0.85 of the weight and the seven real tokens share 0.15. Once the sink is removed, the same real tokens share all of the weight, and in this made-up row Refund jumps from 0.03 to 0.23. The paper describes this kind of shift as a significant change in how attention is spread, away from what is expected in normal inference.

What a window-only cache loses

Long support chat

40,000 tokens (made-up size)

Window only

Keep last 2,048

the first tokens get evicted

Window plus sinks

Keep first 4 + last 2,048

the first 4 stay as sinks

Quality collapses

replies drift once it slides

Quality stays steady

the sinks keep the model stable

  1. 1Old tokens leave the cache as the chat grows.
  2. 2This cache also keeps the first four tokens.
  3. 3Without the sink, the model's attention is thrown off.
  4. 4The sinks hold the attention pattern steady.
The same long chat goes into two caches, with made-up sizes. The window-only cache drops the first tokens, and quality collapses once the chat outgrows it. The cache that also keeps four sink tokens stays steady.
  • Window only

    Cheap, then it breaks

    Keeps the recent tokens and nothing else. The model's language quality collapses once the text outgrows the cache.

  • Recompute

    Works, but slow

    Rebuilds the cache for recent tokens on every step. Strong results, but the paper calls it significantly slower.

  • Window plus sinks

    Cheap and steady

    Keeps the first four tokens with the window. The paper reports stable language modelling up to 4 million tokens.

Worked case: a bank's team runs an open model on its own servers, so it controls the cache. Its support bot handles a 40,000-token chat and keeps only the last 2,048 tokens, a made-up figure. Replies start to drift as the window slides past the start of the chat. The fix is to keep the first few tokens' cache as well. The paper found that four initial tokens generally suffice, so the fix adds just four tokens to a 2,048-token window.

  • “While StreamingLLM improves the efficiency of LLMs in streaming contexts, it does not extend the models' context window or enhance their long-term memory capabilities.”

    StreamingLLM authors

The paper is clear about the limit. StreamingLLM does not extend the context window or add long-term memory. The bot still forgets anything outside the window, so a fee the customer was quoted early in a long chat is gone unless something else keeps it.

Where else does the sink show up?

Researchers now use the sink in more than streaming. A 2024 study says the phenomenon has been widely adopted in long context generation, KV cache optimisation, faster inference and model quantisation.

One practical idea is to train the sink in. The StreamingLLM authors pre-trained 160-million-parameter models from scratch with a single dedicated sink token, and found it kept performance in streaming cases. The same 2023 paper also said that adding such a token during pre-training can further improve streaming deployment.

The 2024 study also found that sinks do not appear with sigmoid attention, which drops the normalisation step, in models up to one billion parameters. So the softmax design is part of the cause, which matters for anyone building a new model.

Tip

If someone says the first token is only a start marker and can be dropped to save memory, ask how they tested long chats. Dropping it is what made window attention collapse in the StreamingLLM tests.

How would you keep a support bot steady over a 200-turn chat?

Start with the memory budget, because it sets the window. Then keep the sink, and store anything the bot must not forget somewhere other than the cache.

  1. 1

    Measure the chat

    Count how many tokens a typical 200-turn chat uses, and how fast that number grows.

  2. 2

    Keep sinks and a window

    Keep the first few tokens (four sufficed in the paper's tests) and a recent window that fits the budget.

  3. 3

    Store the facts

    Save the quoted fee, the account type and open complaints in a database or a short summary the bot reads back each turn.

  4. 4

    Test the start and the end

    Run 200-turn test chats and check that answers about the first turns still make sense at the end.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: the first token that soaks up spare attention.
  • Why it exists: attention weights must add up to one.
  • Why it matters: dropping it breaks a window-only cache.
  • The fix: keep the first few tokens with the window, and say what is still forgotten.
  • Honest limits: it is not long-term memory, and the sink can be trained in.
  • A test on chats longer than the window.

Common traps

  • Trap"The first token is just a start marker, so drop it."

    BetterIt holds the sink. Dropping it is what made window attention collapse in the StreamingLLM tests.

  • Trap"A bigger context window solves this."

    BetterA bigger window only delays the problem. Once the chat outgrows it, the same collapse follows. Keep the sinks and store the facts.

  • Trap"Attention sinks are a bug to patch out."

    BetterThe model relies on the pattern. Work with it, or change the design on purpose.

Can you spot the sink?

Spot the sink

Your streaming bot keeps its cache in one of these ways. Which line keeps the attention sink?

Quick check

A long-running support bot keeps only a recent window in its KV cache, and its replies drift. Which change is most likely to steady it?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q008What is a context window?11 min
  2. Q009What happens when input is longer than the window?12 min
  3. Q055What is the KV cache, and why does it speed up generation?12 min
  4. Q059Sliding-window and sparse attention?12 min
  5. Q070How do long-context extensions like RoPE scaling work?11 min
  6. Q326Prompt cache vs semantic cache vs KV cache?13 min

Last updated on 27 November 2026

Building a bot that has to run for weeks?

I design and build AI products and agents, including the system behind the chat. Book a short call and tell me how long your conversations run and what the bot must remember.