Maps to: Stanford CS 217 Hardware Accelerators for Machine Learning (Winter 2026), Lecture 17 · Tue 03/10/2026 · NVIDIA GPU Architecture for AI, guest lecture by Ronny Krashinsky; the last lecture of the course before the poster session (03/12). Reading: none listed on the schedule.
Basis: The talk and its slides are not public. This lecture is written only from public material:
- NVIDIA’s datasheets and architecture announcements: K40 to B200, the GB200 NVL72 specification page with its footnotes;
- press coverage of Bill Dally’s Hot Chips 2023 keynote (the 1000× decomposition);
- Meta’s Llama 3 paper (the 405B training setup and its MFU).
Published numbers are labelled as such. The experiments use a model written for these notes (
cluster.py):
- GPU generations and a decomposition of their gains;
- collectives on NVLink and InfiniBand;
- serving and 3D-parallel training models that reuse Lecture 11’s GEMM model.
Latencies, overlap factors, power and a few hardware details are assumed and labelled. The course review (§7) recomputes one number from each earlier lecture’s model. Nothing here reflects what was said in class. Code:
code/lecture17/(4 scripts + 1 module; ~2 s in total) Reading time: 2.5 hours including running the code
0. How to read this lecture
0.1 Learning goals
After this lecture you should be able to:
- Trace NVIDIA’s data-center GPUs from Kepler to Blackwell: what each generation added, and how peak, bandwidth, capacity and power grew.
- Decompose a decade of speedup into number formats, specialized instructions (tensor cores) and the rest (process, area, power). Compare this with Dally’s published decomposition.
- Explain why the ridge point rose 75-fold, and what that did to decode versus prefill.
- Estimate collectives in NVLink domains (ring vs in-switch reduction) and over InfiniBand.
- Explain why large scale-up domains (NVL72) change serving and the best training layout.
- Model an LLM training step with 3D parallelism: GEMM efficiency, pipeline bubble, communication, memory, MFU. Compare it with Meta’s published numbers.
- Name the levers left for the next 10× and what limits each.
- Summarize the course: every lever of Lecture 1, where it was applied, and how the architectures studied compare.
0.2 Prerequisites and scope
| Assumed | Introduced here |
|---|---|
| Lecture 1: roofline, energy, levers | a decade of GPU generations; decomposing the gains |
| Lecture 4: FP8, MX, NVFP4 | NVLink domains, in-switch reduction (NVLS), hierarchical collectives |
| Lecture 11: SMs, tensor cores, the GEMM model | tensor/pipeline/data parallelism for training; MFU |
| Lectures 13–16: decode is memory-bound; collectives are latency-bound | rack-scale power; the course review |
0.3 Map
§1 a decade of data-center GPUs ← code 01 (Parts 1, 3)
§2 where the speedup came from, and what is left ← code 01 (Parts 2, 4, 5)
§3 co-designing numerics, architecture and software
§4 scale-up and scale-out for serving ← code 02
§5 training at scale: 3D parallelism ← code 03
§6 rack-scale computers: power and cooling ← code 02 (Part 4), code 03 (Part 4)
§7 course review ← code 04
§8 summary §9 pitfalls §10 exercises §11 further reading §12 where to go from here
0.4 Notation
| Symbol | Meaning |
|---|---|
| TP, PP, DP, EP | tensor, pipeline, data, expert parallelism (degrees) |
| NVLS | NVLink SHARP: reduction inside the NVLink switches |
| m, v | microbatches per pipeline per step; virtual stages per GPU (interleaving) |
| MFU | model FLOPs utilization = model FLOPs / (time × GPUs × peak) |
| α | latency of one collective step |
| ridge | peak FLOP/s ÷ memory bandwidth |
1. A decade of data-center GPUs
Script 01, Part 1 (datasheets, dense):
| GPU | year | process | FP32 | best tensor format | TB/s | GB | W | ridge (best format) |
|---|---|---|---|---|---|---|---|---|
| K40 | 2013 | 28 nm | 4.3 | — | 0.29 | 12 | 235 | 15 |
| P100 | 2016 | 16 nm | 11 | FP16 21 (no tensor cores) | 0.73 | 16 | 300 | 29 |
| V100 | 2017 | 12 nm | 16 | FP16 125 | 0.90 | 32 | 300 | 139 |
| A100 | 2020 | 7 nm | 20 | BF16 312 | 2.04 | 80 | 400 | 306 |
| H100 | 2022 | 4N | 67 | FP8 1,979 | 3.35 | 80 | 700 | 591 |
| B200 | 2024 | 4NP, 2 dies | 80 | FP4 9,000 | 8.00 | 192 | 1,000 | 1,125 |
(TFLOPS, dense.)
What each generation added, from NVIDIA’s announcements:
- Volta introduced the tensor core: a small matrix multiply-accumulate unit (4 × 4 × 4 per tensor core per clock, Lecture 11).
- Ampere added BF16 and TF32 tensor-core formats, 2:4 structured sparsity (2× on paper), and asynchronous copies into shared memory.
- Hopper added FP8 with the “Transformer Engine” (per-tensor scaling managed by software), the TMA (asynchronous tensor copies), thread-block clusters with distributed shared memory, and warpgroup MMA (
wgmma) reading operands from shared memory (Lecture 11). - Blackwell added FP4 (and the block-scaled NVFP4 format, Lecture 4) and two reticle-sized dies acting as one GPU. It moved to fifth-generation NVLink at 1.8 TB/s per GPU and to racks of 72 GPUs in one NVLink domain (GB200 NVL72).

