Log inStart free
LESSON 11.12 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Tensor parallelism

Watch two GPUs split every weight matrix and pass messages between layers.


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

Go Pro · $8.25/mo
EXPLAINER · 11.12 · TENSOR BAYCOLUMN → ROW · GPU 0 HOLDS 40.03 OF 80.04 MB
01
Stage 1 of 6 · Split the weights
Tensor parallelism splits every weight matrix A over 2 GPUs. Each GPU keeps 40.03 of 80.04 MB.
Explain it simply

Each grid is one layer's weights A: inputs down, outputs across. Column j of A is row j of the toy's W. Each GPU keeps its half: the solid cells. Row layers copy their biases to both GPUs. The dashed lane is one GPU with the whole model. Each grid stands for a real 20 MB matrix, as in 11.10.

Two GPU lanes and a one-GPU lane. Each GPU holds half of the four weight matrices, plus biases: 40.03 of 80.04 MB. Plan: column then row.

samples, activationsweights A = Wᵀgradients, wrong valuesmessages (collectives)1 GPU, whole model
forward passGPU 0GPU 11 GPU, whole modelLayer 1 · columnLayer 2 · rowLayer 3 · columnLayer 4 · rowXA₁A₂A₃A₄forward passGPU 0GPU 11 GPU, whole modelLayer 1 · columnLayer 2 · rowLayer 3 · columnLayer 4 · rowXA₁A₂A₃A₄
Toy: the 11.C1 net (4 tanh layers, 2×2 weights), 8 samples, 2 tensor GPUs; 20 MB per layer
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Z=X A+b,A=W⊤\sy{z}{data}{Z} = \sy{x}{data}{X}\,\sy{a}{param}{A} + b,\qquad \sy{a}{param}{A} = W^{\top}
GPU 0:14 of 24 weights and biases, 40.03 of 80.04 MB\text{GPU }0: 14 \text{ of } 24 \text{ weights and biases},\ 40.03 \text{ of } 80.04\ \text{MB}

Each layer multiplies the batch X by A, and each GPU keeps half of A.

Common mix-ups

MYTHEach GPU can apply tanh to its own partial sum.

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

Predict, then reveal
3 CHECKS · PRO
Q01With column-parallel layers only, how many messages does the forward pass need?

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