# 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.

AI and LLM interview question Q069, Transformer architecture. Advanced, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-is-an-attention-sink

## Say it in 30 seconds

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.

## Say it in 2 minutes

A language model decides what to look at by giving each earlier token a weight. Those weights must add up to one. Sometimes no earlier token is a good match for the next word, but the weight still has to go somewhere. So the model learns to park most of that spare weight on the first token. That first token is the attention sink.

One big reason the sink is usually the first token is that almost every later token can see it. The StreamingLLM paper from 2023 found that keeping the first few tokens in the cache largely recovers a model's performance once old tokens are dropped. When a chat runs longer than the window, a model that only keeps its recent tokens collapses. Keeping four initial tokens along with the window is the simple fix.

A bank's team runs an open model on its own servers, so it can manage the cache directly. Its support bot handles a 40,000-token chat and keeps only the last 2,048 tokens in the cache, a made-up size. Replies drift once the window slides past the start of the chat. Keeping the first few tokens as well largely fixes that, with four extra tokens in the cache. The trade-off is that the bot still forgets anything outside the window, so it is not long-term memory.

Two more facts matter in interviews. A sink can be trained in: one dedicated sink token was enough for streaming in the StreamingLLM tests. And a 2024 study found that models up to one billion parameters, built with a different attention design that skips the softmax step, had no sinks. So the sink depends on how a model was built and trained, which is worth checking for any model you use.

## 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.

- **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.

*Diagram, Where a new token's attention goes: 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.*
1. The new token scores every token before it.
2. The learned scores send a large share to the first token.
3. The real words share what is left.
4. Little information comes through the sink.
5. The real words shape the answer.

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:

```text
<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.

*Diagram, What a window-only cache loses: 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.*
1. Old tokens leave the cache as the chat grows.
2. This cache also keeps the first four tokens.
3. Without the sink, the model's attention is thrown off.
4. The sinks hold the attention pattern 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. **Measure the chat:** Count how many tokens a typical 200-turn chat uses, and how fast that number grows.
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. **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. **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." Better: It holds the sink. Dropping it is what made window attention collapse in the StreamingLLM tests.
- Trap: "A bigger context window solves this." Better: A 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." Better: The 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?

A. keep_kv = kv[-2048:]  # only the recent window
B. keep_kv = kv[:4] + kv[-2048:]  # sinks plus window
C. keep_kv = kv[-4096:]  # bigger window, same rule
D. keep_kv = []  # reset the cache on every turn

**Answer:** B. The first four entries are the sinks. Keeping them with the recent window is the fix the StreamingLLM work tested. The other lines drop the sink, and the last one wipes the context the bot needs.

**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?

A. A longer system prompt
B. Keep the first few tokens' cache along with the recent window
C. A higher temperature
D. A model with more parameters

**Answer:** B. The first few tokens are the sinks. A longer prompt, a higher temperature or a bigger model does not bring back a sink that was dropped from the cache.

## Can you answer these from memory?

**Flash cards**

- **What is an attention sink?** Usually the first token(s) a model attends to heavily, even when they hold little meaning.
- **Why does it exist?** Softmax weights must add up to one, so spare attention needs a place to go.
- **Why the first token?** One big reason: almost every later token can see it, so training favours it as the sink.
- **What breaks when it is dropped?** A window-only cache: quality collapses once the chat outgrows the window.
- **What is the simple fix?** Keep the first few tokens' cache with the recent window. Four sufficed in the paper's tests.
- **Does it give long-term memory?** No. The StreamingLLM paper says it does not extend the context window or memory.

## Likely follow-up questions

- Q008 What is a context window? https://designervenkat.online/interview/ai/what-is-a-context-window
- Q009 What happens when input is longer than the window? https://designervenkat.online/interview/ai/what-happens-when-input-is-longer-than-the-window
- Q055 What is the KV cache, and why does it speed up generation? https://designervenkat.online/interview/ai/what-is-the-kv-cache
- Q059 Sliding-window and sparse attention? https://designervenkat.online/interview/ai/sliding-window-and-sparse-attention
- Q070 How do long-context extensions like RoPE scaling work? https://designervenkat.online/interview/ai/how-do-long-context-extensions-like-rope-scaling-work
- Q326 Prompt cache vs semantic cache vs KV cache? https://designervenkat.online/interview/ai/prompt-cache-vs-semantic-cache-vs-kv-cache