Script 01, Part 3 (relative to the K40):
| GPU | best dense peak | HBM bandwidth | HBM capacity |
|---|---|---|---|
| V100 | 29× | 3.1× | 2.7× |
| A100 | 145× | 7.1× | 6.7× |
| H100 | 461× | 11.6× | 6.7× |
| B200 | 2,098× | 27.8× | 16.0× |
Compute grew ~75× faster than bandwidth: the ridge point rose from 15 to 1,125 FLOP per byte. The memory wall of Lectures 1 and 14 was built one generation at a time.
2. Where the speedup came from, and what is left
2.1 Decomposing a decade
Script 01, Part 2. The best dense peak of a GPU can be written as a product of three factors:
The K40 is the reference because its best format is FP32 on ordinary cores, so the factors do not overlap.
| total | format | tensor cores | FP32 engine | (power) | (silicon) | bandwidth | |
|---|---|---|---|---|---|---|---|
| K40 → V100 | 29× | 1.0× | 8.0× | 3.7× | 1.28× | 1.45× | 3.1× |
| K40 → A100 | 73× | 1.0× | 16.0× | 4.5× | 1.70× | 1.47× | 7.1× |
| K40 → H100 | 461× | 2.0× | 14.8× | 15.6× | 2.98× | 1.45× | 11.6× |
| K40 → B200 | 2,098× | 4.0× | 28.1× | 18.6× | 4.26× | 2.85× | 27.8× |
(B200’s silicon area of 2 × 800 mm² is assumed.)
Dally’s decomposition (Hot Chips 2023, published): a ~1000× gain in single-chip inference performance over about ten years, made of:
- 16× from number representation;
- 12.5× from complex instructions (tensor cores, and instructions that do more work per fetch);
- 2.5× from process;
- 2× from sparsity.
Both decompositions say the same thing. Most of the gain is architecture and number formats; process technology contributes single-digit factors. Our “FP32 engine” factor (19×) mixes process with 4.3× the power, 2.9× the silicon and higher clocks; Dally’s “process” is the per-transistor gain alone.
The lesson of Lecture 1 (the instruction overhead, the energy of a narrower multiplier) turned into a decade of products.
2.2 Prefill vs decode
Script 01, Part 4. One GPU on Llama 3 8B, roofline bounds, weights in the GPU’s best format:
| GPU | prefill tokens/s (compute bound) | decode tokens/s, batch 1 (bandwidth bound) |
|---|---|---|
| K40 | 267 | 9 |
| V100 | 7,783 | 56 |
| H100 | 123,215 | 417 |
| B200 | 560,380 | 1,992 |
From K40 to B200, the prefill bound grew 2,098× and the batch-1 decode bound 222×: 28× from bandwidth, 8× from fewer bytes per weight. Every gain beyond bandwidth and bytes reaches decode only through batching. This is the course’s theme (Lectures 1, 10, 14) in one table.
2.3 What limits the next 10×
Script 01, Part 5 lists the levers with illustrative headroom:
| lever | where it stands | headroom | what limits it |
|---|---|---|---|
| narrower formats | FP4 | ~2× (FP2/ternary) | accuracy (Lecture 4) |
| structured sparsity | 2:4 = 2× on paper | ~2× | models must be sparse |
| process | 2.5× per decade | ~1.3× per generation | cost per transistor |
| power per GPU | 235 → 1,000–1,200 W | ~1.5× | cooling, rack power |
| silicon per GPU | 1 → 2 reticle dies | ~2× per step | packaging, yield, die-to-die links |
| memory bandwidth | 28× per decade | ~1.5–2× per generation | HBM stacks, I/O energy |
| scale-up domain | 8 → 72 GPUs | larger domains announced | copper reach, switch radix, power |
The two levers that delivered most of the past decade are close to their ends:
- number formats: below FP4 little is left;
- specialized instructions: tensor cores already do nearly all the math.
The next 10× is a systems problem: more silicon and power per package, more memory bandwidth, larger and faster scale-up domains, and models co-designed with the hardware’s numerics.
3. Co-designing numerics, architecture and software
The guest lecture’s theme is co-design: no single layer delivers the gains alone.
- Numerics follow the hardware. FP8 training needs per-tensor scales (Hopper’s Transformer Engine). FP4 needs block scales: NVFP4 uses blocks of 16 with an E4M3 scale plus a per-tensor FP32 scale (Lecture 4). Each format is useful only if training and inference recipes keep accuracy. That is work on the model and software side.
- The architecture follows the numerics. Narrower formats multiply the math per byte of operand. That raises the pressure on everything that feeds the tensor cores: register files and shared memory (Lecture 11:
wgmmareads from shared memory, TMA moves tiles asynchronously). It also raises the pressure on the non-matrix units: the exps of softmax (Lecture 6, Lecture 16 §3.4). - Software follows both.
- Kernels must overlap TMA copies, tensor-core math and softmax across warp groups: FlashAttention-3 and -4.
- Compilers and libraries must choose tile shapes and cluster sizes (Lecture 11’s GEMM model).
- Serving and training systems must place tensor, pipeline, data and expert parallelism on the right links (§4–§5).
- Systems follow the models. Mixture-of-experts models need all-to-all traffic among many GPUs. Long contexts need KV-cache capacity and bandwidth. Large dense models need tensor parallelism beyond 8 GPUs. All of this motivated NVLink domains of 72 GPUs.
4. Scale-up and scale-out for serving
4.1 Collectives inside and across domains
An NVLink domain connects GPUs through NVLink switches at ~1 TB/s per GPU (published: 900 GB/s for H100, 1.8 TB/s for Blackwell, counted here as half per direction).
The switches can reduce in the network (NVLink SHARP, “NVLS”): each GPU sends its data once, the switch sums, and multicasts the result back. A ring instead sends each byte twice and takes 2(p − 1) steps. Domains are joined by InfiniBand at 400 Gb/s (50 GB/s) per GPU.
Script 02, Part 1 (ASSUMED step latency 1 µs on NVLink, 5 µs on IB):
| message | 8 × H100 ring | 8 × H100 in-switch | 72 × GB200 ring | 72 × GB200 in-switch | 72 × H100 as 9 servers (NVLink + IB) |
|---|---|---|---|---|---|
| 32 kB | 14.1 µs | 2.07 µs | 142 µs | 2.04 µs | 82.2 µs |
| 64 MB | 263 µs | 144 µs | 282 µs | 73.1 µs | 509 µs |
| 1 GB | 3.9 ms | 2.22 ms | 2.33 ms | 1.11 ms | 6.75 ms |
In-switch reduction removes the latency of large rings: 2 steps instead of 142. Across servers, the 9–18× lower bandwidth and the IB latencies make the same 72 GPUs 3–6× slower on large messages.
4.2 Decoding a 405B model
Script 02, Part 2. Llama 3.1 405B, BF16, 4,096-token context. Each layer streams its weights and KV cache from HBM (85% efficiency, ASSUMED) and does two all-reduces.
| configuration | GPUs | tokens/s per user (batch 1) | tokens/s per GPU (batch 64) |
|---|---|---|---|
| 2 × HGX H100: TP 8 × PP 2 | 16 | 28 | 93 |
| 2 × HGX H100: TP 16 over IB | 16 | 48 | 138 |
| HGX B200: TP 8 | 8 | 65 | 436 |
| NVL72: TP 36 | 36 | 261 | 259 |
| NVL72: TP 72 | 72 | 456 | 170 |

