Skip to content

Conclusions and further reading

The book set out to take a PyTorch engineer from a first tensor on a TPU to a model that trains or serves at scale, with numbers someone else can check. This page puts the 26 chapters back together as one picture, names the few ideas that kept coming back, records where the projects say they are heading, and points to what to read next. For a list of the capabilities to check before you call a TorchTPU deployment ready for production, see the production readiness checklist.

The book as one picture

The book follows one arc of seven stages: run, profile, optimize, train, serve, trust, extend. Each reading order takes the stages its job needs. Each stage ends in a check, and the check is what you carry into the next stage.

Seven grey boxes in one column joined by arrows from top to bottom, in book order. Each box names a stage, its chapters in a dark tag, and one check that ends it. Run, Chapters 1 to 9: Port matches CPU reference. Profile, Chapter 10: Trace has the steps asked for. Optimize, Chapters 11, 12: Targeted signature is gone. Train, Chapters 13 to 16: Loss parity, MFU by hand. Serve, Chapters 17 to 22: SLO met under stated load. Trust, Chapters 23, 24: Parity report fails on injected bug. Extend, Chapters 25, 26: Each gate shown to fail.

The book's seven stages in order, each ending in a check you carry into the next. Each reading order walks the stages its job needs: porting goes from optimize to trust, and serving skips optimize.

Stage Chapters Capability How to confirm it
Run 1 to 7, 8 and 9 Predict costs from the hardware, get capacity, install TorchTPU, port a model Every host passes the same preflight with the same versions and device count; the port matches a CPU reference, its compile count stops growing after warm-up, and its warm step time beats a stated baseline
Profile 10 Capture a steady-state trace and split a step into device time and host-caused gaps The trace holds the steps you asked for, and its median step is within the profiler's overhead of an unprofiled run
Optimize 11 and 12 Name the signature that bounds a step, fix it in a valid order, write a kernel when nothing else works Parity holds, the step time fell measured the same way, and the targeted signature is gone from the next trace
Train 13 to 16 Shard a model over a mesh, train it with FSDP and TorchTitan, post-train it with GRPO on Ray Loss parity against an unsharded reference, MFU computed by hand on a stated convention, weak-scaling efficiency
Serve 17 to 22 Predict prefill and decode floors, run vLLM-TorchTPU and SGLang-TorchTPU, route and operate a fleet with llm-d The measured TPOT sits above its floor by a ratio you can explain, a greedy parity gate passes, and the SLO percentile is met under a stated load
Trust 23 and 24 Write a parity report and a benchmark report another engineer can audit The parity report fails on an injected bug; every benchmark field names its source and every gap is listed
Extend 25 and 26 Add a lowering, a patch or a scheduler plugin; hand a gated workflow to an agent The extension is parity-tested, shown to run on the TPU, and never falls back to the CPU; each gate in the agent pipeline is shown to fail

The order is a dependency order, as chapter 0 promised. Trust comes after train and serve because judging a result needs a result to judge, but its checks were present from chapter 1 onward, in every "Verifying the result" section.

Five ideas that recur

A grid with five rows, Rooflines, Deferred execution and compiles, Tiles and memory, Collectives, and Parity and evidence, against seven columns for Parts I to VII joined by arrows. Each cell holds the chapter numbers that use the idea: rooflines appear in every Part except II, parity and evidence in every Part, tiles and memory and collectives cluster in Parts I, III, IV and V.

Read the rows, not the columns. Parity and evidence is the only idea present in every Part, and rooflines skip only Part II, where the job is to get a model running at all. The empty cells in Parts VI and VII are not gaps: those Parts reuse the earlier ideas as checks rather than teaching them again.

Rooflines

An operation takes at least the larger of its compute time and its memory time, and arithmetic intensity against the ridge point says which one wins (chapter 2). The bf16 ridge is about 560 FLOPs per byte on v6e and about 313 on v7x, so a linear layer needs roughly that many tokens per device before it is compute-bound. The same test recurs in the per-op bounds of XProf (chapter 10), in the ring cost of a collective (chapter 13), in the reason decode is memory-bound (chapter 17), and in the floor placed beside every benchmark (chapter 24). Its two rules held throughout: a measurement below the floor means an input is wrong, and one far above it means time is going somewhere the roofline does not model.

Deferred execution and compiles

TorchTPU turns each op into a deferred op on a host queue, and a background thread compiles and launches the work; the Python thread waits only when it asks for a value. How much is fused into one program before launch depends on the eager mode or on torch.compile (chapter 4). Because XLA compiles for fixed shapes, a new shape is a new program (chapter 7). Most of the practical advice in the book follows from those two facts: count compiles and confirm they stop after warm-up (chapter 9), remove host syncs and recompiles before anything else (chapter 11), bucket tokens and warm every bucket before serving (chapter 18), and exclude compilation by rule when you report a number (chapter 24).

