Skip to content

Part 11: Training at Scale

What it takes to train the capstone on a laptop, and what changes on a cluster. The core module adds bf16 mixed precision (emulated), fp16 loss scaling, gradient accumulation, and activation checkpointing. Collectives (ring all-reduce over shared memory) and data parallelism with ZeRO stages are optional, with tensor and pipeline parallelism as side quests.

Course passes: 9 (L11.1, milestone MS-L11, part of gate MS-P9); L11.2 and L11.3 optional

Before you start: the just-in-time math M08.4 (Hessian-vector products and checkpoint schedules); bf16 emulation from Numerical Methods and Floating Point; the optimizers of Optimization.

  • Mixed precision keeps a float32 master copy of the weights and computes in bf16; fp16 needs a loss scale so small gradients do not underflow.
  • Accumulation sums gradients over micro-batches so a large effective batch fits in memory, with the loss scaled by the number of micro-batches.
  • Checkpointing stores activations at segment boundaries and recomputes the rest during backward, trading compute for memory.
ModuleTopicKindPass
L11.1bf16 mixed precision, fp16 loss scaling, gradient accumulation, activation checkpointingbuild9
L11.2Collectives over processes (ring all-reduce over pipes)side9, optional
L11.3DDP and ZeRO-1/2/3side9, optional
#ModuleChapterKindPass
1L11.1Mixed precision, loss scaling, gradient accumulation, and activation checkpointingbuild9
2L11.2Collectives over processes: ring all-reduceside9
3L11.3Data parallelism and ZeRO stages 1 to 3side9