- Pipelining does not speed up one user. A token passes the stages one after another. TP 8 × PP 2 takes as long as TP 8 alone; PP only adds capacity.
- Tensor parallelism does, as long as its all-reduces are cheap. Across servers they cost 6× more (3.06 vs 0.51 ms per token) but still beat pipelining. Inside one NVL72 domain they stay ~2 µs each, and the whole rack serves one user at 456 tokens/s.
- Speed for one user is bought with GPUs. Per-GPU throughput at batch 64 falls from 436 (TP 8) to 170 (TP 72). With 8 KV heads, splits wider than 8 replicate the KV cache, so the KV reads per GPU stop shrinking.
The model first divided the KV cache by 72. Fixing that cut TP 72’s batch-64 speed from 332 to 192 tokens/s per user.
4.3 Mixture of experts
Script 02, Part 3. A DeepSeek-V3-like layer (hidden 7,168, top-8 experts) sends each token’s hidden state to its experts and back, in every MoE layer. For 4,096 tokens per GPU:
- 1.04 ms per layer with expert parallelism 64 on NVL72’s NVLink;
- 18.6 ms across 8 HGX H100 servers over IB.
That is why NVIDIA’s published “30×” NVL72 inference claim is made for a 1.8T-parameter MoE under real-time latency targets, against HGX H100 over InfiniBand (the footnotes on NVIDIA’s page). The comparison mixes GPU generation, numerics (FP4) and the domain size.
5. Training at scale: 3D parallelism
5.1 The three parallelisms
| what is split | communication | where it must run | |
|---|---|---|---|
| tensor (TP) | every layer’s matrices | 4 all-reduces per layer per microbatch (2 forward, 2 backward) | inside the fast domain |
| pipeline (PP) | the layers into stages | point-to-point activations; a bubble of (pp − 1)/(v·m) | across domains is fine |
| data (DP) | the batch | one reduce-scatter + all-gather of gradients per step, overlappable | anywhere, mostly hidden |
5.2 Llama 3.1 405B on 16,384 H100s
Meta’s published layout:
- TP 8 × PP 16 × DP 128;
- 16M-token batches of 8,192-token sequences;
- 38–43% BF16 MFU on 8K–16K H100s.
Script 03, Part 1:
| schedule | step (s) | compute | bubble | TP comm | DP comm (exposed) | GEMM efficiency | MFU | memory per GPU |
|---|---|---|---|---|---|---|---|---|
| 1F1B | 6.63 | 3.14 | 3.14 | 0.28 | 0.05 | 92% | 37.7% | 80.4 GB |
| interleaved, v = 2 | 5.08 | 3.14 | 1.57 | 0.28 | 0.05 | 92% | 49.3% | 80.4 GB |
| interleaved, v = 4 | 4.34 | 3.14 | 0.78 | 0.28 | 0.05 | 92% | 57.7% | 80.4 GB |
- The bubble dominates. With DP = 128 and a 16M-token batch, each pipeline gets only 15 microbatches per step. A 16-stage 1F1B pipeline then idles as long as it computes.
- The model lands in the published range without interleaving and overshoots with it. Its GEMM efficiency (92%, from Lecture 11’s model) and its 15% non-GEMM overhead are not calibrated against Meta’s system. The agreement is partly luck, and we say so.
- The memory estimate says the layout does not fit in 80 GB: the first stage holds 15 microbatches of activations at 34·s·b·d/tp per layer. Real runs recompute more or rebalance stages.
5.3 The domain shapes the layout
Script 03, Part 2 (16,384 GPUs, interleave 2):
| layout | HGX H100: TP comm (s/step) | HGX H100: MFU | NVL72: TP comm | NVL72: MFU | memory per GPU |
|---|---|---|---|---|---|
| TP 8 × PP 16 × DP 128 | 0.28 | 49.3% | 0.14 | 47.3% | 80.4 GB |
| TP 16 × PP 8 × DP 128 | 1.21 | 47.1% | 0.28 | 50.8% | 48.9 GB |
| TP 32 × PP 8 × DP 64 | 3.19 | 34.3% | 0.59 | 44.2% | 24.6 GB |
| TP 64 × PP 4 × DP 64 | 7.20 | 21.4% | 1.17 | 33.4% | 15.6 GB |
On HGX H100, tensor parallelism beyond 8 leaves NVLink, and its all-reduces cross InfiniBand. On NVL72, TP 16–32 stays in the rack. Fewer pipeline stages mean a smaller bubble and less memory per GPU. The best layout depends on the size of the scale-up domain.
5.4 Scaling the cluster
Script 03, Part 3 (fixed 16M-token batch):
| GPUs | H100 (TP 8 × PP 16): microbatches | MFU | NVL72 (TP 16 × PP 8): MFU |
|---|---|---|---|
| 2,048 | 122 | 68.3% | 60.1% |
| 8,192 | 31 | 58.8% | 55.6% |
| 16,384 | 15 | 49.3% | 50.8% |
| 32,768 | 8 | 38.3% | 43.3% |

