Become an AI Expertv2.1
0 of 0 steps Continue
Stage 5 · Depth in one trackChoose one of 14, 15, 16 · from week 17

Module 15: Track B, inference and GPU engineering

Prerequisites and measurable objectives

Prerequisite: Milestone D. Choose one of Modules 14, 15 and 16. By the end of this one you can:

  1. Trace one request through a serving engine end to end and explain where the time goes.
  2. Profile before optimising, form a falsifiable hypothesis (bandwidth- or compute-bound), and write a Triton kernel with a fair benchmark.
  3. Reproduce one serving optimisation (prefix caching or speculative decoding) and measure it.

Primary resource: GPU MODE lectures 1 to 4 (https://github.com/gpu-mode/lectures). Finish it before adding anything from the reading list. Hours: 24 guided, all inside the concept blocks above (the build is one of them); the lab run is counted there too.

Who this track is for

People who like systems, C and C++, and finding out why something is slow. The FAANG MLE post says this end of the barbell has the strongest pay growth, and 2026 posted ranges put inference engineers at the top of the band. 24 hours here, then years.

Concepts, in order

  1. Measure first (4 hours): a benchmark harness for time-to-first-token and tokens per second across batch sizes on one GPU with vLLM, reporting engine version, hardware, TTFT, TPOT, p99, VRAM and output quality. GPU MODE lectures 1 to 4; CS336 lectures 5 and 6. Labs 06 and 12.
  2. Read the engine by file (4 hours): vLLM's V1 scheduler and KV-cache manager, then the engine core's busy loop and step function, then the process split; for SGLang, the mini teaching implementation first. Write a post explaining paged attention from the code.
  3. Kernels (8 hours): Triton first (vector add, then a matmul where memory access matters), CUDA when Triton leaves performance on the table; PMPP chapters 1 to 6 with the GPU MODE recap; CS336 assignment 2: FlashAttention2 in Triton with a speedup against the naive version; enter one GPU MODE leaderboard problem through popcorn-cli. The team that topped that leaderboard started from a proven library for sort, scan, reduce and histogram and hand-wrote only for novel patterns.
  4. Fair benchmarks (2 hours): under a verified protocol, a model's "1.43x faster than PyTorch" became 0.88x; hidden test distributions and library baselines are mandatory for any speedup you publish.
  5. Reproduce an optimisation (5 hours): add prefix caching or speculative decoding to a small from-scratch server and measure; understand acceptance rates and when they collapse; FP8 and NVFP4 claims verified on your own evals.
  6. Distributed basics (1 hour): data, tensor and pipeline parallelism; FSDP; what breaks at 8 GPUs versus 64. CS336 lectures 7 and 8.

Lab

labs/lab06_serving_memory.py and labs/lab12_roofline.py, then reproduce lab 12's batch effect on a real GPU.

Build

Project 15, Track artifact B: the benchmark table; FlashAttention2 in Triton with a fair baseline; a Nsight-backed before/after on one named bottleneck (paged-attention decode, fused RMSNorm, HBM-bound attention at small batch); a GRPO or SFT run where you cut cost by profiling; one merged PR to vLLM, SGLang, llama.cpp, Triton or a quantisation library.

Deliverables: repo with benchmarks, the kernel post, the PR.

Mastery gate

Your speedup survives a hidden test distribution and a library baseline; you place your kernel on the roofline for your reviewer; the PR is merged.

Quiz

  1. Place small-batch decode and large-batch prefill on the roofline and say what each is bound by.
  2. Why start from a proven library for a reduction, and when do you hand-write?
  3. What made the KernelBench speedups disappear under verification?
  4. Compute the crossover batch for a GPU with 990 TFLOP/s and 3.35 TB/s at bf16.
  5. What does speculative decoding trade, and what collapses its benefit?
  6. What fields must a benchmark table carry, and why is one throughput number worthless?

Primary-source reading

Follow-ups

When you finish this module, paste one of these into your assistant. In Claude Code write /aiexpert-tutor before it; in Codex write $aiexpert-tutor.

  1. Ask me to place my kernel on the roofline and explain which wall it hits.
  2. Challenge my speedup with a hidden test distribution and a library baseline.
  3. Quiz me on prefill versus decode and what the KV cache costs at my batch size.