6.1.9 · D1Scaling & Efficient Architectures

Foundations — FSDP and sharded training

1,576 words7 min readBack to topic

Before you can read the parent note, you need to know what every letter and arrow in it means. We build them one at a time — no symbol is used before it is drawn.


1. A GPU, and why memory is the enemy

A byte is the unit we measure memory in. One number stored in "fp32" (a common precision) takes 4 bytes. So 175 billion numbers take GB — nearly nine 80 GB desks just to hold them, before you compute anything.

Figure — FSDP and sharded training

That overflowing desk is the whole reason FSDP exists. Keep the picture: desk = one GPU's memory; the stack of paper = what we must store.


2. The four things we must store per parameter

A model is a big pile of numbers called parameters. But training stores more than just the parameters. Look at the coloured stack:

Figure — FSDP and sharded training

So per parameter we store roughly:


3. Devices, and the number

Figure — FSDP and sharded training

4. Layers, and why we sometimes DO need the whole thing

The core problem: a layer's computation is usually a matrix multiply . You cannot multiply by half a matrix and get half an answer — a single output number needs an entire row of . So even though each GPU permanently owns only a shard , to actually run layer it must momentarily hold the whole .


5. The two collective operations

A collective is an operation all GPUs perform together, passing data between each other.

Figure — FSDP and sharded training

6. Putting the symbols in order

GPU has fixed memory

Bytes and 24 per parameter

Parameter theta

Gradient nabla L

Optimizer states m and v

N devices

Shard theta i

Layer needs full weights

All-gather borrows slices

Reduce-scatter sums gradients

FSDP three-phase protocol

Each box is one thing you now know; together they feed the parent's three-phase protocol. Related prerequisites worth a look: Data Paralelism (the "everyone has a full copy" starting point FSDP improves on), Model Parallelism and Pipeline Parallelism (other ways to split a model), Mixed Precision Training (where the 2-byte and 4-byte counts come from), Gradient Accumulation, Activation Checkpointing (the missing piece FSDP does not handle), and ZeRO Optimizer (the theory FSDP implements).


7. A tiny concrete count


Equipment checklist

What does a GPU's fixed memory act like in our pictures?
A desk of fixed size — if the paperwork doesn't fit, you can't work.
How many bytes does one fp32 parameter cost, and why 24 per parameter total?
4 bytes; total 4 (param) + 4 (grad) + 8 (m) + 8 (v) = 24.
What does mean in one phrase?
The whole collection of a model's tunable numbers (weights/knobs).
Read out loud in plain words.
How the loss changes as we nudge each parameter — the arrow saying which way each knob should turn.
What are and , and how big is each?
Adam's momentum and variance; each is the same size as .
What does denote and how many numbers does it hold?
Device 's slice of ; it holds numbers.
Why can't a layer just use its own shard directly?
A matrix multiply needs whole rows, so the full must be temporarily rebuilt.
Before/after state of all-gather?
Before: each device has its slice; after: every device has the full concatenation.
Before/after state of reduce-scatter?
Before: every device has a full gradient; after: device has the summed -th slice.
Why must gradients be summed across devices?
Each GPU sees different data; the true update is the sum of all their gradient opinions.