What this lesson covers.
This module is one of 42 in the curriculum. Below is the canonical interactive lesson — tabs, cards, and diagrams from the source repo, rendered inside the course shell. An audio narration runs alongside it - the sticky player at the top of the page plays the full Module 15 clip.
If you prefer to read first and play with the demos after, the interactive lesson sits below this section. If you'd rather hear it narrated while you scroll, hit play on the sticky audio bar at the top — or just let it autoplay.
Read / reason / test
Account for more than model weights
High school · build the intuition
Training can store weights, gradients, optimizer state and intermediate activations. Gradient accumulation combines several small batches before an update. Activation checkpointing saves selected intermediates and recomputes others. These techniques change the memory-time trade-off; neither makes every model fit every device. List the different memory users before assuming that the checkpoint’s file size predicts training capacity.
College · work the example
Four microbatches of eight examples can represent 32 examples per update with correct accumulation and loss scaling. This need not be numerically identical to a single physical batch when randomness or batch-dependent operations matter. Mixed precision changes tensor sizes but may retain higher-precision copies or scaling state. Measure each configuration instead of adding only weight-file sizes.
Explain it back
Describe the process in your own words. Identify the assumption that makes this example work, then explain one conclusion it cannot establish.
Read the primary source or official documentation →
The numerical examples are authored teaching exercises, not measured model benchmarks. This extension adds context to the original lesson.
The lesson itself.
Layer 9 — Training Optimizations
The Smart Mountain Climber
You feel the slope with your feet and take a step downhill. But what if you take a step that is too big? You might jump over the valley and land higher up on the opposite cliff! What if your step is too small? It will take you a million years to get to the bottom. Sometimes there are small "fake" valleys (local minimums) that trap you before you reach the true bottom.
Learning Rate: How big of a step the ball takes. (Default ~3e-4)
Momentum (β₁): Allows the ball to roll up small bumps to escape fake valleys! (Default ~0.9)
RMSProp (β₂) & Weight Decay (λ): (Hidden for simple physics) Defaults are usually β₂=0.95, λ=0.1.
With Momentum (standard in the AdamW Optimizer), the ball builds up speed as it rolls, giving it enough juice to roll out of the small dip and find the true lowest point.
Mixed Precision (BF16): Instead of calculating math with 10 decimal places, the AI uses just 3 decimal places to save weight, while keeping the big numbers accurate.
ZeRO: Instead of one computer carrying the whole backpack, a cluster of 8 Graphics Cards dynamically toss the items to each other so nobody gets crushed.
Further reading.
The canonical references for this module. External links open in a new tab.
What to read next.
Use the pager below to move sequentially through the curriculum, or jump to any module from the course index. Each track has a "Prereq: ↑ foundation" callout so you can backfill anything that wasn't clear.