Distributed Training
Q: How do you train a model that doesn't fit on one GPU?
| Strategy | Splits | Communication |
|---|---|---|
| Data parallel (DDP) | batch across GPUs, full model copy each | all-reduce gradients every step |
| ZeRO / FSDP | shards optimizer states, gradients and parameters | gather params on demand |
| Tensor parallel | individual matrices across GPUs (within a node) | all-reduce per layer (needs NVLink) |
| Pipeline parallel | layers across GPUs/nodes; micro-batches fill the pipeline | activations between stages; "bubble" overhead |
| Expert parallel | MoE experts across GPUs | all-to-all token routing |
Large runs combine them ("3D parallelism"), plus mixed precision (bf16), activation checkpointing, and gradient accumulation to reach large effective batch sizes.