Tiles and memory

Arrays are padded to tiles in their last two dimensions, views can cost a relayout copy, and a partial in-place write can copy a whole storage (chapter 5). On TPU, views can cost and copies can be free, which is the reverse of a GPU habit. Memory came back as the VMEM budget of a Pallas kernel (chapter 12), the per-device bytes of parameters, gradients and optimizer state under FSDP (chapter 14), and the KV cache that limits a server's batch and its context (chapters 17 and 20).

Collectives

Every move between DTensor placements is a collective, TorchTPU compiles collectives into the TPU program rather than calling a separate library, and every rank has to run the same ones or the job hangs (chapter 13). Skinny collectives are safe by default and not overlapped; overlap needs a compiled step and either a promise that the ranks agree (@spmd_safe) or a handshake that checks it. The mesh decides which collectives cross DCN instead of ICI. FSDP is this idea applied to training (chapter 14), and an exposed collective is one of the seven signatures of the playbook (chapter 11).

Parity and evidence

A faster step with a different answer is a regression. Each applied chapter compared against an independent reference, at a tolerance taken from the dtype, the matmul precision and the operation (chapter 6), and Part VI made the rule explicit: a gate that cannot fail proves nothing, so every parity test carries a negative control (chapter 23), and a number is defensible only when it states its workload, hardware, versions, warm-up rule, window, repetitions and units, each with a source (chapter 24). Part VII applies the same gates to the code you write (chapter 25) and to what an agent hands back (chapter 26).

The ideas together, on one run

The Muse Glimmer 30B decode run shows all five at once. The step reads 53.02 GB of weights, so at one device's bandwidth, the reading chapter 17 argues is the likely one, its floor is 14.37 ms per token (rooflines, memory); the case study measured 23.58 ms, so the loop ran at 61% of that bandwidth (chapter 17). The static KV cache reached that time after two compiles, against 24.17 ms after four for the growing cache (compiles, chapter 7). And the remaining 9.21 ms per token stays a list of hypotheses until a trace attributes it (chapter 22): evidence before explanation.

Where the ecosystem is heading

The projects published their plans with the October 2026 launch. Plans are not features: the vLLM-TorchTPU roadmap says its dates are planning targets rather than commitments, and this book does not track which items have since landed. Before relying on one, check the project's own supported-features page. The last column says which chapters to reread when an item ships, because their numbers or advice depend on the current behaviour.

Source What it says comes next Chapters to recheck
TorchTPU team, Introducing TorchTPU (future work, next 6 to 12 months) A library of precompiled dynamic kernels for ATen ops for the "True Eager" experience; bounded dynamism made production-ready so torch.compile handles SymInts without extra recompilation; nested compiler regions to cut compile time; FP8 and FP4 for next-generation TPUs 4, 6, 7
Same post A consensus-based compilation handshake to overlap collectives with compute without @spmd_safe annotations; skinny collectives on a separate stream pinned to SparseCore, expected to recover most of their overhead; collective optimization within and across slices; zero-copy DMA for memory offloading 13, 14
Same post End-to-end RL loops coupling training with vLLM or SGLang sampling through Ray Core; a WebGPU-based Trace Viewer 2.0 and "flight recorder" continuous profiling (XProfz) 10, 15
vLLM-TorchTPU roadmap (last updated October 19, 2026; platform items shared with SGLang-TorchTPU) October: production PyTorch interfaces for all Tokamax kernels, multi-host prefill/decode disaggregation with llm-d, TPU Sync and Managed Lustre KV-cache offloading, the TPU Agent Suite as an experimental release, native Ray integration. November: a 24-hour day-0 model onboarding pipeline, speculative decoding including multi-token prediction, diffusion model serving through vllm-omni, a public nightly CI support matrix. December: DeepSeek V4 readiness; prefix-, cache- and session-aware routing with dynamic length bucketing and llm-d memory-tier routing 12, 18, 20, 26
SGLang-TorchTPU announcement DeepSeek V4.1 Flash and Reflection Beam next, Day 0 TPU support for new open models as the goal from Q1 2027; for the Miles RL preview, multi-host training, weight sync over ICI instead of host shared memory, and parity checks on longer runs 15, 19
TorchTitan integration post (roadmap) ML Goodput Measurement and Multi-Tier Checkpointing on GKE; the float8 recipe extended beyond Llama 3 70B; TPU 8t and 8i support as they reach Google Cloud; expert parallelism for the MoE kernels, then long-context training; larger MoE targets 14, 16, 24
llm-d 1.0 announcement Already shipped, not a plan: 1.0 adds flow control for multi-tenant quality of service, v1 APIs, router high availability, DisaggregatedSet for prefill/decode-aware rolling updates, agent-aware serving (session-aware routing, turn-priority scheduling) and TorchTPU co-operative time-slicing. What comes next is its suggested adoption order: prefix-aware routing in front of an existing vLLM deployment, then flow control, KV cache offload and disaggregation, compared on Prism 20, 21

