Skip to content

Glossary

The terms this book uses, in alphabetical order, each defined as the chapter that teaches it defines it. Follow the chapter link for the mechanism, the numbers and the checks. For llm-d's own definitions see the llm-d API reference.

A

All-gather

The collective that turns a sharded tensor into a full copy on every device: in DTensor terms, Shard to Replicate. FSDP all-gathers each layer's weights before using them. Chapter 13, chapter 14.

All-reduce

The collective that sums partial results and leaves the full sum on every device (Partial to Replicate); on a ring it costs twice an all-gather of the same array. Chapter 13.

Arithmetic intensity

FLOPs per byte moved. Compare it with the ridge point: above it an operation is compute-bound, below it memory-bound. A bf16 linear layer's intensity is roughly its token batch per device. Chapter 2.

B

bf16 (bfloat16)

A 16-bit float with float32's 8-bit exponent and 7 mantissa bits: float32's range with about two to three decimal digits. The MXU multiplies bf16 and accumulates in float32. Chapter 6.

BlockSpec

In a Pallas kernel, the per-operand rule (block shape plus index map) that picks which block sits in VMEM at each grid step. Blocks are double-buffered and must be (8, 128)-aligned or span the array. Chapter 12.

Bounded dynamism

TorchTPU's opt-in support for varying sizes under torch.compile (dynamic=None or mark_dynamic with bounds): one executable per bucket on a 128 grid, inputs padded to the bucket bound, recompiles only outside the range. Chapter 7.

Bucketing

Padding arbitrary lengths up to a few fixed sizes so that only those shapes are compiled, at the price of padding. Serving engines warm every bucket at startup. Chapter 7, chapter 18.

Buffer donation

Letting a compiled program write its output into an input's HBM buffer, so an in-place op stays in place. TorchTPU donates when it can prove it safe; otherwise a partial write copies the whole base storage. Chapter 5.

C

Chip

One physical TPU package. A chip exposes one or two PyTorch devices depending on generation (two on v7x), and per-chip and per-device figures must not be mixed. Chapter 1.

Chunked prefill

Capping the tokens per step (--max-num-batched-tokens in vLLM) so a long prompt is prefilled in chunks that share steps with decode; decode keeps moving at the cost of a slower TTFT for the long prompt. Chapter 17.

Compilation cache

TorchTPU's three-tier cache of compiled executables (process memory, host shared memory, a persistent path such as Cloud Storage), keyed by graph structure, tensor sizes and compile options including the TorchTPU, libtpu and PJRT versions. Chapter 3.

Continuous batching

Keeping a decode batch of fixed maximum size and refilling a slot as soon as its sequence finishes, instead of waiting for the whole batch. Chapter 17.

D

DCN (data-center network)

Host-to-host networking that links slices, far slower than ICI. Put light-traffic parallelism, usually data parallelism, across it. Chapter 1, chapter 13.

Debug mode

The eager mode DEFER_NEVER_AND_LAUNCH_BLOCKING, set with TORCH_TPU_LAUNCH_BLOCKING=1: one op at a time, synchronous, with bounds checks. For debugging only, like CUDA_LAUNCH_BLOCKING. Chapter 4.

Decode

The serving phase that generates one token per sequence per step. It reads every weight each step and is memory-bound until the batch is large. Chapter 17.

DeferAndFuse

The eager mode DEFER_AND_FUSE (TORCH_TPU_DEFER_AND_FUSE=1): ops stay queued until a device-to-host transfer, a synchronize or a detected loop, and then the region is compiled together. Chapter 4.

Deferred op

The host-side record TorchTPU creates for every ATen op, holding a StableHLO builder; it runs at a synchronization point that depends on the eager mode. Chapter 3, chapter 4.

Device

What PyTorch sees and what one process drives. v5e and v6e expose one device per chip, v4 and v5p fuse two TensorCores into one logical device (megacore), and v7x exposes two devices per chip. Chapter 1.

DeviceMesh

A named grid of devices whose axes become process groups. A DTensor placement (Shard, Replicate or Partial) says how a tensor sits on each axis, and changing placement is a collective: all-gather, reduce-scatter, all-reduce or all-to-all. On TPU, take the rank layout from torch.tpu.distributed.topology_aware_mesh, which follows the physical ICI torus. Chapter 13.

DisaggregatedSet

A Kubernetes resource that rolls out the prefill and decode LeaderWorkerSets of a P/D deployment together. Chapter 20.

E

Eager mode

