Log inStart free
LESSON 32.06 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Where inference memory goes

Watch one GPU's 80 GiB fill with weights, overhead, activations, buffers and cache.


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/mo
EXPLAINER · 32.06 · MEMORY BAYGPU 0 OF 8 · WEIGHTS 16.43 GiB
01
Stage 1 of 5 · Weights
The 70B model needs 131.42 GiB of weights in BF16. Tensor parallelism splits them over 8 GPUs: 16.43 GiB each.
Explain it simply

Every token reads every weight, so all of them must sit in GPU memory. Seventy billion weights at 2 bytes each fill the long ochre bar at the bottom. The engine cuts every matrix into 8 equal slices, one per GPU. The ribbon carries the first slice to GPU zero.

The model bar of 131.42 GiB in 8 shards. GPU 0 holds 16.43 GiB of weights.

weightsactivations, KV cachebuffersdoes not fitfree memorykept free, or kept by training
model: 70.55B parameters × 2 B = 131.42 GiBGPU 0GPU 1GPU 2GPU 3GPU 4GPU 5GPU 6GPU 7GPU 0 holds 1/8: 16.43 GiBweights 16.43 GiBGPU 0 of 8 · 80 GiB80 GiBmodel: 70.55B parameters × 2 B = 131.42 GiBGPU 0GPU 1GPU 2GPU 3GPU 4GPU 5GPU 6GPU 7GPU 0 holds 1/8: 16.43 GiBweights 16.43 GiBGPU 0 of 8 · 80 GiB80 GiB
Toy: Llama 3 70B shape on 80 GiB GPUs, 4K context · overhead sizes are typical
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
W≈P⋅bg\sy{w}{param}{W} \approx \frac{P \cdot b}{g}
W≈70.55B⋅2 B8=16.43 GiBW \approx \frac{70.55\text{B} \cdot 2\,\text{B}}{8} = 16.43\,\text{GiB}

The weights, at b bytes each, split over g GPUs.

Common mix-ups

MYTHInference keeps every layer's activations in memory.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With 4 GPUs instead of 8, do more or fewer 4K requests fit on each GPU?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

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.