At a fixed batch, more replicas mean fewer microbatches per pipeline, so the bubble grows. Large clusters need larger batches, which optimization limits, or less pipelining, which a larger domain allows. In this model the bubble, not the network, sets the limit.
6. Rack-scale computers: power and cooling
A GB200 NVL72 rack holds:
- 72 Blackwell GPUs and 36 Grace CPUs;
- 13.4 TB of HBM3E at 576 TB/s, 130 TB/s of NVLink (published);
- liquid cooling.
Its power is reported around 120 kW: we ASSUME 120 kW, i.e. ~1.67 kW per GPU including CPUs, switches and cooling. Power and cooling, not silicon, decide how many such racks a data center can hold.
Script 02, Part 4 (tokens per joule at batch 64, ASSUMED wall power):
| configuration | power per GPU | tokens/s per GPU | joules per token |
|---|---|---|---|
| 2 × HGX H100, TP 8 × PP 2 | 1,050 W | 93 | 11.3 J |
| HGX B200, TP 8 | 1,500 W | 436 | 3.4 J |
| NVL72, TP 8 | 1,667 W | 436 | 3.8 J |
| NVL72, TP 72 | 1,667 W | 170 | 9.8 J |
Energy per token follows bytes moved per GPU-second. Newer GPUs move more bytes per joule, and wide splits that make one user fast cost energy per token.
Script 03, Part 4. Pre-training Llama 3.1 405B on 15.6T tokens (published token count) on 16,384 GPUs with the best layout that fits:
| system | MFU | time to train | energy (ASSUMED wall power) | model FLOPs |
|---|---|---|---|---|
| HGX H100 | 47.1% | ~60 days | 24.8 GWh | 3.96 × 10²⁵ |
| GB200 NVL72 | 50.8% | ~22 days | 14.4 GWh | 3.96 × 10²⁵ |
Meta reports ~3.8 × 10²⁵ FLOPs for this pre-training.
7. Course review
7.1 Every lever, one number
Lecture 1 listed the levers that move a kernel or its roofs. Script 04, Part 1 imports the course’s models and recomputes one result per lever, with the same arguments as the lecture that measured it:
| lever | lectures | measured | result |
|---|---|---|---|
| specialize (cut instruction overhead) | L1, L3, L11 | RISC instruction energy / the 32-bit add it does (45 nm) | 700× |
| use fewer bits | L4, L16, L17 | FP32 MAC / FP8 MAC energy | 4.1× |
| reuse operands in an array | L3, L5, L9 | 128 × 128 WS utilization, M = 1 vs 128 | 0.008 vs 1.00 |
| reuse data in on-chip buffers | L7, L9, L16 | 4096³ GEMM traffic, 64 KiB vs 1 MiB | 3.9× less |
| fuse operators | L10, L12, L13 | attention traffic, unfused / FlashAttention (96 KiB) | 2.8× less |
| hide latency (parallelism, pipelines) | L2, L6, L11 | H100 GEMM 8192³: fraction of peak | 92% |
| compute in space | L12, L13 | Plasticine MLP block: kernels / spatial | 2.56× |
| orchestrate in hardware | L10, L13 | SN40L decode: kernel looping / per-kernel calls | 3.3× |
| compute near memory | L7, L14 | Llama 3 70B GEMV on HBM-PIM vs H100 | 3.7×, 3.2× less energy |
| compute in memory | L15 | INT8-class MVM: digital from SRAM / analog array | 19× less energy |
| balance heterogeneous engines | L6, L16 | Trainium2 prefill shard: serial / parallel engines | 1.35× |
| scale up the fast domain | L8, L16, L17 | 405B, one user: NVL72 TP 72 / 2 × HGX H100 | 16× |
Every lever is about operations and the bytes that feed them:
- specialization and fewer bits cut the cost of an operation;
- reuse, fusion, spatial pipelines and near- or in-memory computing cut the bytes moved per operation;
- parallelism, orchestration and balanced engines keep the units busy;
- scale-up domains extend all of it beyond one chip.
7.2 The architectures of the course
Script 04, Part 2:
| architecture | lecture | organization | peak (16-bit, TFLOPS) | memory TB/s | ridge | on-chip SRAM | wins at |
|---|---|---|---|---|---|---|---|
| NVIDIA H100 | L11 | repurposed: SIMT + tensor cores | 989 | 3.35 | 295 | 50 MB L2 | everything, with mature software |
| Google TPU v4 | L5 | bespoke: systolic arrays + VLIW | 275 | 1.20 | 229 | 160 MiB | large dense matmuls, pods |
| Plasticine | L12 | reconfigurable: patterns in space | 12.3 (FP32) | 0.05 | 240 | 16 MiB | pipelined parallel patterns |
| SambaNova SN40L | L13 | reconfigurable dataflow, 3 memory tiers | 638 | 2.00 | 319 | 520 MiB | fused layers, many models |
| H100 + HBM-PIM (model) | L14 | host + bank-level units | 989 | 13.4 (inside) | 74 | 50 MB | GEMV, low-intensity decode |
| IBM HERMES (PCM) | L15 | analog in-memory crossbars | 63 (8-bit TOPS) | — | — | — | small weight-stationary networks |
| AWS Trainium2 | L16 | 4 engines + software-managed SRAM | 667 | 2.90 | 230 | 224 MiB | cost per token at cloud scale |
| NVIDIA GB200 (per GPU) | L17 | GPU in a 72-GPU NVLink domain | 2,500 | 8.00 | 312 | — | large models across a rack |
The ridge points cluster at a few hundred FLOP per byte, except where the memory moves to the compute (PIM) or the compute to the memory (HERMES needs no weight bandwidth at all).
The organizations differ in who decides what moves where:
- the hardware: GPU caches and warp schedulers;
- a compiler: TPU, Trainium, SambaNova;
- the physics of the array: in-memory computing.
Each wins where its assumption about the workload holds.
7.3 The course in one paragraph
- Lecture 1: arithmetic is cheap and moving data is not, and the roofline tells which one limits a kernel.
- Lectures 2–9 built an accelerator from that principle: HLS and pipelining, SIMD PEs, number formats, systolic arrays, vector units, memories, interconnects and the mapping that ties them together.
- Lecture 10 fused operators and managed memory for LLMs.
- Lectures 11–13 compared three ways of organizing compute: GPUs, reconfigurable dataflow, SambaNova’s RDU.
- Lectures 14–15 moved compute toward and into memory.
- Lectures 16–17 looked at industry’s answers at chip, system and rack scale.
The constant across all of it: LLM decoding is memory-bound on every machine, and it is where the next decade of accelerator design will be decided.
8. Summary
- A decade of GPUs: K40 → B200 grew the dense peak 2,098× but bandwidth only 28×; the ridge point rose from 15 to 1,125 FLOP/byte.
- Where it came from: 4× from formats, 28× from tensor cores, 19× from the FP32 engine (process, clocks, 4.3× power, 2.9× silicon). Dally’s published decomposition gives 16 × 12.5 × 2.5 × 2. Architecture and numerics dominate; process is a single-digit factor.
- Prefill vs decode: the prefill bound grew 2,098×, the batch-1 decode bound 222×.
- What is left: formats and specialized instructions are nearly spent. The next 10× is packages, power, bandwidth, interconnect, and co-designed models.
- Scale-up:
- In-switch reduction makes a 72-GPU all-reduce ~2 µs.
- A 405B model serves one user at 456 tokens/s on an NVL72 (TP 72) vs 28 on two HGX H100 servers.
- Pipelining never speeds up one user.
- MoE all-to-alls need NVLink: 1.04 vs 18.6 ms per layer.
- Training: with Meta’s layout, the pipeline bubble is as large as compute (the model gives 37.7% MFU vs the published 38–43%). Larger domains allow more TP and less PP (51% MFU on NVL72 with TP 16 × PP 8). At a fixed batch, MFU falls as clusters grow.
- Racks: power and cooling set the scale. The model gives 3.4–11.3 J per token for 405B decode at batch 64, and 14–25 GWh to pre-train it.
- The course: every lever reduces the cost of operations or the bytes that feed them, or keeps units busy. Each architecture wins where its workload assumption holds.
9. Common pitfalls
- “Moore’s law did it.” Process contributed single-digit factors to the decade’s 1000×; formats and instructions did most (§2.1).
- “Peak FLOPs tell the story.” Bandwidth grew 75× slower: decode gained 222×, not 2,098× (§2.2).
- “Add pipeline stages to go faster.” Pipelining adds capacity, never per-user speed (§4.2), and it costs a bubble in training (§5.2).
- “TP is always best inside a server.” The best TP degree is the size of the fast domain, which is 8 on HGX and 72 on NVL72 (§5.3).
- “Model MFU that matches a paper validates the model.” Our match came with uncalibrated assumptions that cancel (§5.2).
- “Vendor speedups compare chips.” NVIDIA’s “30×” compares racks, formats and interconnects for one workload (§4.3).
- “Wider TP always reduces per-GPU bytes.” Not beyond the number of KV heads (§4.2).
10. Exercises
Exercise 1 (ridge). Compute the B200’s ridge point for FP4, FP8 and BF16. Which of a decode GEMV (1 FLOP/byte in BF16), a prefill GEMM (~1,000 FLOP/byte) and attention at batch 64 with GQA G = 4 (~4 FLOP/byte) are compute-bound?
Answer
Ridge points: FP4: 9,000 / 8 = 1,125; FP8: 562; BF16: 281 FLOP/byte.
Which kernels are compute-bound:
- the prefill GEMM is compute-bound for BF16 and FP8, and borderline for FP4;
- the GEMV and attention are deeply memory-bound in every format.
Exercise 2 (decomposition). Using the datasheets, decompose K40 → A100 into format, tensor cores and FP32 engine. Why is the format factor 1?
Answer
The factors:
- the A100’s best floating-point dense format is BF16 (312 TFLOPS), equal to its 16-bit tensor rate, so format = 1;
- tensor cores = 312 / 19.5 = 16;
- FP32 engine = 19.5 / 4.29 = 4.5.
Total: 73×.
Why the format factor is 1. Ampere’s narrower formats (INT8, INT4) are integers, which we excluded; its gain came from the tensor cores.
Exercise 3 (decode bound). A B200 serves Llama 3 70B in FP4 at batch 1. What is its decode bound? What if the KV cache of a 32K context is read too (8 KV heads × 128 × 2 × 80 layers, BF16)?
Answer
- Weights: 70.6 B × 0.5 B = 35.3 GB, so 8 TB/s / 35.3 GB = 227 tokens/s.
- KV: 32,768 × 2 × 8 × 128 × 80 × 2 B = 10.7 GB, so 8 / 46.0 = 174 tokens/s.
Long contexts erode the gains of FP4 weights.
Exercise 4 (ring vs in-switch). Derive the 32-KB all-reduce times on 72 GPUs from §4.1’s formulas (900 GB/s per direction, α = 1 µs).
Answer
Ring: 2 × 71/72 × 32 KB / 900 GB/s + 142 × 1 µs ≈ 0.07 + 142 = 142 µs.
In-switch: 32 KB / 900 GB/s + 2 µs ≈ 2.04 µs.
The ring is latency-bound by 70×.
Exercise 5 (pipelining and one user). A 2-stage pipeline holds half the layers on each server. Why is a token’s latency the same as with all layers on one server (same TP)? What does PP buy?
Answer
Same latency. A token must pass stage 1 and then stage 2. Each stage reads half the weights on its own GPUs, so the total time is the same as one server reading all the weights, plus a hop.
What PP buys. Capacity: the model fits. And throughput: with several tokens or batches in flight, both stages work at once.
Exercise 6 (the bubble). With PP = 16 and m = 15 microbatches, what fraction of a step is bubble under 1F1B? With interleaving v = 4? How many microbatches would 1F1B need for a 10% bubble?
Answer
- 1F1B: bubble / compute = 15/15 = 1, so the bubble is 50% of the step (ignoring communication).
- v = 4: 15/60 = 0.25, so 20% of the step.
- 10% of the step (bubble/compute = 0.11): m ≈ 15 / 0.11 = 135 microbatches. With 8,192-token sequences that means 1.1M tokens per pipeline per step, or a 142M-token global batch at DP 128.
Exercise 7 (TP communication). For Llama 3.1 405B (d = 16,384), one microbatch of 8,192 tokens and TP 16, how many bytes does each all-reduce carry, and how long does it take inside NVL72 (in-switch) vs across two HGX servers (hierarchical)?
Answer
8,192 × 16,384 × 2 B = 268 MB per all-reduce.
- NVL72: 268 MB / 900 GB/s ≈ 0.30 ms.
- Two HGX H100 servers:
- an in-switch all-reduce among 8 at 450 GB/s: 0.60 ms;
- plus a 2-server ring over IB on 33.5 MB: 2 × 1/2 × 33.5 MB / 50 GB/s ≈ 0.67 ms;
- total ≈ 1.27 ms.
That is 4× slower, and there are 4 of them per layer per microbatch.
Exercise 8 (KV heads and TP). Why does splitting a model with 8 KV heads 72 ways not divide the KV cache by 72? What would?
Answer
Why not. Each GPU computes some query heads, and needs the KV head of their group. With 72 GPUs and 8 KV heads, each KV head serves 9 GPUs and must be present on each: the cache is replicated 9 times.
What would. Sequence (context) parallelism: split the cached tokens across GPUs and combine partial attention results (Lecture 10’s split-KV decoding).
Exercise 9 (MoE all-to-all). Estimate the all-to-all bytes per GPU of one MoE layer for 4,096 tokens, top-8 experts, d = 7,168, BF16, both directions. Why does EP over IB hurt more for MoE than TP does for dense models?
Answer
Bytes. 4,096 × 8 × 7,168 × 2 B = 470 MB each way. That is ~0.94 GB per layer per GPU, in every MoE layer.
Why it hurts.
- TP all-reduces move one activation tensor per all-reduce, and can be reduced in the switch.
- An all-to-all multiplies the volume by top-k and cannot be reduced: every byte must cross the network.
Exercise 10 (energy). Using §6’s numbers, how many tokens does 1 kWh buy for 405B decode at batch 64 on HGX B200? On two HGX H100 servers?
Answer
- HGX B200: 3.6 MJ / 3.4 J ≈ 1.06 M tokens.
- Two HGX H100 servers: 3.6 MJ / 11.3 J ≈ 0.32 M tokens.
Most of the gap is bytes per joule: HBM bandwidth per watt, and BF16 vs the same model on twice the GPUs.
Exercise 11 (review: the roofline). Using the course’s models, rank these by arithmetic intensity, and say which architecture of §7.2 suits each:
- a prefill GEMM;
- batch-1 decode;
- attention at long context;
- a 1-bit bulk AND;
- a keyword-spotting CNN.
Answer
From high to low intensity:
- prefill GEMM (~1,000 FLOP/B): any of the GPUs, TPU or Trainium;
- keyword-spotting CNN (weights reused across pixels): small on-chip or in-memory arrays (HERMES-like) when weights fit;
- attention at long context (~G FLOP/B): HBM bandwidth, PIM with enough compute (Lecture 14);
- batch-1 decode (~1 FLOP/B): bandwidth, PIM GEMV, or SRAM-resident weights across many chips;
- bulk AND (no arithmetic intensity at all): processing using DRAM rows (Lecture 14).
Exercise 12 (design your own). You have a 1 MW budget and must serve a 400B dense model at ≥ 100 tokens/s per user to as many users as possible. Using §4–§6, outline the system: GPU type, domain size, TP, batch, and the main risk.
Answer
The system.
- 1 MW at ~1.67 kW per GPU is ~600 GPUs, about 8 NVL72 racks.
- §4.2: TP 36 gives ~261 tokens/s per user at batch 1 and ~146 at batch 64. Choose the largest batch that keeps ≥ 100 tokens/s per user. That is around batch 64–100 at TP 36, ~2 replicas per rack.
- Use FP8 or FP4 weights to halve or quarter the bytes, and paged KV memory (Lecture 10).
The main risk is the KV cache at long contexts. It is replicated beyond 8 KV heads, so per-user speed at large batches falls. Mitigations: context parallelism, or KV quantization.
11. Further reading
- NVIDIA, Tesla V100, A100 Tensor Core GPU, H100 Tensor Core GPU architecture whitepapers; Blackwell architecture technical brief; GB200 NVL72 specifications (nvidia.com).
- W. Dally, “Hardware for deep learning”, Hot Chips 2023 keynote; W. Dally et al., “Evolution of the graphics processing unit (GPU)”, IEEE Micro 2021.
- A. Dubey et al., “The Llama 3 herd of models”, 2024 (arXiv:2407.21783), §3.3: training infrastructure, 3D parallelism, MFU.
- D. Narayanan et al., “Efficient large-scale language model training on GPU clusters using Megatron-LM”, SC 2021 (interleaved 1F1B).
- V. Korthikanti et al., “Reducing activation recomputation in large transformer models”, 2022 (arXiv:2205.05198).
- N. Shazeer et al., “Outrageously large neural networks: the sparsely-gated mixture-of-experts layer”, ICLR 2017; DeepSeek-AI, “DeepSeek-V3 technical report”, 2024.
- J. Choquette, W. Gandhi, O. Giroux, N. Stam, R. Krashinsky, “NVIDIA A100 tensor core GPU: performance and innovation”, IEEE Micro 2021; J. Choquette, “NVIDIA Hopper H100 GPU: scaling performance”, IEEE Micro 2023: the designers’ own accounts.
12. Where to go from here
The course ends with the poster session (03/12) and the final report (03/19). The project guide (Lecture 10, §7) describes how to:
- pose a question that one of these models, or a new one, can answer;
- choose an honest baseline;
- report what the numbers do and do not show.
The README of every code folder ends with “Plan vs reality”: the places where our models disagreed with the planned story. Keep that habit. In hardware design, as in this course, the surprises are where the learning is.