How DeepSpeed ZeRO stages 1, 2 and 3 split training memory across GPUs

DeepSpeed ZeRO stages 1, 2 and 3 divide a model's training state across GPUs, with stage 1 partitioning optimizer state, stage 2 adding gradients, and stage 3 also partitioning weights. The stage chosen largely determines the hardware needed, with the author estimating that a 70B full fine-tune fits on 8 NVIDIA B200 GPUs using ZeRO-3 or on 8 H100s with optimizer state offloaded to CPU memory. Based on the ZeRO paper's formulas, stages 1 and 2 keep a full copy of some state on every GPU, creating a memory floor that adding GPUs cannot lower, while only stage 3 keeps shrinking per-GPU memory as GPUs increase. The per-GPU figures cited are estimates that exclude activations and temporary buffers, which can be substantial for long sequences. The article also notes that stage 3 moves about 1.5 times as much data per step as stages 1 and 2.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in