Log inStart free
LESSON 31.C1 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Serving one model across GPUs

See five ways to split one model over 8 GPUs, with every message counted.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 31.C1 · SERVING BAYTENSOR · 8 GB A GPU · 1 GPU 64 GB
01
Stage 1 of 5 · What GPUs keep
Tensor parallelism gives each GPU 1/8 of every expert and every KV cache. Each GPU keeps 8 GB.
Explain it simply

Each square is what one GPU keeps of one layer. The ochre cells are the experts, and the teal cells hold each request's KV cache, the stored keys and values. Here every cell is only a thin slice: each GPU keeps one eighth of everything.

A grid of 8 GPUs by 8 layers. Tensor plan: the fullest GPU keeps 8 GB, and 1 GPU would keep 64 GB.

requests, KV cacheexpert weightsmessages, outputsidle, 1 GPU
GPU 0GPU 1GPU 2GPU 3GPU 4GPU 5GPU 6GPU 7layer 1layer 2layer 3layer 4layer 5layer 6layer 7layer 8memory8 GB8 GB8 GB8 GB8 GB8 GB8 GB8 GBtensor 11.12pipeline 11.13data 11.10expert 11.15context 11.14collectives 11.09what each GPU keepsGPU 0GPU 1GPU 2GPU 3GPU 4GPU 5GPU 6GPU 7layer 1layer 2layer 3layer 4layer 5layer 6layer 7layer 8memory8 GB8 GB8 GB8 GB8 GB8 GB8 GB8 GBtensor 11.12pipeline 11.13data 11.10expert 11.15context 11.14collectives 11.09what each GPU keeps
Toy: 8 layers, 8 experts, 8 requests, 8 GPUs; time and memory at real size
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Mg=Wg+Cg\sy{M}{ink}{M_g} = \sy{w}{param}{W_g} + \sy{kv}{data}{C_g}
M0=4.0+4.0=8.0 GBM_{0} = 4.0 + 4.0 = 8.0\ \text{GB}

Each GPU keeps its share of the weights and of the KV cache.

Common mix-ups

MYTH8 GPUs make each token 8 times faster.

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

Predict, then reveal
3 CHECKS · PRO
Q01With 1 request in flight, which plan gives the shortest step?

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 2 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.