LESSON 29.C5 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Serving a 128K-token prompt
Watch one long prompt fill a GPU, then spread over many.
Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 29.C5 · SERVING BAYCACHE 16 GIB · 30.96 GIB OF 80
01
Stage 1 of 5 · Cache size
Each token keeps 128 KiB of KV cache. 128K tokens need 16 GiB.
Explain it simply
Every token of the prompt leaves keys and values in all 32 layers, 128 KiB in all. Each bar is one GPU's memory: the weights first, then the cache. A long prompt can need more room than the weights. At 1M tokens a full bfloat16 cache is 128 GiB, more than a whole GPU.
1 memory bar. Each GPU holds 14.96 GiB of weights and 16 GiB of cache. It fits in 80 GiB.
tokens, cache, math timeweightstime, totals, sendsdoes not fitwaiting for sendsfree memory
Toy: Llama 3 8B shape on 80 GiB H100s · one prompt alone
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
The cache per GPU is tokens times bytes a token, over the GPUs.
PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
- 4 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.