6.1.9 · D5Scaling & Efficient Architectures
Question bank — FSDP and sharded training
True or false — justify
FSDP reduces the total amount of memory used across the whole cluster.
False — the persistent total is unchanged (one full copy of everything still exists, just split up). FSDP reduces memory per device by , which is what lets a giant model fit at all.
FSDP with devices always gives exactly an reduction in memory.
False — only the persistent params/grads/optimizer states divide by . The temporary all-gather buffer, the activations, and framework overhead do not shard, so real reduction is less than .
FSDP is a different algorithm from ZeRO.
False — FSDP is PyTorch's implementation of the same idea as ZeRO-3 (shard params + grads + optimizer states). They are the same strategy under two names.
Sharding parameters means each device runs a smaller, faster matrix multiply.
False — during compute the full layer is temporarily reconstructed via all-gather, so the matrix multiply is full-size. Sharding saves storage, not compute per layer.
FSDP is always faster than plain data parallelism because it saves memory.
False — for a model that already fits, FSDP just adds all-gather + reduce-scatter overhead with no memory benefit to trade against, so it runs ~15–20% slower.
Reduce-scatter and all-gather move the same amount of data per device.
True — both cost about per device; reduce-scatter is essentially all-gather run in reverse with a sum folded in.
Once optimizer states are sharded, momentum for a given parameter lives on only one device.
True — device owns shard and only its momentum and variance . That is why the optimizer step is a purely local operation needing no communication.
FSDP eliminates all redundant copies during training.
False — redundancy is eliminated for persistent state, but during a layer's forward/backward every device transiently holds the full layer's parameters at once.
Activation checkpointing and FSDP solve the same memory problem.
False — FSDP shards params/grads/optimizer; checkpointing attacks activation memory (which FSDP never touches). They are complementary, not substitutes.
Spot the error
"I'll use FSDP so I can train an arbitrarily large model on my 8 GPUs."
The error ignores activation memory, which FSDP does not shard. Activations scale with batch × seq_len × hidden_dim per layer and can dwarf sharded parameter memory — you also need activation checkpointing.
"FSDP splits the weight matrix , so device only computes ."
That describes tensor parallelism, not FSDP. FSDP reassembles the full before the multiply via all-gather; it never leaves split during compute.
"After the backward pass I'll all-reduce the gradients like in normal DP."
FSDP uses reduce-scatter, not all-reduce. All-reduce would leave every device holding the full gradient (redundant); reduce-scatter sums and hands each device only its own shard's gradient.
"The all-gather buffer scales with total model size, so it's still huge."
The temporary buffer holds one layer's parameters, not the whole model — typically 1–2% of model memory. FSDP frees each layer's gather right after use.
"On a slow PCIe link FSDP is fine because it saves so much memory."
On slow interconnects the all-gather/reduce-scatter time can dominate compute ( large), making training slower. Memory savings don't help if the network becomes the bottleneck.
"ZeRO-1 already shards parameters, so it's the same as FSDP."
ZeRO-1 shards only optimizer states. Parameter sharding is the ZeRO-3 / FSDP feature; ZeRO-2 adds gradients but still keeps full parameters on each device.
"Optimizer states are cheap, so sharding them barely helps."
For Adam in fp32, momentum + variance is 16 bytes/param versus 4 for the param — optimizer state is the largest memory consumer, which is exactly why ZeRO starts by sharding it.
Why questions
Why does FSDP all-gather the same layer twice (once forward, once backward)?
Because the full parameters are discarded after the forward pass to reclaim memory; the backward pass needs them again to compute , so it re-fetches them.
Why can't we simply keep the gathered parameters around between forward and backward?
Holding every layer's full parameters resident would defeat sharding — memory would climb back to a full replica. The gather-use-discard cycle is the whole point.
Why does FSDP prefer reduce-scatter over doing a full all-reduce then slicing?
Reduce-scatter fuses summation and distribution into one collective, so each device only ever receives its own shard — half the traffic of all-reduce-then-slice and no wasted full-gradient buffer.
Why do transformers hide FSDP's communication cost well?
Their layers are large matrix multiplies, so compute time is long relative to the fixed communication of gathering that layer — the all-gather overlaps with (and is hidden behind) computation.
Why does hybrid pipeline + FSDP reduce the all-gather scope?
Pipelining puts different layer ranges on different device groups, so a layer's parameters only need gathering within its own group, shrinking the collective from all GPUs to intra-stage GPUs.
Why is mixed precision usually paired with FSDP rather than an alternative to it?
They cut memory along different axes — mixed precision halves per-tensor byte width, FSDP divides by device count. Multiplying both effects is what makes 175B-scale training feasible.
Why does gradient accumulation not remove FSDP's per-step communication?
Accumulation reduces optimizer frequency, but each micro-batch's forward/backward still needs its layers all-gathered, so the gather/scatter traffic per step remains.
Edge cases
What does FSDP do when (single device)?
Sharding is trivial — the "shard" is the whole tensor and every collective is a no-op. FSDP degenerates to ordinary single-device training with only bookkeeping overhead.
What happens if a tensor's size isn't divisible by ?
FSDP pads the flattened parameter buffer so it divides evenly; the padding is ignored in compute but means the per-device shard is slightly larger than .
For a model that comfortably fits with plain DP, what's the right call?
Skip FSDP — its all-gather/reduce-scatter overhead has no memory savings to justify it. Reach for FSDP only when model memory exceeds available GPU memory.
At the extreme (number of params), what limits further sharding?
The persistent state approaches zero per device, but the un-shardable pieces — the one-layer gather buffer, activations, and communication latency — become the floor, so returns vanish well before that limit.
What if the interconnect is fast enough that communication is nearly free — does FSDP ever hurt then?
Barely — with communication fully overlapped by compute the only residual cost is the transient gather buffer, so FSDP behaves almost like DP with a smaller memory footprint.
If activations dominate memory even after FSDP, what fixes it?
Add activation checkpointing to recompute activations in backward instead of storing them, trading ~33% more compute for roughly less activation memory — FSDP alone cannot.
Recall One-line self-test
Name the three things FSDP shards and the one big thing it does not. ::: Shards parameters, gradients, and optimizer states; does not shard activations.