Get Started

Distributed Data Parallel and FSDP from Scratch

Multi-rank training is two collectives and one rule. Broadcast the parameters at startup, average the gradients after backward, never let the ranks disagree about what step they are on.

90 minutesBuildPythonMembers

Learning Objectives

  • Bring up a process group across N ranks with the gloo backend, no special hardware.
  • Implement a minimal DDP wrapper that broadcasts parameters at construction and all-reduces gradients after backward.
  • Prove that the all-reduce of per-rank gradients matches a single-process gradient on the concatenated input.
  • Sketch FSDP parameter sharding: each rank holds a slice, the full tensor is gathered for the forward pass and dropped after.