Unit 11 of 11 · about 2 hours · implement
Versioned regression gates, fallback and rollback
An integrated kernel needs a gate that catches regressions and a rollback that restores service. Otherwise the first bad revision ships.
You'll be able to
- Implement a versioned regression gate with fallback and rollback for one integrated path.
- Distinguish a real regression from noise with raw samples and uncertainty.
Covers
Read
In this order, only the parts listed
0 of 2 done
- CI gates and production monitoringAI Systems Performance Engineering - Chapters 13, 15 and 16
Chapter 13, Continuous Integration and Performance Benchmarking; Chapter 16, Monitoring System Metrics and Counters
- Versioned expectations harnessAI Systems Performance Engineering companion code - Chapters 12 to 16
expectations_2x_b200.jsonandexpectations_b200.jsonin the chapter directories, refreshed with--update-expectations;BenchmarkConfigwith iterations and warmup incompare.py; validity profiles in chapter READMEsThe shipped expectations are B200 and GB200 numbers. Record your own baseline on your GPU before gating, and never refresh it to absorb a regression.
Focus on
- Version every gate: code revision, model and tokenizer identity, config, hardware and toolchain, workload seed and tolerances. A gate without versions cannot roll back.
- Gate on correctness and quality first, then on TTFT, TPOT, memory and goodput with uncertainty. A statistically resolved but practically useless gain stays out.
- Keep fallback automatic and rollback one command: unsupported shapes route to the eager path, and a failed gate restores the last passing revision with its data.
Common mistakes · 3
- Gating only on mean latency. Tails, memory and quality regress first; gate them with their own budgets.
- Updating expectations to match a regression. Expectations change only after validating new hardware or a declared policy change.
- Testing rollback without a drill. An untested restore command fails when it is needed.
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 versions does a regression gate pin?Answer
Code and model versions, config, hardware and toolchain, workload and seed, tolerances and budgets. Without them a rerun is a different experiment.
2.Does routing to fallback forgive a regression?Answer
No. Fallback keeps serving correct while the gate stays red and the rollback restores the last passing revision. Silent fallback without a gate hides the regression.
3.When does a timing difference count as a regression?Answer
Only with raw samples, sample counts and an uncertainty method that respects pairing and drift. A best-run comparison proves nothing.
You're done when
A seeded defect trips the gate, fallback serves correctly, and one rollback command restores the last passing revision with evidence retained.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 12 more in the section
- AI Systems Performance Engineering - Chapters 13, 15 and 16Chris Fregly · primary
Read Chapter 13 on profiling and tuning PyTorch, Chapter 15 on inference parallelism, decoding and routing, and Chapter 16 on profiling and debugging inference. Keep Chapters 17 to 19 for GPU-9 and depth.
- AI Systems Performance Engineering companion code - Chapters 12 to 16Chris Fregly · required
Use compatible examples from
code/ch12throughcode/ch16. Trace whether each optimized path changes a kernel, graph, compiler choice, scheduler or library dispatch, then integrate one bounded custom path into a realistic operator or small endpoint.
Also in this section
- AI Performance Engineering - Inference EnginesWafer · reference
A curated index. Use Section 4 only to find the introducing paper and implementation for the mechanism your measurement points to.
- PagedAttention and vLLMvLLM Authors · required
Study block-based key-value allocation, sharing and scheduling interaction. Trace logical token positions to physical blocks in one engine run and quantify fragmentation and memory-capacity effects.
- SGLangSGLang Authors · support
Read the runtime and RadixAttention design, then inspect the repository path for one kernel or prefix-reuse interaction. Use it as an alternative architecture in the integration defense.
- LeetGPU - Inference Kernel SetAlphaGPU · required
Choose three bottleneck-matched challenges from 74 GPT-2 Block, 83 Fused Residual Add RMS Norm, 84 SwiGLU MLP Block, 87 Speculative Decoding Verification, 93 Llama Transformer Block and 96 INT8 KV Cache Attention. Integrate one result locally rather than stopping at the hosted submission.
- FlashInferFlashInfer Project · support
Use the repository as the serving-kernel baseline and interface reference. Reconstruct workspace planning, layouts, dispatch and stream behavior for one selected operation before comparing your path.
- GPU Microbenchmark and Kernel Suite - IntegrationRoadmap-Final · support
Complete the real tensor or model-operation integration, dispatch and fallback requirements. Report compilation and invocation overhead, workload frequency, correctness or quality and the end-to-end no-benefit regime.
- PyTorch 2.14 ProfilerPyTorch · reference
Read the Overview example plus the API reference for
torch.profiler.profile(activities,schedule,on_trace_ready,record_shapes,with_stack),torch.profiler.record_functionandexport_chrome_trace. Use it for exact profiler and NVTX-range call contracts missing from the book. - Orca (OSDI 2022)USENIX · support
Read Sections 3 to 4 for iteration-level scheduling and selective batching, and Section 6 for the engine microbenchmark and end-to-end latency-throughput method. Use it as the continuous-batching mechanism behind the book summary.
- Sarathi-ServearXiv · support
Read Sections 3 to 4 for chunked-prefill stall-free batching and token-budget selection, and Section 5 for capacity and overhead method. Use it as the chunked-prefill mechanism behind the book summary.
- Fast Inference from Transformers via Speculative DecodingPMLR · support
Read Sections 2 to 3 for the draft-verify-accept loop, the acceptance rule and the walltime-versus-operations analysis. Use it for the verification cost model behind the engine guides.
- vLLM Documentation - Automatic Prefix CachingvLLM Project · reference
Read Automatic Prefix Caching (vLLM v0.31.0) for hash-based block reuse, full-block caching, reverse-order freeing and the multimodal hashing example. Use it for engine behavior the papers do not version.
- Transformer Inference ArithmeticKipply · reference
Read kv cache, capacity, latency calculations, batch sizes and flops counting for per-token KV bytes, weight-capacity arithmetic and memory-bound versus compute-bound latency floors. Use it to derive endpoint bounds before measuring.