How TorchTPU runs ops outside torch.compile: Strict (the default), DeferAndFuse or Debug. Set it with an environment variable before import torch or with torch.tpu.set_eager_mode. Chapter 4.

EPP (Endpoint Picker)

llm-d's router component, called by the proxy over ext-proc. It filters candidate pods, scores each in [0, 1], and picks the highest weighted sum. Chapter 20.

Excess precision

Keeping float32 intermediates inside a fused program. torch.tpu.allow_excess_precision defaults to False (compiled code rounds like eager) and locks at the first compilation. Chapter 6.

Expert parallelism (EP)

Placing a mixture-of-experts model's experts on different devices; vLLM-TorchTPU pairs it with data parallelism (DP=8, TP=1 on a v7x host) for large MoE models. Chapter 18, chapter 20.

F

Flow control

The EPP subsystem that holds saturated traffic and dispatches it by priority band and fairness, so overload queues in the router instead of the engines. Chapter 21.

FSDP (fully sharded data parallelism)

Each device keeps a shard of every weight, gradient and optimizer state, all-gathers a layer's weights before it runs, and reduce-scatters the gradients back. Judge a sharded run by loss parity, a flat step time, MFU and weak-scaling efficiency (per-chip throughput at \(N\) chips over the baseline, batch per device fixed). Chapter 14.

G

Goodput

Completed requests per second whose TTFT and TPOT both met their SLOs. Chapter 24.

Graph break

A point where a traced graph must stop, such as a host sync or a data-dependent shape; under DeferAndFuse or torch.compile it splits the program. Chapter 4.

Graph Trainer

TorchTitan's TPU trainer that traces forward, loss, backward and optionally AdamW into one program, removing the host gaps that per-block compile leaves. Past about 100B parameters it needs scan over layers (compile.use_scan_layers=True) or the graph splitter. Chapter 14.

GRPO

A reinforcement learning method that uses the group of answers to the same prompt as its baseline; groups whose rewards are all equal give zero advantage. After each update the new weights must be synced to the rollout engine. Chapter 15.

H

HBM

The TPU's main memory, holding weights, activations, optimizer state and the KV cache: 16 GiB on a v5e chip up to 192 GiB on a v7x chip. Host memory, behind PCIe, is about 100 times slower to reach. Chapter 1.

HSDP (hybrid sharded data parallelism)

Sharding within a group (for example one 4x4x4 cube or one slice) and replicating across groups. Choose it when the FSDP group would be wider than the collectives need or the replicate axis maps onto a slow link, and budget for its extra memory. Chapter 14.

I

ICI (inter-chip interconnect)

Direct links between neighbouring chips in a torus, with no switch: 2D on v5e and v6e, 3D on v4, v5p and v7x. Chapter 1.

InferenceModelRewrite

An llm-d resource that rewrites the model name in requests by rule, with weighted targets, for adapter rollouts and traffic splits. Chapter 21.

InferenceObjective

An llm-d resource that gives a workload a priority across one or more pools; requests name it with the x-llm-d-inference-objective header. Chapter 20, chapter 21.

InferencePool

The Kubernetes resource whose label selector, target ports and endpointPickerRef define the candidate pods and the EPP that chooses among them. In Gateway mode an HTTPRoute from a Kubernetes Gateway names it. Chapter 20.

J

jax_op

torch.tpu.pallas.jax_op(name, fn): wraps a JAX or Pallas function as a PyTorch custom op that runs on TPU tensors with no JAX at run time, in eager mode and under torch.compile. Chapter 12.

K

KEDA

The autoscaler llm-d uses: it reads EPP metrics through Prometheus and drives one HPA per Deployment, scaling on demand rather than utilization. Kueue shares a fixed accelerator budget below the autoscalers. Chapter 21.

KV cache

The keys and values of past tokens kept for attention, \(2 \times L \times K \times H \times S \times B\) elements. It often fills HBM before the MXU becomes the limit. Chapter 17.

L

LeaderWorkerSet

A Kubernetes resource that runs a multi-host slice as one unit, created, scheduled and restarted together, with serving on the leader. Chapter 20.

libtpu

The library holding the XLA compiler and the PJRT runtime for TPU; configured with LIBTPU_INIT_ARGS. Chapter 3.

llm-d

A router, KV cache index and flow-control layer in front of a fleet of unmodified vLLM or SGLang engines on Kubernetes. Chapter 20.

M

Materialization point

A call that needs a tensor's value on the host, such as .cpu(), .item(), print(t) or if tensor:. It stalls the host and, in DeferAndFuse, ends a fused region. Chapter 4.

