Log inStart free
LESSON 32.C3 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Inference math — serving a 70B model

Answer the interview question: how many GPUs, requests and tokens per second?


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/mo
EXPLAINER · 32.C3 · SIZING BAYWEIGHTS 16.43 GiB ON EACH OF 8 GPUS
01
Stage 1 of 6 · Weights
The model needs 131.42 GiB in BF16. Tensor parallelism splits it over 8 GPUs: 16.43 GiB on each.
Explain it simply

Every token reads every weight, so all of them stay in GPU memory. One 80 GiB GPU can't hold 131 GiB, so the model is cut into 8 slices. Each GPU keeps one slice, the ochre part of its memory bar, and they compute each layer together.

A bar of 131.42 GiB cut into 8 shards. Shard 0 is 16.43 GiB on GPU 0's 80 GiB bar.

weights, roofsKV cache, HBMcompute, answerslink, gaps, no roomfree memory
the model · 131.42 GiB in BF1632.06GPU 0GPU 1GPU 2GPU 3GPU 4GPU 5GPU 6GPU 7tensor parallelism: 8 ways11.12GPU 0 of 8 · 80 GiB32.06weights 16.43 GiBthe model · 131.42 GiB in BF1632.06GPU 0GPU 1GPU 2GPU 3GPU 4GPU 5GPU 6GPU 7tensor parallelism: 8 ways11.12GPU 0 of 8 · 80 GiB32.06weights 16.43 GiB
Toy: Llama 3 70B shape on 80 GiB H100s, 4K context · overhead and efficiencies are typical
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Wgpu≈P b / g\sy{w}{param}{W_{gpu}} \approx \sy{P}{param}{P}\,\sy{b}{param}{b} \,/\, \sy{g}{param}{g}
Wgpu≈131.42 GiB/8≈16.43 GiBW_{gpu} \approx 131.42\text{ GiB} / 8 \approx 16.43\text{ GiB}

Parameters times bytes per weight, split over g GPUs.

Common mix-ups

MYTHIn BF16, the fewest GPUs that hold the weights serve cheapest.

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

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

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

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.