ZeRO (Zero Redundancy Optimizer, DeepSpeed) fits large-model training into limited GPU memory by eliminating redundant copies of state. With
Ψ total parameters (FP16, 2 bytes/element) trained in mixed precision with Adam, training must simultaneously hold the FP16 params
2Ψ, the FP16 gradients
2Ψ produced by backprop, and the FP32 optimizer states — a master weight copy
4Ψ + first moment
4Ψ + second moment
4Ψ =
12Ψ — giving a static total of
16Ψ=2Ψ+2Ψ+12Ψ. For a 70B model:
16×70 GB
=1120 GB, which one H100 (80 GB) cannot hold, and naive DDP replicating the full state
Nd times across
Nd ranks makes it worse. ZeRO shards in three stages (per-rank memory with
Nd ranks): ① ZeRO-1 shards only optimizer states:
2Ψ+2Ψ+Nd12Ψ; ② ZeRO-2 also shards gradients:
2Ψ+Nd2Ψ+12Ψ; ③ ZeRO-3 shards parameters as well:
Nd16Ψ — 70B needs
Nd=16 H100s (
1120/16=70 GB each). Still not enough, offload: move optimizer states and gradients to CPU RAM while the GPU keeps only the local FP16 param shard
2Ψ/Nd=140/8=17.5 GB (8 GPUs), paging to NVMe on demand (ZeRO-Infinity, scaling to trillion-parameter models).