ZeRO Optimization › Summary
Language AI HandbookAll chapters ZeRO Optimization › SummaryOne section · Sections in this chapter13 / 14 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
ZeRO eliminates the memory redundancy that makes naive data-parallel training wasteful at scale. Rather than replicating all training state across every GPU, it partitions the state so that each GPU permanently owns a shard and fetches the rest on demand. The total model state in mixed-precision Adam training is bytes, of which standard data parallelism replicates every byte across all devices. ZeRO progressively removes this redundancy layer by layer.
The three stages target progressively larger memory categories, each building on the previous:
- Stage 1 partitions optimizer states (Adam moments and 32-bit master parameters), reducing the largest memory component from to per GPU, at no extra communication cost over baseline data parallelism.
- Stage 2 additionally partitions gradients using Reduce-Scatter, saving another bytes per GPU with the same total communication volume as Stage 1 and baseline data parallelism.
- Stage 3 partitions the parameters themselves, achieving a perfect per-GPU memory footprint with 3x the communication of Stages 1 and 2. Each GPU fetches parameters on demand via All-Gather before each layer's computation.
Extensions like ZeRO-Offload and ZeRO-Infinity push state to CPU RAM and NVMe storage respectively, enabling models with trillions of parameters on practical hardware. ZeRO++ addresses Stage 3's communication overhead through quantized weight transmission, hierarchical partitioning that exploits within-node NVLink bandwidth, and quantized gradient communication.
The key practical insight is that ZeRO produces mathematically identical results to standard data parallelism. The partitioning is a pure implementation detail that changes where tensors live and what each GPU computes, without affecting the final parameter values or training dynamics. This correctness guarantee, combined with the linear memory reduction with GPU count under Stage 3, makes ZeRO the standard foundation for large-scale distributed training. FSDP in PyTorch brings these ideas natively into the PyTorch ecosystem, making ZeRO-style training accessible without requiring the full DeepSpeed infrastructure stack.