LESSON 29.09 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
KV-cache compression and eviction
Watch a full KV cache drop tokens or bits, and see what each costs.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 29.09 · MEMORY BAY128K TOKENS · 16 GIB A REQUEST · 4 FIT
01
Stage 1 of 6 · Full cache
Each cached token keeps its keys and values. A 128K-token prompt needs 16 GiB, so 4 requests fit.
Explain it simply
Each square in the strip is one token of the prompt. For every token, the model keeps its keys and values in all 32 layers. That's 128 KiB a token, and 16 GiB for a long prompt. Only 4 such requests fit next to the weights.
A strip of 64 token cells. Below it, a GPU memory bar: weights, then 4 requests of 16 GiB each.
tokens, attentionevicted tokenlost attention, errorweights
Toy: one attention head, 64 + 8 tokens; memory from the 29.C5 decoder
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Cache memory grows with every cached token.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.