6.1.7 · D1Scaling & Efficient Architectures

Foundations — Model parallelism (tensor, pipeline)

2,061 words9 min readBack to topic

Before you read the parent note Model parallelism (tensor, pipeline), you need a mental picture for every symbol it throws at you. This page builds each one from nothing, in an order where each brick sits on the one before it. Nothing here is "obvious" — we earn it.


1. What is a GPU, and why "memory"?

A GPU (Graphics Processing Unit) is a chip that does thousands of small arithmetic operations at once. For us it is simply a worker with a small desk.

  • The desk surface is its memory — how many numbers it can hold in front of it right now.
  • A typical desk holds about 40 GB (gigabytes). One GB = one billion bytes; one byte = 8 on/off switches, enough to store one small number.

Why the topic needs this: the entire reason model parallelism exists is that one desk is too small. Everything downstream is about splitting the pile across many desks. See GPU Memory Hierarchy for the real hardware layers.


2. A number, a vector, a matrix

We build the objects the parent slices.

The symbol (a stylised "R") means "the set of all ordinary decimal numbers" (R for Real). When the parent writes

read it out loud as: " is a grid of real numbers with rows and columns." The little "" is just the word belongs to. The superscript "" is the shape — how tall and how wide the grid is.

Figure — Model parallelism (tensor, pipeline)

Why the topic needs this: every weight in the network is a matrix, and "cutting a matrix into column slices" only makes sense once you can see the grid.


3. The symbols , , ,

These are just names for how wide things are. Subscripts (the small letters below) are labels, not multiplication.

Symbol Plain words Picture
batch — how many examples we process at once number of rows in the input
input width — how many numbers describe each example coming in columns of the input
output width — how many numbers come out columns of the output
the standard width used all through a Transformer Architecture the "main pipe diameter"

Why the topic needs this: the memory saving is always written as a fraction like . You can't feel that saving unless you know is a width being chopped.


4. Matrix multiplication

This is the one operation the whole topic is built on, so we define it fully.

Example dot product of and :

Why multiply-then-add? Each output number is a weighted vote: the input values () each get a weight () saying how much they matter, and we total the votes. That single number is one neuron's response.

For the shapes to fit, the inner dimensions must match: is , is , and the shared cancels, leaving of shape .

Figure — Model parallelism (tensor, pipeline)

Why the topic needs this: "column-wise split" and "row-wise split" only work because of which dimension of we cut. You must see the two 's meeting in the middle to understand why a column split of produces a column split of .


5. Cutting a matrix: columns vs rows

Now the key move. A matrix can be sliced two ways.

Figure — Model parallelism (tensor, pipeline)

The bar "" inside brackets means placed side by side (concatenation). So means "strip 1, then strip 2, glued together left-to-right."

Why it works (the one fact tensor parallelism leans on): because each output column of only uses the matching column of , cutting into column strips cuts into the same column strips — no strip needs to know about any other. That independence is what lets different GPUs work without talking:

Why the topic needs this: this is tensor parallelism. Device keeps only strip , and produces only strip .


6. Splitting the work: gather, all-reduce

When each desk only made a piece of the answer, we must combine pieces. Two combine-moves appear in the parent.

The symbol (a big Greek "S", sum) means "add these up for ." So

is exactly an all-reduce written in maths.

Why the topic needs this: communication is the cost of splitting. Column-then-row layout in the MLP is chosen precisely to need only one all-reduce.


7. Forward, backward, gradient,

The network learns by a two-way trip.

The symbol (curly-d, called partial derivative) reads: "how much the loss changes when we jiggle a tiny bit." Picture: a slope. If jiggling upward makes go down steeply, that slope is large and negative, so we push that way.

Why a derivative and not just subtraction? We can't try every possible weight. The derivative answers a local question — "which tiny direction improves things right here?" — using one measurement instead of a search.

The superscript means transpose: flip the grid so rows become columns. It appears in purely so the shapes line up for a legal matrix multiply.

Why the topic needs this: memory isn't just weights — the backward pass must store activations from the forward pass. That storage is what pipeline schedules (GPipe, 1F1B) fight over. See Activation Checkpointing and Gradient Accumulation.


8. Devices , ; micro-batches , ; the "bubble"

Final counting symbols.

Symbol Plain words Picture
number of devices sharing one layer (tensor parallel) strips per matrix
number of pipeline stages / devices in a line desks in a row
(or ) number of micro-batches — small chunks of one batch mini-conveyor items

Why more micro-batches () help: with only one big batch, each desk works once and idles the rest. Chopping the batch into pieces keeps every desk fed almost continuously, shrinking the bubble — at the cost of storing more activations. This is the central trade-off of pipeline parallelism, and it connects to Data Parallelism (an orthogonal way to use extra devices) and Mixed Precision Training (which shrinks the numbers themselves).


Prerequisite map

GPU memory limit

Model too big for one desk

Scalar vector matrix

Matrix multiply Y equals X W

Column split and row split

Tensor parallelism

Forward and backward pass

Store activations

Pipeline parallelism

Gather and all reduce

Bubble and micro batches

Model parallelism topic


Equipment checklist

Cover the right side and test yourself.

What does mean?
A grid of real numbers, 3 rows tall and 5 columns wide.
In , which dimensions must match?
The inner ones: the columns of equal the rows of , and they cancel.
How do you compute one entry of ?
Dot product: one row of times one column of — multiply matching entries and add them.
What is a column split of ?
Cutting into vertical strips , each with all rows but only some columns.
Why does a column split of give a column split of ?
Each output column uses only its matching column of , so the strips are independent.
What is the difference between all-gather and all-reduce?
Gather concatenates pieces side by side; all-reduce adds equal-sized partial results into one sum.
What does mean in words?
How much the loss changes when you jiggle slightly — the slope telling us how to nudge .
What is the pipeline bubble and its formula?
Idle time while later devices wait for earlier ones; fraction .
Why do more micro-batches reduce the bubble?
They keep every stage fed almost continuously, shrinking idle time — at the cost of storing more activations.
Why does model parallelism exist at all?
One GPU's memory is too small to hold a huge model, so we cut the model across many GPUs.