Menu

1 / 2

FSDP vs DDP: when do you need sharded data parallel?

DEV Community: pytorch·Viswaretas Kotra·16 days ago
#STdokIgL
#devtopytorch#devto#dev#model#fsdp
Long article (2038 words) — no AI summary yet.
Reading 0:00
15s threshold

For full training with AdamW in mixed precision, DDP stops fitting on an 80 GB NVIDIA H100 at roughly 3.75 billion parameters once you keep 20 GB for activations, and above that you need FSDP. Nodus runs either one with the same torchrun command on 1, 2, 4 or 8 GPUs of a machine, with H100s listed at $2.60/hr on the Nodus pricing page . If one GPU holds the full copy of weights, gradients and optimizer state with room for activations, DDP is simpler and moves less data; if not, FSDP shards that copy across GPUs.

Our multi-GPU training guide covers writing and launching both. This post only settles the choice between them. It works out per-GPU memory for 1B, 8B, 13B and 70B models, the traffic each strategy adds, and the smallest setup that fits. All figures are our own arithmetic from the PyTorch docs and the ZeRO paper, shown so you can redo them.

What is the actual difference between DDP and FSDP?

DDP copies the whole model to every GPU, and FSDP splits it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.