DDP vs FSDP for a 13B full fine-tune on 4xA100-40GB: which is feasible?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
DDP replicates the full 13B on every GPU, which busts 40GB once gradients and Adam state are added. FSDP shards weights, grads, and optimizer state across the 4 GPUs, dropping per-GPU memory to a quarter, and fits.
Picture four friends moving house. With the DDP strategy each friend carries a complete copy of every box, so the heaviest single load is the whole apartment, no one can lift it. With the FSDP strategy the boxes are split and each friend carries only a quarter of them, talking to the others when they need something the others are holding. The total weight is the same, but no single friend is crushed. For a 13B model on 40GB cards the difference between crushed and fine is exactly that.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: per-GPU memory math for 13B with Adam in mixed precision + DDP's replication model + FSDP's sharding model + why DDP busts the 40GB budget + why FSDP fits + when DDP still wins + relation to ZeRO Stages and gradient checkpointing.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Believing DDP shards memory across GPUs. It does not. DDP replicates the full model on every GPU and only shards the all-reduce traffic during the backward pass, the resident memory per GPU is the same as single-GPU training.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.