Unit 14 of 14 · about 6 hours · implement, measure
A small real-code contribution with before and after evidence
The section ends where the track ends: a real change to real code, defended by measurement instead of adjectives. Bounded scope plus fallback keeps the contribution reviewable.
You'll be able to
- Instrument a real training codebase with correlated rank, collective and memory timelines for one bottleneck.
- Implement one bounded optimization or observability contribution with regression, equivalence and fallback tests.
- Compare off versus on under fixed workload with variance, preserving a regime where the change loses or does not apply.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Debugging workflow and fake backendsTorchTitan
Enable Memory Profiling, Fake Backend Debugging with fake versus real-PP-fake-SPMD modes, Memory debugging workflow, and Troubleshooting jobs that timeout with Flight Recorder dumps
- CPU unit tests as the contribution gateTorchTitan
test_checkpoint.py,test_fsdp.pyandtest_parallelism_config.py; run with pytest and keep the suite green before and after the change - Contribution and measurement requirementsDistributed Training Systems Laboratory
Milestone C for hypothesis, invariants, alternatives and reversal conditions, and Milestone E for baseline-versus-alternative comparison with retained negative results
- Ordered optimization methodMachine Learning Systems Volume II - Fleet Orchestration and Performance Engineering
The Optimization Playbook: A 70B LLM Case Study with the diagnostic sequence, combining rules and lessons
Focus on
- Bounded means one measured bottleneck, one seam, one config flag with fallback. Name the hypothesis, the invariants, the predicted regimes and the reversal conditions before coding.
- Off-versus-on runs share model, data, batch, precision, topology and correctness oracle, and report step time, tokens/s, memory, communication, utilization and failures with variance. Keep a losing regime in the report.
- Defend against two alternatives and show the change addresses the traced critical path rather than an attractive proxy. No benchmark-only special cases and no transfer claims beyond measured scope.
Common mistakes · 3
- Optimizing a microbenchmark instead of the traced critical path. Busbw wins that do not move step time are proxies.
- Shipping without fallback or with a benchmark-only branch. The capstone rejects both: retain the baseline path and fail cleanly.
- Claiming transfer to other hardware or scales. One GPU plus CPU evidence never proves multi-GPU or multi-node behavior.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.What makes a contribution bounded?Answer
One bottleneck from a trace, one seam, one flag with fallback, plus stated regimes and reversal conditions. Anything larger is a rewrite, not a contribution.
2.What does a complete off-versus-on comparison include?Answer
Fixed workload and oracle, step time and tokens/s with variance, memory, communication and utilization deltas, failure counts, and a preserved losing or not-applicable regime.
3.Why two alternatives?Answer
They test whether the chosen fix beats the next-best options on the same evidence. A lone proposal cannot show it addresses the bottleneck rather than coinciding with noise.
Practice
- TorchTitan CPU unit tests with one bounded change
Run
test_checkpoint.py,test_fsdp.pyandtest_parallelism_config.pywith pytest at the pinned commit, then implement one bounded improvement through thedebugging.mdworkflow with fallback and equivalence testsInstall the repository's
requirements.txtfirst: it pinsgrain,datasetsand a git build oftorch_remat. Without them the failures are environmental (a bare environment fails onetest_checkpoint.pycase on a missingdatasetsimport). Do not attempt a wholesale rewrite.
You're done when
Your change passes the CPU suite, beats the baseline on the traced bottleneck at fixed workload with variance, keeps fallback, and names where it loses or does not transfer.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 8 more in the section
- Machine Learning Systems Volume II - Fleet Orchestration and Performance EngineeringML Systems Textbook · primary
Read Scheduling Problem, Orchestration Paradigms, Topology-Aware Scheduling, Elastic Scheduling, Cost Optimization, Multi-Tenancy and Quotas and Debugging Cluster Utilization, then Memory Wall and Roofline Diagnosis, Graph Compilation, Communication-Computation Overlap, System Profiling and Measurement at Scale at https://mlsysbook.ai/vol2/performance_engineering/performance_engineering.html. Use the framework to choose one bottleneck-specific lab and one rollback metric.
- TorchTitanPyTorch · depth
Read
docs/debugging.md(memory snapshots, fake-backend modes, Flight Recorder dumps) and the CPU unit tests undertests/unit_tests/cpu/, then the configuration, metrics, profiling, checkpoint and parallelization seams at a pinned commit. Select one bounded issue or measurable improvement and follow the contribution standards; do not attempt a wholesale rewrite. - Distributed Training Systems LaboratoryRoadmap-Final · support
Complete the capstone with a fixed workload, correctness oracle, analytic plan, fault campaign, aligned traces and one real-code extension. Label CPU simulation, single-GPU evidence and multi-GPU evidence separately.
Also in this section
- AI Systems Performance Engineering - Chapters 1 to 5, 13 and 14Chris Fregly (O'Reilly) · required
Use Chapter 1 for goodput and reproducibility, Chapters 2 to 5 for topology, orchestration, communication, storage and the data pipeline, Chapter 13 for PyTorch profiling and scaling, and the Chapter 14 sections on graph breaks and recompilation. Run only the companion labs for the bottleneck you observe, preserve workload correctness and record hardware assumptions.
- Machine Learning Engineering Open Book - Network, Debug, Training Performance and OrchestrationStas Bekman · required
Use
network/debug/README.md, the hang, crash and OOM sections ofdebug/pytorch.md,training/performance/README.md,storage/README.mdandorchestration/slurm/users.mdas an incident-driven reference. Build one symptom-to-evidence-to-cause runbook rather than reading every page. - PyTorch Flight Recorder TutorialsPyTorch · support
Read the environment-variable Flight Recorder tutorial (trace buffer, dump on timeout,
fr_traceanalysis), then the newer tutorial at https://docs.pytorch.org/tutorials/intermediate/debug_hangs_with_flight_recorder.html, which needstorchcommsand can run on CPU with Gloo. Diagnose one injected hang from per-rank dumps. - MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUsJiang et al. (NSDI 2024) · support
Read the efficiency optimizations, the fault-tolerance loop (heartbeats, diagnostics, fast restart) and the straggler and diagnosis tooling. Its MFU and scale numbers are its own cluster's results.
- Revisiting Reliability in Large-Scale Machine Learning Research ClustersKokolis et al. (2024) · support
Read the failure taxonomy, mean time to failure versus job size and the scheduler-side metrics. Use them to model goodput with failures for one job size.
- How to Scale Your Model - Chapters 1, 5, 9 and 12Google DeepMind · required
Use rooflines, training cost models, profiling workflow and GPU topology to predict the dominant limit of one run. Compare the prediction with a trace and quantify the residual before proposing a change.
- CS336 Assignment 2 (Spring 2026) - Profiling and Parallelism AnalysisStanford University · required
Revisit Section 2 profiling and Section 8 communication analysis. Produce warmup-controlled timing, Nsight or PyTorch traces, memory evidence and analytic DP, FSDP, TP and 2D comparisons on configurations you can execute honestly.
- Ultra-Scale Playbook - Benchmarking ConfigurationsHugging Face · support
Study the configuration-search experiments and Lessons learned on benchmarking as method. Its heatmaps are its own H100 cluster's results; reproduce the method on a tiny legal search space, separating analytic predictions, simulations and measurements.