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

Sequence and context parallelism

Watch four GPUs share one long sequence, then pass keys around a ring.


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 · 11.14 · SEQUENCE BAY1 GPU · 128K TOKENS · 64 GB OF 40 GB
01
Stage 1 of 5 · One long sequence
One GPU keeps the activations of 8 tokens in 4 layers. At 128K tokens they need 64 GB, over the 40 GB it has free.
Explain it simply

You see one GPU and a sequence of 8 tokens. Each of the 4 layers keeps its activations, the numbers the backward pass needs later. The 8 tokens stand for a real sequence of 128K tokens, so the bar on the right is 64 GB. Only 40 GB are free for them, so this long context does not fit.

A dashed GPU column holds 8 tokens and 4 rows of activations. Its memory bar shows 64 GB against a 40 GB line.

tokens, activationsscores, ring sends40 GB free per GPUkeys on another GPUover the limitone GPU, masked score, waiting
L1L2L3L4tokens1 GPU1234567840 GB free0326496128128K tokens × 4 layers × 128 KB = 64 GB64 GB1 GPUactivation memoryone GPU, whole sequenceL1L2L3L4tokens1 GPU1234567840 GB free0326496128128K tokens × 4 layers × 128 KB = 64 GB64 GB1 GPUactivation memoryone GPU, whole sequence
Toy: the 8 samples of 11.C1 as 8 tokens, its 4 layers, one causal attention step
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
M=S⋅L⋅a\sy{mem}{data}{M} = \sy{seq}{data}{S} \cdot \sy{lay}{param}{L} \cdot \sy{act}{param}{a}
M=131072⋅4⋅128 KB=64 GBM = 131072 \cdot 4 \cdot 128\,\text{KB} = 64\ \text{GB}

Activation memory grows with the number of tokens.

Common mix-ups

MYTHEach GPU needs only its own tokens.

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

Predict, then reveal
3 CHECKS · PRO
Q01At 256K tokens, how many GPUs keep the activations under 40 GB each?

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.