MFU (model FLOPs utilization)

Model FLOPs per second over peak FLOPs per second. Only comparable on one FLOP convention (\(6N\), \(6N\) plus attention, or counted ops) and one unit (per chip or per device); above 100% means a units bug. Chapter 14, chapter 24.

Mosaic

The lower-level compiler IR for custom TPU kernels, beneath Pallas; StableHLO is the higher-level one. Chapter 3.

MXU (matrix multiply unit)

A weight-stationary systolic array, 128x128 before v6e and 256x256 from v6e on, that multiplies bf16 (and fp8 on newer generations) and accumulates in float32. Chapter 1, chapter 6.

P

P/D disaggregation

Running prefill and decode on separate engines and moving the KV cache between them; it pays for long prompts, large models and MoE. On TPU the KV moves over TPU Sync. Chapter 17, chapter 20.

Paged KV cache

KV stored in fixed-size blocks from one pool, with a page table per sequence, so memory follows real length instead of the maximum. Chapter 17.

Pallas

The kernel language for writing custom TPU kernels: a body on refs, a sequential grid and one BlockSpec per operand. Called from PyTorch through jax_op. Built-in alternatives come first: torch.tpu.ops.splash_sdpa (Splash attention), Tokamax; Helion is an experimental alternative language. Chapter 12.

Parity gate

A test that compares a result with an independent reference at a stated, calibrated tolerance. It must include a negative control, a deliberately broken input such as zeroed or sign-flipped gradients that the gate has to fail on; a gate never seen to fail proves nothing. Chapter 23.

PJRT

The runtime interface in libtpu that compiles, launches and copies; TorchTPU hands it executables and buffers. Chapter 3.

Precision (matmul)

How float32 matmuls run on the MXU. TorchTPU's default "medium" (Precision.DEFAULT) is one bf16 pass; "high" is 3 passes and "highest" 6. CUDA's default is "highest". Chapter 6.

Prefill

The serving phase that runs the whole prompt through the model in one step to build the KV cache; usually compute-bound. Chapter 17.

Prefix-cache aware routing

Routing a request to the pod that already holds its prompt prefix in the KV cache. llm-d's approximate index learns from its own decisions; the precise index is built from the engines' KV events. Chapter 20.

PrivateUse1

The PyTorch dispatcher key for out-of-tree backends; TorchTPU registers on it and renames it tpu. With the wheel installed, import torch autoloads TorchTPU; TORCH_DEVICE_BACKEND_AUTOLOAD=0 turns that off. Chapter 3.

R

RadixAttention

SGLang's prefix cache, which stores every cached prefix once in a radix tree and reuses the longest match. HiCache extends it into host memory. Chapter 19.

Ragged Paged Attention

vLLM-TorchTPU's default Pallas attention kernel for MHA and GQA: it packs sequences of any length into one padded step and reads each sequence's KV from its pages. Chapter 18.

Recompilation

A new compile because a shape or guard changed. On TorchTPU torch.compile defaults to dynamic=False, so a new shape is a new compile. Chapter 7.

Reduce-scatter

The collective that sums partial results and leaves each device one shard of the sum (Partial to Shard). FSDP reduce-scatters gradients. Chapter 13, chapter 14.

Ridge point

Peak FLOP/s divided by bandwidth: about 560 FLOPs per byte for bf16 on v6e and about 313 on v7x. Chapter 2.

Roofline

The bound on an operation's time from its FLOPs and bytes: between \(\max(T_\text{math}, T_\text{mem})\) and their sum. Estimate it before profiling and compare. Chapter 2.

S

SGLang-TorchTPU

SGLang's scheduler, API server and RadixAttention over the sglang_tpu plugin, which supplies Pallas attention, KV pools, MoE kernels and the graph runner. Chapter 19.

SimpleFSDP

An FSDP implementation whose collectives are nodes in the traced graph, so XLA can overlap them and there are no staging copies; TorchTPU recommends it over FSDP2. Chapter 14.

Skinny collective

TorchTPU's default way to run a collective: graph breaks around it so it compiles into its own small module. Safe when ranks diverge, but not overlapped with compute. Chapter 13.

Slice

A set of chips connected by ICI, with a fixed shape (topology), carved from a pod, the full preconfigured set of chips. Wraparound links exist only on full-length axes or full cubes. On GKE a one-host slice runs as a Job, a multi-host slice as a JobSet for training (chapter 8) or a LeaderWorkerSet for serving. Chapter 1.

SparseCore

