DDP vs FSDP for a 13B full fine-tune on 4xA100-40GB: which is feasible?
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.
Detailed answer & concept explanation~8 min readEverything 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. 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.
- PyTorch FSDP is the standard backbone for 2026 community fine-tunes of Llama 3.1 70B and DeepSeek V4 on consumer or modest enterprise clusters.
- Hugging Face Trainer and Accelerate both wrap FSDP behind a config flag, so swapping DDP for FSDP is usually a one-line change to a YAML.
- DeepSpeed ZeRO Stage 3 is functionally equivalent to FSDP for memory sharding, the two are interchangeable in most practical contexts.
- Axolotl and LLaMA-Factory default to FSDP for full fine-tunes above 7B in their 2026 reference recipes for exactly this memory reason.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does FSDP relate to DeepSpeed ZeRO Stages 1, 2, and 3?
QWhat changes if you add gradient checkpointing on top of FSDP?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
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.
Same topic, related formats. Practice these next.