Spot the errors in this KV-eviction strategy for long-running generation
Click any words you think contain an error. Click again to unmark.
Naive sliding-window eviction drops the first tokens, which are attention sinks, so quality collapses. StreamingLLM fixes it by pinning a few sink tokens plus the recent window.
Imagine a long meeting where everyone keeps glancing at the chairperson before they speak, almost out of habit, even when the chair is not the topic. That quick glance steadies them. Now imagine the chair quietly leaves. Suddenly everyone's instinct misfires, glances land on random people, and the conversation falls apart. A transformer behaves the same way. The very first tokens act like that chairperson: the model learned to dump leftover attention onto them so the math stays balanced. If you evict those first tokens to save memory, the balance breaks and the output turns to garbage. The fix is simple. Keep the first few tokens forever, slide a window over the rest, and the meeting keeps running smoothly.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: softmax must sum to one creating sinks on early tokens, why naive eviction collapses abruptly, the StreamingLLM pin sinks plus window fix, and the streaming vs context extension distinction.
Real products, models, and research that use this idea.
- StreamingLLM, from MIT and Meta, demonstrated stable perplexity over four million tokens by pinning four sink tokens plus a recent window.
- Llama 4 and Mistral Large 3 ship with attention-sink aware streaming so agent loops stay coherent far past the trained context length.
- vLLM and SGLang both expose sink-token retention in their KV cache eviction policies for long-running production serving.
- GPT-5.5 and Claude Opus 4.7 use sink-aware streaming internally so multi-hour agent sessions do not degrade as the cache window slides.
- DeepSeek V4 documents a dedicated learnable sink token so real content tokens are not co-opted as the softmax dumping ground.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does softmax normalization create attention sinks in the first place?
QWhy are the FIRST tokens chosen as sinks rather than some middle position?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming attention concentrates on recent tokens, so the oldest KV is safe to drop. The first few tokens are sinks, and evicting them collapses quality abruptly.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.