A processor on the chip specialized for sparse work such as gathers, scatters and embedding lookups; the TensorCore can offload to it. Chapter 1.

Speculative decoding

A cheap drafter proposes several tokens and the target model scores them all in one step, keeping the accepted prefix; it turns spare decode compute into tokens. Chapter 17, chapter 18.

spmd_safe

The @torch.tpu.distributed.spmd_safe decorator, which declares that all ranks run identical operations so collectives can be fused into the program instead of run skinny. Chapter 13.

StableHLO

The higher-level compiler IR for ML operations that TorchTPU builds for every op and collective; XLA compiles it for the TPU. Chapter 3.

Static KV cache

A preallocated KV cache with a 0-D length, index_copy_ writes and a mask, so shapes stay static and decode compiles a fixed number of times (StaticCache in Hugging Face). Chapter 7, chapter 22.

Strict mode

TorchTPU's default eager mode, DEFER_NEVER: one op per executable, asynchronous with the host, fastest first result. Chapter 4.

T

Tensor parallelism (TP)

Splitting each layer's matmuls across devices; it divides the weight reads and adds two activation all-reduces per layer. Chapter 17, chapter 18.

TensorCore

The TPU's compute engine, a single-threaded processor with MXUs, a VPU and a scalar unit; the compiler schedules every unit ahead of time. Chapter 1.

Tile padding

XLA lays arrays out in tiles over their last two dimensions, (8, 128) for 4-byte types in this book's model, and pads to whole tiles. Budget padded bytes. Chapter 5.

Tokamax

A library of tuned JAX Pallas kernels for standard LLM and MoE blocks (grouped matmul, paged attention, MLA, TopK and others) that reach PyTorch through jax_op. Check it before writing a kernel. Chapter 12.

TorchTitan TPU lane

The TPU work in Google's TorchTitan fork under torchtitan/experiments/tpu, configured in Python recipe functions and launched with torchrun -m torchtitan.experiments.tpu.train. Chapter 14.

TorchTPU

The PyTorch backend for Cloud TPU (torch_tpu), which plugs into the dispatcher, TorchDynamo and the ProcessGroup API. tpu-info, installed with vllm-torchtpu, plays the role of nvidia-smi. Chapter 3.

TPOT (time per output token)

The average gap between output tokens after the first, an average of one request's inter-token latencies (ITL); its floor is weights plus KV bytes over HBM bandwidth. Chapter 17, chapter 24.

TPU Agent Suite

A router skill, tpu-agent, in front of specialists for cited facts, onboarding, profiling and kernels, with a runtime that validates every request and result. Chapter 26.

TPU Sync

The TPU DMA library both serving engines use to move KV: pages to and from host memory for offload, and chunk by chunk from prefill to decode, resharding between tensor-parallel layouts in flight. Chapter 19, chapter 20.

tpu_dist

TorchTPU's torch.distributed backend (alias "tpu"), which compiles collectives into the TPU program as StableHLO ops; there is no NCCL. Chapter 13.

TTFT (time to first token)

The time from request arrival to the first output token, containing queueing and prefill. Chapter 17, chapter 24.

V

View decomposition

How TorchTPU rebuilds a strided view as slice, reshape, transpose and broadcast ops, because StableHLO values are immutable; some views cost a copy. Chapter 5.

vLLM-TorchTPU

A platform plugin under unmodified vLLM: one worker per device runs the model under torch.compile(backend="tpu") with Pallas kernels as custom ops. Runtime patches of upstream code are declared in its PATCHES registry (chapter 25). Chapter 18.

VMEM

The scratchpad inside each TensorCore that every operand must be copied into before compute: 64 MiB per TensorCore on v7x. Chapter 1.

VPU (vector processing unit)

The unit for elementwise math, activations, norms and reductions, shaped 8 sublanes by 128 lanes, computing float32 in full precision. Chapter 1, chapter 6.

W

Well-lit path

One of llm-d's tested deployment recipes, with Helm charts, Kustomize overlays and benchmarks, each listing its TPU configurations. Chapter 20.

Wraparound

The extra ICI links that close a torus axis. A slice has them only on full-length axes or full cubes; without them collectives take about twice as long. Chapter 1, chapter 13.

X

XLA

The compiler in libtpu that turns StableHLO into TPU programs, planning memory, tiling and fusion around fixed sizes. Chapter 3, chapter 7.

XProf

The profiler and viewer for TPU traces; TorchTPU writes them through torch.profiler with TpuProfilerConfig. Chapter 10.

References

Each definition summarizes the chapter it links to, and that chapter's references give the public documents behind it.