internalsGet Pro

Module 17 · Lesson 4 of 11Pro

Sharded training: ZeRO and FSDP

Level
Advanced
Topic
Distributed training and scalable ML systems
Reading time
17 min

When you finish this page you can

  1. Work out the training memory per GPU for data parallel training and for ZeRO stages 1, 2 and 3 from a model’s parameter count.
  2. Explain why sharding optimizer state and gradients costs no extra communication, and why sharding the parameters too costs about 50% more.
  3. Describe what FSDP does around each wrapped module in one training step, and what sets its peak memory.
  4. Choose how far to shard a model, and name what would change that choice.

Builds on 2 lessons

Start with lesson 217 min
  1. Data parallel training: same model, many GPUs17 min
  2. Checkpoints, mixed precision and gradient accumulation17 min

Video lesson · coming soon

Forty GPUs and still out of memory

is the online store this course uses as its example. Every night Farah’s team retrains the sequence recommender from Generative recommenders, which picks products for each customer’s home page. The job must finish inside a 6-hour overnight window, so Joseph’s growth team has fresh recommendations by morning.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan