Production readiness checklist
Use this checklist before you call a TorchTPU training run or serving deployment ready for production, or when you take over one that someone else built. Each item names an engineering capability, the evidence that shows it is in place, and the chapter that covers it.
An item is met when you can produce its evidence: a report, a trace, a test that passes and a test that fails when it should, a number reproduced from its inputs. Confidence without the artifact does not count. Keep what each item produces (JSON reports, trace directories, test logs) together with the TorchTPU and PyTorch versions and the machine type. That collection is the record of the system and the baseline for the next change.
The areas follow the order of the book, and later areas assume the earlier ones: a claim about MFU or latency means little until the port behind it passes its parity checks.
Foundations
| Capability |
Evidence |
Chapter |
| Know the hardware numbers of the chips you run on |
The expected device count, HBM per device and bf16 FLOP/s per device, recorded before running code/ch01_hardware/hardware_math.py on a TPU VM. The output matches, or the mismatch has a named cause: a factor of 2 means chip and device were confused, about 7% means GB and GiB were. |
1 |
| Estimate an operation's time from the roofline before profiling it |
The bound type and lower-bound time for the default GEMM and for --m 8 --k 8192 --n 8192, recorded before running code/ch02_rooflines/roofline.py on a TPU for both. Neither measurement is below its lower bound, and the ratio of each to its bound has an explanation. |
2 |
| Trace one PyTorch op through the stack |
A description of how an op travels from the dispatcher through a deferred op, StableHLO, the compilation cache, XLA and PJRT to the TPU. For a training step with an if tensor: in it, where the host waits and how the graph splits under DeferAndFuse and under torch.compile, and a torch.where rewrite that gives identical results on the CPU. |
3, 4 |
| Predict the cost of each execution mode |
The order of first-call time and steady-state time for Strict, DeferAndFuse and torch.compile, with the reason for each: Strict has the fastest first call; in steady state torch.compile is fastest, then DeferAndFuse, then Strict. |
4 |
| Account for padding and hidden copies |
For one step of your model, the tensors padded by the tile rule with their padded bytes, and the views or partial in-place writes that cost a copy. Each copy on the list can be found in a trace of the step. |
5 |
| Tell a precision effect from a bug |
code/ch06_precision/excess_precision.py run with the flag False and True, and one bf16 layer of your model compared with the same layer on the CPU. The mul_add values match chapter 6's, the default-precision matmul sits inside the bf16-input bound, and the layer passes at bf16 tolerances or fails only in the "many small mismatches" pattern. |
6 |
| Keep the number of compiled shapes fixed |
Compile counts recorded, before running code/ch07_dynamic_shapes/bucketing.py --cpu-smoke, for ten dynamic=False steps of a growing cache, for dynamic=None, for mark_dynamic(min=16, max=128), and for a static cache over a prefill and 20 decode steps. They match the run (10, 2, 1 and 2), and a decode loop of your own, with a static cache or buckets, stops compiling after warm-up. |
7 |
Running and porting
| Capability |
Evidence |
Chapter |
| Request the right capacity |
For your TPU generation, chip count and job length, the chosen capacity model (flex-start, spot, on-demand, queued resources or a GKE node pool), the quotas checked before the request, and the gcloud command that makes it. |
8 |
| Prove every host sees every device |
TorchTPU installed with the CPU build of PyTorch on a multi-host slice or a GKE node pool, and preflight.py --aggregate printing verdict: PASS with the expected device count on every host. |
8 |
| Run on GKE at both scales |
The TorchTPU examples run as a single-host Job and as a multi-host JobSet, with the meaning of each topology setting in the manifest stated. |
8 |
| Port a model and show the port is correct |
The six-item porting checklist applied to a model you own, with the static scanner finding the lines to change. port_model.py --json (or your own test) records parity against a CPU reference compared like with like, with a gate that fails on a deliberately broken copy; a compile count that stops growing after warm-up and stays fixed under torch.compiler.set_stance("fail_on_recompile"); and a warm median step time against a baseline whose source you record. The largest matmul's measured time is at or above its roofline lower bound. |
9 |
| Run Hugging Face models on TPU |
A model run with device_map="tpu" and a static cache, with the number of times its decode step compiles stated in advance and confirmed. |
9 |
| Attribute a port's speedup |
The FLUX case study's speedup attributed to each optimization in seconds removed, from its step times. The attribution matches the published step times and explains why it depends on sequence length. |
9 |
Profiling and optimization
| Capability |
Evidence |
Chapter |
| Capture a trustworthy trace |
A few steady-state steps captured with torch.profiler and TpuProfilerConfig, warm-up excluded, and the same loop timed without the profiler. The trace holds the steps you asked for, no step is far longer than the rest, and the median is within the profiler's overhead of the unprofiled time. |
10 |
| Read a trace into causes |
For one trace, the fraction of the step the device was idle with each gap attributed to its host-side cause, the top ops by time, and for each a bound type (compute, memory or communication) backed by a roofline estimate. |
10 |
| Make one fix and prove it |
An optimization log for one fix: which of the seven trace signatures bounded the step, the change, step time before and after, parity, and a trace before and after. Parity holds, the step time fell measured the same way and is reported as seconds removed, the signature is gone or smaller, the time removed is about what it took in the trace, and what is now on top is named. |
11 |
| Write a custom kernel when the compiler is the limit |
For an op your trace names, a kernel plan whose double-buffered VMEM footprint and HBM reads you computed from its block shapes and grid order, and a kernel registered with torch.tpu.pallas.jax_op. The plan fits VMEM; the kernel matches the reference in the interpreter (about \(4.8 \times 10^{-6}\) in float32, \(7.8 \times 10^{-3}\) in bf16) and passes verify on the TPU; its custom_call appears in the HLO dump; and the step that contains it got faster by roughly what the op lost. |
12 |
Training at scale
| Capability |
Evidence |
Chapter |
| Reason about placements and collectives |
Every rank's outputs for the collectives in code/ch13_collectives/collectives_demo.py, stated before running it. They match the closed-form answers the demo checks, and the placement change (Shard, Replicate, Partial) each collective performs is named. |
13 |
| Lay out a mesh from collective costs |
The ring time of each collective computed from buffer size, ranks and link bandwidth, and a mesh built with topology_aware_mesh that keeps the heaviest dimension on ICI. A trace shows the collectives taking about as long as the model predicts. |
13 |
| Train sharded with parity |
Per-device FSDP memory computed in advance, a TorchTitan recipe run with command-line overrides, and an unsharded reference from the same weights and batches. The losses agree at every early step, then the gradient norm, at the tolerance chapter 6 gives for the dtype. |
14 |
| Compute MFU by hand |
MFU for chapter 14's Llama 3 8B v6e-8 recipe computed on TorchTitan's convention, reaching the published 33.96%, with numerator and peak both per chip. |
14 |
| Run RL post-training on TPU |
A GRPO loop with Ray actors on TPU devices, with its reward, time split and weight versions checked. A skipped weight sync and a corrupted copy are each caught by the version check. |
15 |
| Judge a published training result |
The Muse Glimmer 30B training MFU reproduced on the \(6N\) convention and on TorchTitan's: 38.6% and 48.80%, with the reason the two cannot be compared as they stand (a different FLOP convention, per chip against per device) and the next experiment the evidence supports. |
16 |
Serving at scale
| Capability |
Evidence |
Chapter |
| Predict serving floors |
The KV cache per token for your model, and the Muse Glimmer 30B decode floor from weight bytes, KV bytes and bandwidth, computed before reading the measurement. The floor comes to 14.37 ms per token on one device's bandwidth, and the measured 23.58 ms is explained: the loop ran at 61% of that bandwidth. |
17 |
| Serve with vLLM-TorchTPU |
Serving flags chosen for your model and slice, with the token buckets and KV capacity they imply computed. Greedy outputs recorded from a build you trust; the parity check passes on the candidate, and the measured TPOT is above your floor. |
18 |
| Measure prefix caching with SGLang-TorchTPU |
Per-turn TTFT and prefix-cache hit rate for a multi-turn workload. Parity passes with a cold and a warm cache, and the --vary-system-prompt control removes the prefix-cache gain. |
19 |
| Deploy llm-d on GKE TPU |
The llm-d resource kinds deployed with node selectors, chip counts and parallelism that match the slice, and requests served through the router. |
20 |
| Operate a fleet against an SLO |
slo_check.py run on per-request records and check_queries.py on your PromQL, with the verdict, the saturation value and the replica count the SLO-aware control law asks for read from the output, and every query you rely on naming a real metric. |
21 |
| Judge a published serving result |
A choice between StaticCache and DynamicCache made on steady-state latency, warm-up cost and restart cost; for the inference case study, a list of what was measured, on what, and what is missing (a trace, prefill time with a warm cache), and the next experiment. |
22 |
Verification
| Capability |
Evidence |
Chapter |
| Choose the right kind of agreement and tolerance |
For each result, the kind of agreement it owes its reference (bitwise, elementwise within a dtype tolerance, statistical over steps, or task-level), the reference you chose and why, and each tolerance derived from the dtype, the matmul precision and the operation, with the measured error beside the bound. |
23 |
| A parity gate that can fail |
code/ch23_correctness/parity.py run on a clean candidate, then bisect_demo.py with a bug injected at block 7. The clean run passes with margins recorded, the injected bug fails and is found at its layer, and the CI log shows the test ran rather than skipped. |
23 |
| Parity for a change to your own model |
A parity report for one change, written before running it. It passes on the clean run with the measured error beside every bound, and the same report fails when you inject a bug (a scaled weight in one layer, a sign-flipped gradient). |
23 |
| A benchmark report that names its sources |
A report rendered with code/ch24_evidence/report.py from a spec filled in before measuring. It states workload, hardware and topology, software versions, warm-up rule, steady window, repetitions and units, each with a source or listed as a gap; it refuses an unsourced field; it puts the roofline floor beside the measurement; it rests on at least three runs; and it calls a difference below \(\max(5\%, 1.645 \times\) combined standard error\()\) a tie. |
24 |
| Check a published performance claim |
One published claim worked through chapter 24's checklist: the FLOP convention behind its MFU, the latency quantile against the SLO's, whether it measured steady state, and whether the improvement clears the noise. |
24 |
Extending the stack
| Capability |
Evidence |
Chapter |
| Put a fix in the right place |
For a gap (a missing op, an upstream function that misbehaves on TPU, a model that does not train yet, a routing policy you want), the repository and extension point that own the fix, and why a fix one layer higher would be a workaround. |
25 |
| Add an ATen lowering |
A lowering in torch_tpu with its registration and op tests against the CPU. The test passes against the reference and fails on revert; missing_op_check.py, run against the registration list dumped from the target environment, reports zero missing ops; the run succeeds with enable_cpu_fallback left at its default; and the repository's CI runs the tests on a TPU. |
25 |
| Patch a serving engine or the router |
A vLLM-TorchTPU patch with the right lifecycle stages and the False-means-retry contract, tested on a CPU and observed in a spawned worker; or an llm-d scorer wired into a scheduling profile whose metrics move. Any performance claim comes last, measured as chapter 24 prescribes against the path it replaces. |
25 |
| Run a gated agent workflow |
An agent-driven onboarding and tuning run with budgets and gates, validated on a laptop first. Every request is schema-valid, each gate (schema, parity, artifact, noise floor) is shown to fail on a broken input, and a speed claim on a parity failure comes back invalid. |
26 |
| Review an agent's hand-off |
Only claims with parity_verdict PASS (module rows under about 3%), baseline_verified true, replicates above your noise floor and a second trace for attribution accepted, and the failure mode of each rejected claim named. |
26 |