Read these the way Part VI reads any claim. A roadmap line tells you what to retest, not what to expect: when bounded dynamism changes, rerun chapter 7's compile counts; when skinny collectives move to SparseCore, retake chapter 13's trace before trusting an old scaling efficiency.

Further reading

How to Scale Your Model

Google DeepMind's How to Scale Your Model is the JAX-side companion to this book: the same machine, explained from first principles, with worked problems. Several chapters here build on its ideas, and each links the relevant section. One pointer per part:

Part Read it for Pairs with
0. Introduction Why scaling is a systems problem, and how that book is organized Chapter 0
1. Rooflines Compute, memory and communication bounds from first principles, with more exercises than chapter 2 has room for Chapter 2
2. TPUs The TensorCore, the systolic array, the memory hierarchy and the ICI topology in more depth Chapter 1
3. Sharded matrices Sharding notation and the cost of each collective in a sharded matmul Chapter 13
4. Transformer math Parameter, FLOP and KV-cache counts for a transformer Chapters 16 and 17
5. Training parallelism Data, FSDP, tensor and pipeline parallelism and when each becomes communication-bound Chapters 13 and 14
6. Training LLaMA 3 A worked plan for a real training run Chapter 16
7. Inference Prefill, decode, batching and the latency and throughput trade-off Chapter 17
8. Serving LLaMA 3-70B A worked plan for a real serving deployment Chapter 22
9. Profiling Reading XLA programs and TPU traces Chapter 10
10. JAX JAX's automatic, explicit and manual sharding modes, useful when you compare them with DTensor or read a JAX recipe Chapter 13
11. Conclusions Its authors' own reading list, on TPU architecture, kernel writing, inference arithmetic and the GPU side This page
12. GPUs How GPUs differ from TPUs at the chip, node and collective level Chapters 1 and 3

That book is written for JAX and does not cover TorchTPU. Read its derivations; take the TorchTPU APIs from the chapters here.

Upstream projects and documentation

Project Code Documentation and guides
TorchTPU google-pytorch/torch_tpu TorchTPU documentation (0.2.0), PyTorch on Cloud TPU
vLLM-TorchTPU vllm-project/vllm-torchtpu vLLM-TorchTPU documentation, including the roadmap and the developer guide
SGLang-TorchTPU sgl-project/sglang-torchtpu The repository's README and recipes
TorchTitan google-pytorch/torchtitan The TPU optimization guide
llm-d llm-d/llm-d, llm-d-benchmark llm-d architecture, operations, GKE provider guide, Prism
XProf openxla/xprof Kernel profiling
Pallas and Tokamax openxla/tokamax Pallas, Pallas on TPU
TPU Sync google/tpu-sync The repository's README
Recipes AI-Hypercomputer/tpu-recipes Reproducible TPU recipes referenced by the vLLM-TorchTPU roadmap
GKE TPUs in GKE, training with Ray and TorchTPU, serving with Ray and TorchTPU

Launch posts and talks

The author's TorchTPU posts

Five blog posts by the author cover related ground, each with a single running example.

Post What it adds Related chapters
1. TorchTPU performance: execution modes, XProf and Pallas kernels The TPU mental model applied to one FLUX block, from copies and syncs to a Pallas kernel 4, 10, 12
2. Hugging Face on TPU: Transformers v5, MoE kernels and Diffusers device_map="tpu", static caches, a Kernels Hub MoE kernel and tensor-parallel Diffusers 9
3. vLLM and SGLang on TPU: production serving with llm-d 1.0 Token buckets, KV layouts, speculative decoding and disaggregated KV transfer 17 to 20
4. TorchTitan on Cloud TPU: SimpleFSDP, Graph Trainer, Ray and GRPO Whole-step graph training and GRPO post-training, judged lever by lever 14, 15
5. TPU Agent Suite: onboard, profile and tune PyTorch on Cloud TPU Specialist agents for onboarding, XProf triage and Pallas tuning, and the checks that decide whether to believe them 26

The companion code for every chapter lives in the repository's code/ directory, listed in the Code tab; the Reference tab collects the tables and flags for lookup.

References