179 questions
No questions match those filters.
What does ZeRO actually shard, and why is that differen...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansPlain data parallelism gives every GPU a full copy of the model, a full copy of the gradients, and a full copy of the optimizer state, and synchronizes gradients after each step. That’s simple, but it’s enormously wasteful of memory: for Adam, optimizer state (momentum and variance estimates) is typically about twice the size of the model’s parameters themselves, and none of that needs to be fully replicated on every device.
ZeRO progressively shards that redundant state across GPUs instead of replicating it. Stage 1 shards the optimizer state, Stage 2 additionally shards the gradients, and Stage 3 additionally shards the model parameters themselves — each GPU holding only its slice and reconstructing the full parameter or gradient tensor just-in-time via communication when it’s actually needed for a forward or backward pass.
The trade-off is exactly what you’d expect: more communication (all- gathering shards when needed) in exchange for dramatically lower per-GPU memory, which is what makes training models far larger than a single GPU’s memory would otherwise allow possible without resorting to full model parallelism.