SDE & MLE Prep

Distributed Training

Q: How do you train a model that doesn't fit on one GPU?

StrategySplitsCommunication
Data parallel (DDP)batch across GPUs, full model copy eachall-reduce gradients every step
ZeRO / FSDPshards optimizer states, gradients and parametersgather params on demand
Tensor parallelindividual matrices across GPUs (within a node)all-reduce per layer (needs NVLink)
Pipeline parallellayers across GPUs/nodes; micro-batches fill the pipelineactivations between stages; "bubble" overhead
Expert parallelMoE experts across GPUsall-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.