Tutorials
Learn ML systems reasoning through the 22 Systems Walls.
These tutorials teach quantitative reasoning about ML infrastructure using MLSys·im, the first-principles analytical modeling framework behind the Machine Learning Systems textbook. They are organized by the six domains of the 22 Systems Walls taxonomy.
Each tutorial answers one question. Start at the beginning for a guided path, jump to any domain of interest, or open the Textbook & Chapter Map to browse tutorials by textbook chapter, study sheet, and lecture deck.
- Every tutorial runs on a laptop in under 30 seconds. No GPU required.
- Code cells are executable. Clone the repo and run them, or follow along on the website.
- Every walkthrough pairs first-principles formulas with live solver output. Compare analytical bounds directly against evaluated system profiles.
- Tutorials within a cluster build on each other, but clusters are largely independent.
- Time estimates cover reading the walkthrough and running the code cells.
Start Here
Before starting any domain, complete this introduction to the roofline model.
Beginner
0 · Hello, Roofline
Question: How do I predict whether my model is memory-bound or compute-bound?
Five lines of code give one answer. Every later tutorial builds on it. ⏱ ~10 min
Cluster 1: Node (Walls 1–7)
One accelerator, one model. Where is the ceiling?
These tutorials explore the walls that constrain a single accelerator: compute throughput (Wall 1), memory bandwidth (Wall 2), software efficiency (Wall 3), two-phase serving (Wall 4), KV-cache batching (Wall 5), weight streaming (Wall 6), and tail-latency queueing (Wall 7). Understanding which wall binds, and why, is the most fundamental skill in ML systems reasoning.
Beginner
1 · The Memory Wall
Question: Why does 3.2× more FLOP/s not give a 3.2× speedup?
Compare A100 → H100 and discover that for LLM inference, bandwidth (1.6×), not compute (3.2×), is the binding constraint. The most important fallacy in ML systems. ⏱ ~15 min
Intermediate
2 · Two Phases, One Request
Question: Why is LLM serving fundamentally different from CNN inference?
The same model on the same GPU hits two different ceilings: prefill is compute-bound, decode is memory-bound. This is why LLM serving requires its own analysis. ⏱ ~15 min
Intermediate
Cluster 2: Data (Walls 8–10)
The GPU is fast. Is the pipeline faster?
Even the fastest accelerator sits idle if the data pipeline cannot keep up. These walls cover ingestion (Wall 8), transformation (Wall 9), and network locality & topology (Wall 10).
Intermediate
4 · Starving the GPU
Question: Why is my GPU utilization only 21%?
A100 compute takes 13.5 ms per step, but the CPU augmentation pipeline requires 64 ms. The binding constraint is JPEG decoding, not silicon. ⏱ ~15 min
Cluster 3: Algorithm (Walls 11–13)
Can I make the model smaller or the training cheaper?
These walls govern scaling laws (Wall 11), inference-time reasoning (Wall 12), and compression and quantization fidelity (Wall 13).
Intermediate
5 · Quantization: Not a Free Lunch
Question: Does INT4 always give 4× speedup?
For memory-bound decode: up to 4× (3.88× with group-128 scales). For compute-bound weight-only GEMMs: 1.0× (no speedup). The regime determines whether quantization accelerates execution, and the roofline identifies which regime applies. ⏱ ~20 min
Cluster 4: Fleet (Walls 14–16)
Scaling past one machine. Where does efficiency go?
Distributed training introduces three fleet-level walls: collective communication (Wall 14), hardware fragility and reliability (Wall 15), and multi-tenant queueing (Wall 16).
Intermediate
Distributed Training: 3D Parallelism
Question: How do data, tensor, and pipeline parallelism divide memory and communication?
Compare DP, TP, and PP side by side on a multi-node cluster, diagnose pipeline bubbles, and let ParallelismOptimizer find the optimal 3D split. ⏱ ~20 min
Advanced
6 · Scaling to 1000 GPUs
Question: Where does my training efficiency disappear at scale?
At 1024 GPUs over a 30-day run, AllReduce communication consumes 268 hours of wall-clock capacity while cluster MTBF drops to 36.6 hours, costing another 35 hours in Young-Daly checkpoint writes and rollback recovery. ⏱ ~20 min
Cluster 5: Ops (Walls 17–20)
What does it cost, in dollars, carbon, and water?
Operational walls cover capital TCO (Wall 17), sustainability (Wall 18), checkpoint I/O (Wall 19), and privacy & safety (Wall 20). These are the walls that determine whether a technically feasible system is actually deployable.
Intermediate
7 · Geography is a Systems Variable
Question: Does it matter where I train?
Same 256-GPU cluster, same model, same duration: 167.2 tonnes CO₂ in Poland vs. 2.7 tonnes in Québec (62.0 tonnes US average). A 41× grid carbon-intensity gap (61× with PUE) from geography alone. ⏱ ~15 min
Intermediate
8 · The $9M Question
Question: How much does chain-of-thought reasoning actually cost?
K=8 reasoning steps multiply per-query latency and fleet cost by 7.7×, scaling annual 100-QPS serving TCO from $2.8M to $18.3M for Llama-3.1-70B (and from $57M to $442M for unsharded GPT-4). A seemingly simple algorithmic choice becomes a capital expenditure decision. ⏱ ~20 min
Cluster 6: Analysis (Walls 21–22)
Cross-cutting diagnostics. Which knob matters most?
These walls provide the tools for sensitivity analysis (Wall 21) and synthesis (Wall 22): the ability to ask “what if?” and “what must be true?”
Advanced
9 · Where to Invest: Sensitivity Analysis
Question: Should I buy more FLOPS or more bandwidth?
\(\partial \ln T / \partial \ln \text{BW} = \-0\.91\) vs. \(\partial \ln T / \partial \ln \text{FLOPS} = 0\.00\). For Llama-3.1-8B decode on NVIDIA A100, a 10% bandwidth increase cuts latency by 9.1%, while more compute yields 0.0%. Then use inverse Roofline to derive the 2.8 TB / s bandwidth floor from a 50 ms SLA. ⏱ ~20 min
Advanced
10 · GPU vs. Wafer-Scale
Question: Can a fundamentally different architecture change which wall binds?
Cerebras eliminates the HBM memory wall entirely, but the binding constraint shifts to injection bandwidth. The result is a qualitative regime change, not only a speedup. ⏱ ~20 min
Advanced
11 · Training Memory, Serving Capacity, and MoE
Question: What should I check after the roofline says a design is plausible?
Break training memory into components, turn QPS and P99 into a first-pass replica count, and model MoE hot-expert imbalance as a bandwidth sensitivity. ⏱ ~25 min
Advanced
12 · Design Space Exploration
Question: How do I search for the best architecture without writing nested loops?
Learn to use the declarative DSE Engine to navigate complex ML trade-offs and filter configurations based on SLA constraints. ⏱ ~20 min
Cluster 7: Capstone
Compose everything. All 22 walls, one analysis.
Advanced
13 · Full-Stack Audit: LLaMA-70B Training
Question: What does a complete systems analysis look like?
Trace LLaMA-70B training through all six domains: Node → Data → Algorithm → Fleet → Ops → Analysis. Twelve of the 22 walls exercised in one coherent analysis. ⏱ ~30 min
Extending MLSys·im
Intermediate
The Differential Explainer
Question: How do I automatically explain why a hardware upgrade did not work?
Learn to use the Differential Explainer to compare two configurations and generate a human-readable explanation of Regime Shifts. ⏱ ~10 min
Developer
Custom Solvers & Hardware
Learn to contribute new hardware specifications to the Silicon Zoo or build custom analytical solvers using the 6-layer architecture. ⏱ ~15 min
Developer
Composable Pipelines & Callbacks
Learn how to add custom analytical solvers to the MLSys·im Pipeline and use middleware hooks to log data to external MLOps platforms. ⏱ ~15 min
Learning Paths
Choose a path by role:
Path A: First-Time Learner (~ 2 hours)
“I’m new to ML systems and want to build intuition from scratch.”
0 → 1 → 2 → 3 → 4 → 5 → 7 → 13
Why this order: Start with single-node physics (roofline, memory wall, two phases), understand the KV-cache memory constraint that dominates LLM serving, see the data pipeline bottleneck, understand quantization regimes, learn that geography matters, then compose it all in the Full-Stack Audit capstone (13). Distributed parallelism and Tutorial 6 (reliability) can be explored next.
Path B: ML Engineer (~ 2.5 hours)
“I deploy models in production and need to make hardware decisions.”
0 → 1 → 2 → 3 → 8 → 9 → 12 → 13
Path C: Researcher (~ 2.5 hours)
“I evaluate hardware architectures and need quantitative tools.”
0 → 1 → 5 → 9 → 10 → Distributed → 6 → 11 → 12 → 13
Path D: Conference Tutorial (90 min)
“I’m attending a live tutorial at ISCA / MLSys / ASPLOS.”
| Time | Tutorial | Core Message | Format |
|---|---|---|---|
| 0–15 min | 0. Hello, Roofline | The equation, the tool, the regime | Live coding, audience predicts |
| 15–35 min | 1. The Memory Wall | Why 3.2× FLOPS ≠ 3.2× speedup | Live coding, audience verifies |
| 35–45 min | Break + Q&A | ||
| 45–60 min | 9. Sensitivity | Bandwidth dominates compute in decode | Live coding + derivation |
| 60–75 min | 6. Scaling to 1000 GPUs | Communication and Young-Daly reliability compound | Pre-computed results, discussion |
| 75–85 min | 13. Full-Stack Audit | Composing all six domains | Summary table walkthrough |
| 85–90 min | Where to learn more | Follow-up walkthroughs and resources |
Why 5 tutorials, not 8: Each tutorial needs enough time for the predict-compute-reflect cycle to land. Tutorials 2, 5, and 7 provide self-paced follow-up walkthroughs after the session.
Path D+: Half-Day Workshop (3 hours)
“I’m attending a half-day conference tutorial.”
The full numbered tutorial sequence with live code walkthroughs, combining the conference path with Tutorials 2, 3 (KV-Cache), 5, 7, 10 (Wafer-Scale), and 12 (DSE), with 15-minute breaks between clusters.
All tutorials are Quarto-compatible. Run them locally after
pip install mlsysim, or browse the rendered versions on this website.