The idea in one sentence. Every decode step reads all the model's weights to produce one token per user, so serving is the craft of putting as many users as possible on each read of the weights, while their KV caches fit in the memory left over and each user's latency stays inside its promise.
The running example. A chat assistant built on Llama 3.1 70B (70.6 billion parameters, 80 layers; config.json, an open mirror of Meta's gated repository), stored in FP8 (one byte per weight) on NVIDIA H200 GPUs (141 GB of memory at 4.8 TB/s, NVIDIA). Every request carries a 2,000-token prompt whose first 1,000 tokens are the same system prompt, and gets a 300-token answer. It is the deployment the Capacity planner opens with, so every number here can be checked there, and the children reuse it. A token is the unit the model reads and writes, about three quarters of an English word on average.
Fig. 1 is the page: one request's path through a serving fleet, each part lit where it acts, with the child page that owns it.
A map, not a mechanism: each step lights the part one child page owns and links that child's own figure. Judged on: time to first token, time per output token, goodput under a latency promise, and dollars per million tokens (LLM serving in production, section 1). This page's Capacity planner computes all four for any model and GPU; its Serving simulator runs the engine box; its Engine bench measured real engines. Counts drawn (three replicas, eight layer plates, the blocks, the users) are illustrative; the bar heights in step 3 are the page's numbers to scale.
You need (only if new to you): why a KV cache exists at all, recompute the prefix against keep it, on The transformer from zero (section 9); FLOPs and bytes per token on Performance math. Everything else is defined here.
Times are derived from the Capacity planner's step model for this deployment (step time = the larger of bytes read / (bandwidth × 0.8) and FLOPs / (FP8 peak × 0.345), plus 2.5 ms; the two efficiencies are fitted to MLPerf runs on that tab). Prefill and decode are drawn on different time scales: the 299 decode steps after the first token take about 15 times as long as the prefill.
A language model returns a probability for every token in its vocabulary (128,256 for Llama 3.1) being the next one. To answer, the server calls it, picks one token (the sampler, Sampling and decoding), appends it and calls it again: autoregressive decoding, one token at a time, each depending on the last. Prefill reads all 2,000 prompt tokens through all 80 layers in one pass and stores every token's key and value vectors (the KV cache); decode then feeds only the newest token, which attends to the cache and adds its own entry. Fig. 2 follows the running example alone on one H200:
Five numbers describe everything that follows: two that a user feels, one the owner pays for, one that runs out, and the bill.
Time to first token: queueing plus prefill.
Time per output token after the first (inter-token latency, ITL, is one gap): 46 tokens a second, faster than anyone reads.
Output tokens per second for the GPU: one user alone, against 141 users decoding together (section 5).
What each token of each active conversation holds (section 4); it decides how many users fit.
Blended over input and output at $4.47 per H200-hour (section 6).
All five are derived for the running example by the Capacity planner; the same quantities measured here on a laptop are on the Engine bench. Exact definitions (TPOT as (end-to-end latency − TTFT) / (output tokens − 1), percentiles, goodput) are on LLM serving in production, section 1. Each token is detokenized and streamed as soon as it exists, usually as server-sent events (Streaming and real-time); the request ends at an end-of-sequence token or max_tokens, and its cache is freed.
One pass through the 80 layers, drawn in 8 groups of 10. Bytes, operations and time are derived from the Capacity planner's step model (weights 72.66 GB in FP8; KV cache read at the token's position; efficiencies 0.8 of bandwidth and 0.345 of FP8 peak, plus 2.5 ms per step). The busy bar is operations / (peak × 0.345) over the step time.
A GPU has two budgets: arithmetic per second and bytes read from memory per second. One H200 does 1,979 trillion FP8 operations per second but reads only 4.8 TB/s, so it can do 412 operations in the time it reads one byte 1,979 / 4.8. Work below that ratio (its arithmetic intensity) is memory-bound; above it, compute-bound (the roofline: Performance math). Each weight does one multiply and one add per token. A decode step has one token per user, so the chip reads all 72.66 GB of weights for 2 operations per byte: the arithmetic idles more than 99% of the time and the step lasts as long as the read, 21.6 ms. Prefill shares one read among 2,000 tokens, 3,956 operations per byte: compute-bound, 423.5 ms, about 0.2 ms per token, a hundred times cheaper per token than decoding.
The split shows on any hardware: on the laptop measured here, Qwen3-0.6B reads a 512-token prompt at 3,240 tokens per second and generates at 196, 17 times slower measured here (Engine bench). The ratio is larger on a datacenter GPU because arithmetic has grown faster than bandwidth: the M1 Pro does about 30 operations per byte read (5.0 TFLOP/s over 165 GB/s, measured on Topic: hardware), the H200 412.
| Regime | Bound by | Typical workload | What helps |
|---|---|---|---|
| Prefill | arithmetic | long prompts, short answers (retrieval, classification, summarisation) | faster arithmetic (FP8, FP4), prefix caching, chunking so it does not stall others |
| Decode | memory bandwidth | chat and reasoning with long answers | more users per read (batching), fewer bytes (quantisation), more tokens per read (speculation) |
| Decode at batch size 1 on a small or fast model | fixed cost per step: launching hundreds of kernels and scheduling | one local user; latency-critical single streams | fewer launches: CUDA graphs, fused kernels, a decode megakernel |
Name the regime before choosing a fix. The third is easy to miss: on the laptop the fixed cost was 2.18 ms of a 5 ms Qwen3-0.6B step measured here, and the planner charges 2.5 ms per H200 step; fewer bytes do not help there. To check where you are, measure prompt-processing and generation speed separately (llama-bench reports pp and tg; vLLM's benchmark reports TTFT and TPOT); if single-stream tokens per second times bytes read per token is close to the memory bandwidth, decode is at its roofline (on this M1 Pro, rated 200 GB/s, plain decode of Qwen3-1.7B in F16 reached 187 GB/s, Local and on-device inference, section 1) and only fewer bytes or more users per read will help.
Each technique in this topic attacks one of the limits of section 2 (decode's idle arithmetic, the memory the cache needs, prefill's arithmetic, the fixed cost per step) or a limit of the fleet (traffic, latency promises, many models). Read across a row for the trade; follow the last column for the mechanism.
| Lever | Attacks | Buys | Costs | Owner |
|---|---|---|---|---|
| Continuous batching | decode's idle arithmetic | throughput: 64 users give 42 times the tokens per step on the H200 model | every user's step gets a little longer | Batching, section 1 |
| Paged KV cache | cache memory reserved but empty | more users per GPU (old slab allocators used only 20.4% to 38.2% of it for tokens) | a block table to follow; preemption when blocks run out | Batching, section 2 |
| Prefix caching | prefill of a prompt seen before | TTFT: 1,426 ms to 77 ms on a shared prefix, measured here | memory held by cached blocks; the request must reach the replica that holds them | Batching, section 3; SGLang, section 2 |
| Offload tiers | cache memory on the GPU | a larger cache in CPU memory or SSD, restored on a hit | transfer time on every restore | Batching, section 4 |
| Chunked prefill | a long prompt freezing everyone's stream | smooth TPOT | a slightly later first token for the long prompt | Batching, section 5 |
| Admission, preemption, priorities | memory that runs out mid-answer; tenants that compete | a server that degrades instead of failing | work thrown away and recomputed | Batching, sections 6 and 7 |
| KV cache in 8 or 4 bits | cache memory | twice or four times the tokens per GB | quality, model by model | Batching, section 8 |
| Weight-only 8 or 4 bits | decode's bytes | faster decode, smaller GPUs | quality, larger on small models; prefill no faster | Local inference, sections 4 and 5; Quantization and Precision |
| FP8 or FP4 weights and activations | prefill's arithmetic and decode's bytes | both phases faster | needs Hopper, Blackwell or MI300-class tensor cores; calibration | Quantization and Precision |
| Speculative decoding | decode's idle arithmetic at small batch | several tokens per read of the weights | the gain shrinks as the batch grows | Speculative decoding |
| CUDA graphs, fused kernels | the fixed cost per step | small-batch latency | capture time at start-up; per-model engineering | CUDA graphs; Writing kernels |
| Replicas and prefix-aware routing | traffic beyond one copy; cache misses | throughput in proportion to copies; cache hits | a router that weighs cache against load | Production, section 2 |
| Tensor parallelism | weights that do not fit; latency | bigger models, each GPU reads 1/n of the weights | NVLink-class links; one server | Distributed serving, section 3 |
| Pipeline and expert parallelism | capacity across servers; huge mixture-of-experts models | models larger than a server | idle stages; uneven experts; all-to-all traffic | Distributed serving, sections 4 and 5 |
| Prefill and decode on separate GPUs | the two phases slowing each other | control of TTFT and tail inter-token latency | moving the cache; two pools to balance | Distributed serving, sections 6 and 7 |
| Autoscaling, warm replicas | traffic that rises and falls | a bill that follows the traffic | cold starts of tens of seconds to minutes | Production, sections 3 and 4 |
| Multi-LoRA | many fine-tunes of one model | one base model serves them all in one batch | batching rules per engine; adapter loading | Production, section 5; vLLM, section 5 |
Figures: the batching gain is derived from the Capacity planner (section 5); the slab waste is from PagedAttention, Fig. 2; the prefix-caching times are llama.cpp on Qwen3-1.7B with a 1,500-word shared prefix (vLLM's CPU backend went from about 6.7 s to under 1 s) measured here (Engine bench, "Prefix caching").
Along the frontier or outward. Baseten's framing is the test for any of these: batch size, quantisation level or speculation settings move a deployment along the latency-throughput frontier, while better kernels, cache management or architecture push the frontier outward (Baseten, 2026-09-02). Only the second is a free win.
Every token of every active conversation keeps one key and one value vector in every layer:
For Llama 3.1 70B that is 2 × 80 × 8 × 128 × 2 = 327,680 bytes, 320 KiB per token, so one 2,300-token conversation holds 719 MiB 2,300 × 320 KiB. The formula matches a real engine: for Qwen3-0.6B it gives 114,688 bytes, exactly what llama.cpp allocated measured here (448 MiB at 4,096 tokens, Engine bench). On one H200 with FP8 weights, vLLM's default 92% of 141 GB leaves about 54 GB for the cache after weights and activations: room for 141 conversations of the running example, with the shared system prompt stored once Capacity planner, section 1. The 142nd user waits, and since more users per step means more throughput (section 5), the cache size is the throughput ceiling. Model design moves it most: GQA cut Llama's cache 8 times against full multi-head attention, and DeepSeek's latent attention stores one 576-number vector per layer. The cache of any model at any context, against the weights, is on Long context's KV calculator; the attention designs behind it on Attention variants.
How engines make the most of it, each owned by Batching, KV cache and scheduling in depth:
Drawn on the owners: block tables over one pool in Batching's Fig. 3 and admission and preemption in a full pool in its Fig. 5; vLLM's free queue, recorded, in Fig. 3; SGLang's radix tree in Fig. 2. The cache as physical memory is on Memory technology; measured cache size against context in the Engine bench, section "KV cache memory against context".
A decode step reads 72.66 GB of weights to produce one token for one user. Let many users' next tokens ride on the same read: the weights are read once per step whatever the batch, and each extra user adds only its own cache bytes and a little arithmetic. On the H200 model, one user alone gets 46 tokens per second; 141 users together get 2,982, each at 21, and 64 users give 42 times the tokens of one for 1.54 times the step time Capacity planner. On the laptop measured here each extra sequence cost about 1.2 ms per step on top of the weight read, so 64 sequences gave 7 times the throughput of one measured here (Engine bench, "Batching"). More throughput for the owner against slower tokens for each user is the central dial of serving; past the knee, more users add latency without adding throughput.
Continuous batching (Orca, Yu et al., OSDI 2022: 36.9 times FasterTransformer's throughput at the same latency on GPT-3 175B, their measurement) re-forms the batch every step, so a finished request leaves and a waiting one joins at once; static batching ran until the longest answer ended, and dynamic batching (wait to fill, then run as a unit) suits one-pass models such as classifiers and embedders, not generation. Every engine here batches continuously by default. The before and after on the same requests is drawn on Batching, KV cache and scheduling in depth, section 1 (Fig. 2: eight requests, four seats, two ways), with paging's in its section 2; one engine step mixing prefill chunks and decodes is its Fig. 1, and one long prompt against eight decoding users under three token budgets its Fig. 4.
The scheduler builds each step's batch. Its four decisions, and who owns each:
| Decision | The choice | Owner |
|---|---|---|
| Admission and order | first come, first served by default (vLLM's fcfs); vLLM admits a request when its prompt fits, TensorRT-LLM's default only when its maximum length fits, so it never evicts but runs fewer at once | Batching, section 6 |
| Chunked prefill | cap the tokens per step and cut long prompts into chunks; decodes go first (Sarathi-Serve; on by default in vLLM v0.31.0, off in TensorRT-LLM v1.2.1) | Batching, section 5 |
| Preemption | when the cache runs out mid-answer, evict a running request and recompute it later or swap it back (vLLM v1 only recomputes) | Batching, section 6 |
| Priorities and fairness | interactive before batch, shortest first, SLO-aware; SGLang's cache-aware order runs the most-cached requests first | Batching, section 7; SGLang, section 4 |
The real code: vLLM's scheduler loop and block pool, recorded step by step on the real engine, are vLLM: inside the default engine, sections 2 and 3 (its Fig. 2 is one engine step, recorded); SGLang's two queue orders round by round are its Fig. 3; every switch on your own traffic is this page's Serving simulator.
A service level objective (SLO) is the latency promise, written on a percentile: "99% of requests see their first token within 2 seconds" is a p99 TTFT target. Percentiles matter because a user who sends twenty messages meets the slow tail. One request measured here shows why: under 16 concurrent users on llama-server (Qwen3-0.6B, a 412-token prompt, 128 tokens out) it saw a TTFT of 0.96 s and a mean TPOT of 43.9 ms, yet a median gap of 31.4 ms and a longest gap of 803 ms, a step where another user's prompt was being read measured here (Engine bench, "One request alone, and the same request under load"). MLPerf's targets for Llama 3.1 8B are p99 TTFT 2 s and p99 TPOT 100 ms, and 0.5 s and 30 ms in its interactive scenario (MLPerf inference rules). Goodput (DistServe's term) is the highest request rate at which the target share of requests meets the SLOs: throughput that breaks the promise is not worth having.
For the running example the Capacity planner finds that one H200 serves 2.11 requests per second within p99 TTFT 2 s and TPOT 50 ms (at that load TTFT p99 1.05 s, TPOT 46.8 ms), so 20 at peak need 10 H200s: $44.70 an hour at $4.47 per H200-hour, $0.54 per million tokens at half the peak on average, against $33.12 an hour for the same traffic at $0.40 per million from the cheapest API listed on 2026-10-08 planner, worked example "Chat assistant". For this workload the API is cheaper. The 50 ms TPOT target, not memory, sets the number of copies: relaxing it to 100 ms cuts the fleet from 10 GPUs to 8 ($35.76 an hour). Utilisation, not peak speed, decides self-host against API: one H200 at full batch makes 10.7 million output tokens an hour, $0.42 per million, but only if it is full every hour. Self-hosting wins with high and steady use, reserved or cheaper GPUs, heavy prefix reuse, a model no provider hosts, or data that cannot leave your network; add the engineers' time. How these definitions are measured, the cost slider and the break-even point are on LLM serving in production, section 1, whose Fig. 1 follows one request through the service; laptop numbers do not transfer to these dollars, only ratios and the shapes of the curves do (the Engine bench's "What transfers").
A serving engine is the program in the middle of the hero: an OpenAI-compatible HTTP front end, a tokenizer, the scheduler, the cache manager and a model runner that calls GPU kernels. Engines share sections 4 and 5 and differ in hardware, model coverage and what they optimise. Versions: latest GitHub releases on 2026-10-08.
| Engine | What it is | Cache and scheduler | Runs on |
|---|---|---|---|
| vLLM | The default open engine; Python with CUDA, Triton and vendor kernels; began as the PagedAttention paper (UC Berkeley); a PyTorch Foundation hosted project since May 2025 (PyTorch blog, 2025-05-07) | Paged blocks, hashed prefix cache, chunked prefill, recompute preemption; CUDA graphs for decode | NVIDIA, AMD and Intel GPUs, x86 and Arm CPUs; Google TPU, Intel Gaudi, Huawei Ascend and others through plugins |
| SGLang | Engine from the SGLang paper (LMSYS); strong on large MoE models with expert parallelism and on prefix-heavy agent workloads | Radix-tree prefix cache (RadixAttention; default class UnifiedRadixCache), chunked prefill; first come, first served by default, cache-aware ordering (lpm) opt-in | NVIDIA, AMD, TPU; its CPU backend targets Intel Xeons with AMX |
| TensorRT-LLM | NVIDIA's engine; the stack behind most NVIDIA entries in MLPerf Inference | Paged cache, in-flight batching; by default admits only what is guaranteed to fit, chunked prefill off | NVIDIA only |
| DeepInfer | The engine behind DeepSeek's own API, open-sourced (Apache 2.0) as an offline-inference release; originally built mostly on vLLM; serves one model, DeepSeek-V4.1-Flash | Data-parallel attention and expert parallelism balanced by EPLB, DSpark speculative decoding, a batch-invariant (deterministic) mode on NVIDIA; the KV cache system, prefill/decode split and cross-replica balancing are left out | NVIDIA SM100 (Blackwell) and Huawei Ascend 950 |
| llama.cpp | C/C++ engine for quantized GGUF models; local and edge first | llama-server: a fixed number of slots with continuous batching, per-slot prompt cache plus a host-memory prompt cache | CPU, Apple Metal, CUDA, Vulkan, ROCm and more |
| Ollama | A local model manager and server; one command to pull and run a model. At v0.40 it runs upstream llama-server as a subprocess for GGUF models, and MLX models through its own MLX runner, the default on Apple silicon since v0.40.0 | llama-server's slots, with its own launch flags (one slot and a context set by free memory); aimed at one machine | Mac, Windows, Linux; CPU and consumer GPUs |
| MLX / mlx-lm | Apple's array framework and its LLM package; mlx_lm.server | Batched decode (32 at once by default), prompt cache; a quantized cache disables batching | Apple silicon only |
| LMDeploy | Shanghai AI Laboratory's engine (InternLM); C++ TurboMind and a PyTorch back end | Paged cache, continuous batching | NVIDIA (TurboMind), Huawei Ascend (PyTorch engine) |
| TGI | Hugging Face's Text Generation Inference, once the common choice; in maintenance mode since 2025-12-11 and archived | Continuous batching, paged attention | NVIDIA, AMD, others |
Defaults quoted from source at the tagged versions (vLLM v0.31.0, TensorRT-LLM v1.2.1 llm_args.py, SGLang v0.5.21) and from the help output of the versions run on the Engine bench (llama-server 0.5.0, mlx_lm.server 0.32.0). The MLPerf observation is a count over the Capacity planner's extract of single-node LLM results, v5.1 to v6.1: most NVIDIA rows list TensorRT or TensorRT-LLM, the AMD rows mostly vLLM.
| Engine | Status |
|---|---|
| vLLM | v0.31.0, 2026-10-05; active |
| SGLang | v0.5.21, 2026-10-02; active |
| TensorRT-LLM | v1.2.1, 2026-04-20 (v1.3.0 release candidates since) |
| DeepInfer | no tagged release (built from source); open-sourced 2026-10-20 |
| llama.cpp | v0.6.0, 2026-10-05 (measured here: 0.5.0) |
| Ollama | v0.40.1, 2026-10-07 |
| MLX / mlx-lm | mlx 0.32.3, mlx-lm 0.32.0 (PyPI) |
| LMDeploy | v0.18.0, 2026-09-28 |
| TGI | Retired: maintenance mode from 2025-12-11 (its README recommends vLLM, SGLang, llama.cpp or MLX), last release v3.3.7, and the repository archived read-only on GitHub (last push 2026-03-21) |
DeepInfer is an engine of a new kind on this list: a frontier lab's own production engine made public, but for one model and two vendors' chips, and without the parts that join engines into a service. How its layout works, and what it withholds, is on Distributed and disaggregated serving, section 5.
Above the engines sits a layer that routes across replicas and nodes: NVIDIA Dynamo, llm-d (Kubernetes-native around vLLM), KServe, Ray Serve and Triton Inference Server, whose dynamic batching is not continuous batching (it delegates that to a TensorRT-LLM or vLLM backend); all on Distributed and disaggregated serving, section 8. On a desktop, LM Studio puts a GUI over llama.cpp and MLX.
Choosing. Start from the hardware and the model, not from a benchmark chart:
New request shapes and release notes (decision-model routes added in October 2026, for example) are tracked in tech news, 2026-10-19.
Since decode is limited by bytes read, a token gets cheaper in two ways: read fewer bytes per token (quantisation), or get more than one token per read (speculative decoding). What matters for serving is which numbers are made smaller and what the hardware does with them:
| Quantised | Formats | Speeds up | Watch |
|---|---|---|---|
| Weights only | INT4, INT8 with a scale per small group (AWQ, GPTQ, GGUF k-quants), unpacked to 16 bits inside the kernel | decode, 2 to 4 times fewer bytes; not prefill | quality, larger on small models |
| Weights and activations | FP8; FP4 on Blackwell (NVFP4, MXFP4), on tensor cores at two or four times BF16 speed | decode and prefill | needs the hardware |
| KV cache | FP8, INT8, INT4 | more users per GPU | quality per model: on Qwen3-1.7B an 8-bit cache left WikiText-2 perplexity at 15.18 and a 4-bit one raised it to 19.42 (Batching, section 8) |
Measured here on Qwen3-0.6B (llama.cpp, M1 Pro GPU): generation went from 113 tokens per second at F16 to 140 at Q8_0 and 196 at Q4_K_M, while prompt processing fell from 3,618 to 3,240; WikiText-2 perplexity went from 20.88 to 20.86 at Q8_0 and 22.59 at Q4_K_M measured here (Engine bench, "Quantization: speed and quality"). Eight bits is close to free; four bits is a real trade. Number formats and the methods (GPTQ, AWQ, rotations) are owned by Quantization and Precision; what a GGUF type name means and every type measured, by Local and on-device inference, sections 4 and 5.
Speculative decoding uses decode's idle arithmetic: a cheap draft proposes k tokens, the target model scores all of them in one pass, keeps the longest run it agrees with and adds one of its own, and a modified rejection-sampling rule keeps the output distribution exactly the target's (Leviathan et al. 2023). It pays only while checking k tokens costs little more than producing one, so the gain shrinks as the batch grows; on this laptop a Qwen3-4B pass over 4 tokens cost 2.2 times a pass over 1, so a 0.6B draft made llama.cpp slower on free text and at best 1.32 times faster on a highly predictable list measured here (a llama.cpp Metal effect of the Q4_K weights; on Qwen3-1.7B at Q8_0 a pass over 4 tokens cost 1.25 times one token) (Engine bench, "Speculative decoding"). The step, the acceptance rule and why it is exact, the worked example, every kind of drafter and the batch-size crossover are on Speculative decoding (one round on real tokens in its Fig. 1, the crossover in Fig. 3, where each drafter gets its guesses in Fig. 4); good small drafts on Distillation and small language models.
Kernels and graphs remove the overhead around the bytes: FlashAttention computes attention in on-chip memory (paper page; split-KV decode kernels on Writing kernels), paged attention kernels read keys and values through the block table, and CUDA graphs record a decode step's hundreds of launches once and replay them (Streams, CUDA graphs and multi-GPU; compilers on Compiler stack).
One GPU stops being enough for three different reasons, each with its own fix: the weights do not fit, the cache for enough users does not fit, or one GPU is too slow for the latency target. The running example shows the second: Llama 3.1 70B in BF16 is 141 GB, so on H100s (80 GB) it needs two GPUs, and the two then have room for the cache of only 2 conversations Capacity planner, TP 2 on H100 in BF16.
| Scheme | Each GPU holds | Talks per step | Buys | Costs | Owner section |
|---|---|---|---|---|---|
| Replicas (data parallel) | a whole copy | nothing | throughput, linearly | the model must fit one copy's GPUs | 2 |
| Tensor parallel (TP) | a slice of every layer | two all-reduces per layer | bigger models, lower latency (each GPU reads 1/n of the weights) | needs NVLink-class links; stays inside one server; Llama's 8 KV heads cap useful TP at 8 | 3 |
| Pipeline parallel (PP) | a run of whole layers | activations between stages | capacity across servers over slower links | no lower latency for one request; idle stages without enough micro-batches | 4 |
| Expert parallel (EP) | some of a mixture-of-experts model's experts | all-to-all: tokens to their experts and back | huge MoE models; big batches per expert | load imbalance across experts; network heavy | 5 |
| Prefill / decode split | prefill GPUs and decode GPUs, each with its own parallelism | the KV cache, once per request | no prefill stalls in decode; each phase sized on its own | moving the cache; two pools to balance | 6, 7 |
Sections of Distributed and disaggregated serving, whose Fig. 1 draws the five splits and what crosses per token, Fig. 3a and Fig. 3b cut one model across every layer and by depth, Fig. 5 sends tokens to their experts and Fig. 6 sets colocated against disaggregated; the parallelism forms themselves (Megatron's split, all-reduce, all-to-all) are owned by Distributed Training, the links by Interconnects and scaling.
Disaggregated serving puts prefill and decode on different GPUs because they want different things (compute against bandwidth, section 2) and because a prefill in a decode step stalls every stream. The prefill GPU sends the finished cache to a decode GPU: 2,000 tokens of the running example are 625 MiB, about 13 ms over a 400 Gb/s network link or under 1 ms over NVLink 2,000 × 320 KiB / link speed. vLLM's own docs say "Disaggregated prefill DOES NOT improve throughput": it buys control over TTFT and tail inter-token latency (disagg_prefill.md). It is worth its complexity at scale with strict TPOT targets and long prompts; on a few GPUs, chunked prefill gets much of the benefit. When it pays, with the published claims and their settings, is that page's section 7.
With several replicas, something in front picks one for each request. A web load balancer's round-robin spreads load evenly but ignores the cache: with N replicas, a returning conversation lands on one without its cache (N − 1) / N of the time and its whole history is prefilled again. Prefix-aware routing (cache-aware, KV-aware) sends a request to the replica most likely to hold its prefix, weighed against how busy each replica is. LLM serving in production, section 2 (Fig. 2), steps eight requests through three real replicas under every routing rule (round-robin computed 13,000 prompt tokens; the rules that follow the prefix computed as few as 5,804) and replays a real multi-turn trace; how Dynamo and llm-d score workers is on Distributed and disaggregated serving, section 2 (Fig. 2), and SGLang's router code on SGLang, section 8.
Gateways above all this (keys, budgets, fallbacks between providers): Gateways and routing; client-side prompt caching with API providers: Context engineering.
| Workload | What changes | The levers | Owner |
|---|---|---|---|
| Long context | The cache grows with every token: 128K tokens of Llama 3.1 70B are 40 GiB 131,072 × 320 KiB, four fifths of what an H200 has left after FP8 weights, for one conversation; every decode step reads all of it (Qwen3-0.6B went from 198 tokens per second with an empty context to 56 at 16,384 tokens measured here), and prefill attention grows with the square of the prompt | chunked prefill, an FP8 cache, offload, context parallelism, models built for it (sliding windows, latent attention) | Long context; Batching, sections 4 and 8; whether models use it: Long-context and multimodal benchmarks |
| Structured output | To guarantee valid JSON or any grammar, the engine masks the vocabulary at every step; the mask can also push the model away from what it would have written, so check quality, not only validity | precomputed masks (XGrammar reports up to 100 times faster masks, the authors), grammar back ends per engine | Sampling and decoding, section 5 (Fig. 3); under load: production, section 6; in SGLang: SGLang, section 6 |
| Many fine-tuned variants | A LoRA adapter is megabytes against gigabytes; one base model can serve many adapters in one batch, each request applying its own through a batched kernel (Punica, S-LoRA) | batched LoRA kernels, adapter paging, routing a request to a replica that holds its adapter | production, section 5 (Fig. 4); vLLM's knobs: vLLM, section 5; LoRA itself: PEFT |
This root gives the map and the comparisons; each mechanism is taught on one child, in this reading order. Times are each page's own header.
Not children: number formats and quantisation methods belong to Quantization and Precision, KV-cache sizing to Long context; capacity and cost tools stay on this root's Capacity planner, since they span every child.
A serving engine is a loop. Every iteration (a step) it picks which requests run, how many of their tokens to compute, and where their KV cache lives; the GPU then runs one forward pass over that batch. This tab is that loop, written out so you can switch each mechanism off and watch what it was for, on the same requests.
What is real here: the scheduling decisions in the continuous-batching, paged mode are the same as vLLM v0.31.0's own scheduler, step for step, on every trace we compared (checked below). The time each step takes comes from a roofline model (the larger of compute time and memory time, plus overheads) whose four efficiency numbers were fitted to NVIDIA's published NIM measurements for Llama 3.1 8B on one H100, then checked on rows of that table not used in the fit. The M1 Pro preset is calibrated on llama.cpp runs made on this machine. Everything else (static batching, contiguous allocation, swap, disaggregation) follows the published designs and is labelled illustrative where no engine was checked.
Static against continuous batching and contiguous against paged memory on the same requests are drawn where they are taught: Batching, KV cache and scheduling in depth, section 1 ("Seven new tokens, one weight read") and section 2 (where contiguous reservations leave C waiting). This tab runs them as switches on your own traffic.
Pick hardware and a traffic pattern, then switch mechanisms on and off. Every run is deterministic (seeded), so a change in the numbers is caused by the switch, not by luck. The Compare buttons run the current setting and the same setting with one mechanism changed, on identical requests.
Eight users are mid-answer, each getting a token every few milliseconds. Then one user pastes a 12,000-token document. Without chunking, the engine computes that whole prompt in one step and the eight answers freeze until it is done. With chunked prefill (Sarathi-Serve, Agrawal et al., OSDI 2024; on by default in vLLM v1), the prompt is cut into pieces that fit the per-step token budget and each piece rides along with the eight decodes.
Raise the arrival rate and throughput climbs, then flattens; latency stays flat, then shoots up. The knee is where the engine runs out of room: a step can carry more decodes almost for free while it is memory-bound (weights are read once per step whatever the batch), but once the KV cache or the compute is full, extra requests can only wait. This sweep reruns the lab's current setting (hardware, traffic shape, engine) at rates from a tenth to twice the rate you set, and marks where goodput (requests per second within both targets) peaks.
Check 1: the scheduler is vLLM's. We ran vLLM's real Scheduler and KVCacheManager (v0.31.0, commit db9527a, Python only, no GPU: a stand-in model runner returns one token per finished prefill or decode) on the traces below, and compared every step with this page's simulator: which requests run, how many tokens each computes, which are preempted. Two details had to match vLLM exactly for that: a new request is admitted only if its whole prompt fits in free blocks (scheduler_reserve_full_isl, default on), and freed blocks without cached content go to the front of the free queue while cached ones go to the back, so prefix-cache entries are evicted least recently used first (block_pool.py, free_blocks). checked against the engine's code
Check 2: the step time on an H100. NVIDIA publishes TTFT, inter-token latency and throughput for Llama 3.1 8B Instruct on one H100 in FP8 at five prompt and answer lengths and eight concurrency levels (NIM 1.8.0, measured with genai-perf in closed loop: each of C clients sends its next request when the last one ends) vendor. We fitted four numbers on part of that table and predicted the rest.
Check 2b: a different engine on the same GPU. audited submission (MLPerf Inference v5.1, Red Hat)
Check 3: an engine on this machine. measured on Apple M1 Pro The Engine bench tab ran llama.cpp (build 11146, Metal) with Qwen3-0.6B in Q4_K_M. Prefill and single-stream decode calibrate the M1 preset; then llama-server with 16 slots was driven by 1 to 16 closed-loop clients sending about 410-token prompts for 128 tokens each, repeated two or three times on a machine shared with other work (load averages are in the table).
The same roofline as the Performance math page's serving planner (bytes over bandwidth against FLOPs over peak, the larger wins), applied to each mixed step instead of a pure decode batch, and with overheads that this page fits instead of assuming. Peaks come from the vendors (H100 SXM: 989.5 TFLOP/s BF16 and 1,979 FP8 dense, 3.35 TB/s; M1 Pro: 5.3 TFLOP/s by Philip Turner's count, 200 GB/s).
Scheduler, and the time model has no CPU-GPU overlap); tokenization and network time except one fixed client latency in the H100 fit; tensor and pipeline parallelism (each GPU here is a whole replica); speculative decoding; sampling cost differences; KV-cache quantization accuracy; attention kernels that are not bandwidth-bound at long context. Static batching, contiguous allocation, swap and disaggregation follow their papers' designs and were not checked against a running engine illustrative.Real serving engines, run on a real machine, measured the way you would measure your own deployment. Every number on this tab was produced on this laptop on : llama.cpp and MLX on the laptop's GPU, and vLLM on its CPU inside Docker. The point is not the absolute numbers (a datacenter GPU is 20 to 100 times faster); it is the shapes: how speed changes with prompt length, with context, with batch size, with load, with quantization, and where the curves bend.
Reading a 512-token prompt runs at tokens/s; generating runs at tokens/s on the same model (Qwen3-0.6B, Q4_K_M). Same weights, a x difference: prefill does many tokens per pass over the weights, decode does one.
At 16,384 tokens of context, decode drops to tokens/s (from ), because each new token reads the whole KV cache: MiB of it, more than the MiB of weights.
Decoding 64 sequences at once gives tokens/s in total against for one, x more for the same hardware.
A server's throughput flattens near tokens/s while p99 time to first token climbs from about ms to s: the curve bends.
A prompt whose first 1,500 words are cached starts answering in ms instead of ms (x).
Two numbers describe how a streamed answer feels. TTFT (time to first token) is how long you stare at an empty box: the server has to queue the request, read the whole prompt (prefill) and produce the first token. TPOT (time per output token, also called inter-token latency) is the gap between the tokens that follow, one per decode step. Below are two real requests recorded by the load generator against the same llama.cpp server and model (Qwen3-0.6B, Q4_K_M, a -token prompt, 128 output tokens): one sent when nobody else was using the server, one sent while 15 other users were sending identical-sized requests in a loop. Each block is one token, drawn the moment it arrived.
Each stretch plays at the real speed at 1x, then pauses so its step can be read. The request under load is the median-TTFT request of its run, so it is typical, not the worst. What changes under load: the first token waits behind other prompts being read (TTFT s against s), and each later token waits for a decode step that now carries 16 sequences and, every few steps, someone else's prompt (median gap ms against ms, with spikes up to ms when a new prompt joins the batch).
Prefill pushes the whole prompt through the model in one pass: hundreds of tokens share each read of the weights, so the GPU's arithmetic units are the limit (compute-bound). Decode produces one token per pass: every weight is read from memory to do a little arithmetic for a single token, so memory bandwidth is the limit (memory-bound). The Performance math page derives this from FLOP and byte counts; here is what llama-bench measures.
llama-bench, Qwen3-0.6B, F16 and Q4_K_M, 3 repetitions per point (bars show min to max). Short prompts are too small to keep the GPU busy; past about 256 tokens the speed falls again because attention over the prompt grows with the square of its length. F16 prefills faster than Q4_K_M: 4-bit weights must be unpacked before the matrix multiply, and prefill is limited by arithmetic, not by bytes.
llama-bench, Qwen3-0.6B Q4_K_M, 32 generated tokens after a context of the given depth, flash attention off and on, 3 repetitions. The two-parameter line is fitted to the flash-attention points by least squares (src/bench/recompute.py). At short context the fixed cost dominates: a 0.6B model is too small to saturate memory bandwidth one token at a time. At 16K context the KV cache read dominates and the bandwidth model explains the slowdown. The fitted bandwidth (147 GB/s) describes this small model at growing context; it is not the chip's decode ceiling: plain decode of bigger dense files reached 187 GB/s (Qwen3-1.7B F16) and about 164 GB/s (Qwen3-4B F16) on the same laptop (Local and on-device inference, Fit and speed tab). Flash attention matters most at long context, where it avoids writing and re-reading the attention scores.
Because decode is limited by reading the weights, decoding several sequences in the same step costs little more than decoding one: the weights are read once and applied to every sequence in the batch. Total throughput rises with batch size; each user's own speed falls a little. This is why serving engines batch, and why a server that is idle most of the time wastes most of what the hardware can do.
llama.cpp: llama-batched-bench, Qwen3-0.6B Q4_K_M, 128 prompt tokens and 128 generated tokens per sequence, 3 repetitions. MLX: mlx_lm benchmark (batch_generate), Qwen3-0.6B 4-bit, 128 and 128, 3 trials. Pure decode, no new prompts arriving: the best case a real server approaches but never reaches.
A real server has requests arriving at random times. This tab's load generator (src/bench/scripts/loadgen.py, standard library only) sends streamed completion requests in two ways. Closed loop: a fixed number of users, each sending a new request as soon as the last one finishes. Open loop: requests arrive as a Poisson process (independent random arrivals at a set average rate, fixed seed), which is how MLPerf's Server scenario and most production traffic behave. Every request has a 400-word prompt (about 410 tokens, with a unique tag so no prompt is cached) and asks for exactly 128 tokens.
A service level objective (SLO) sets the latency each request must meet, for example "first token within 1 s and at most 50 ms between tokens". Goodput counts only the requests that met it. Move the limits and watch which load level gives the most useful work: past the bend, raw throughput stays flat but goodput collapses.
For every token in every sequence, each layer keeps that token's key and value vectors (the KV cache) so later tokens can attend to it without recomputing it. Its size per token is fixed by the model's shape: 2 (K and V) × layers × KV heads × head size × bytes per number. For Qwen3-0.6B (28 layers, 8 KV heads of 128 numbers, from its config.json) at 16 bits that is bytes, which llama.cpp's allocation matches exactly. The Memory technology page covers where these bytes live physically.
Dots: the KV buffer llama-server allocated at start-up (Qwen3-0.6B, one sequence, context 4,096, 16,384 and 40,960, KV types f16, q8_0, q4_0). Lines: the formula. q8_0 stores 8.5 bits per number and q4_0 4.5 (a 16-bit scale per block of 32), hence 0.53x and 0.28x of f16. The sliders turn bytes into the number of sequences that fit, which is what limits a server's batch size: memory, not compute, usually caps concurrency.
Quantization stores weights in fewer bits (8, or about 5 on average for Q4_K_M, instead of 16). Decode reads every weight once per token, so fewer bytes means faster decode; prefill is limited by arithmetic, so it gains little or even loses to the unpacking work. Quality falls as bits fall, and falls faster on small models. The Quantization and Precision page owns the formats and the maths; here are the measured trade-offs.
llama.cpp: llama-bench pp512 and tg128, 5 repetitions (bar shows the mean, the dark mark the run-to-run range). MLX: mlx_lm benchmark, 512-token prompt and 128 generated tokens, 5 trials, median. Effective GB/s = decode tokens/s × file size: a model near the measured bandwidth (plain reads about 143 to 165 GB/s on Topic: hardware; plain decode of Qwen3-1.7B F16 reached 187 GB/s on Local and on-device inference) is purely bandwidth-bound; small quantized models fall short because fixed per-step costs dominate.
Perplexity on WikiText-2 raw test, 512-token windows, the second half of each window scored, first 60 windows (about 15,000 tokens scored): a small check, not a benchmark. KL divergence and "same top token" compare every predicted distribution with the F16 model's on the first 20 windows (llama-perplexity --kl-divergence). The 0.6B files were quantized here from one BF16 file with no calibration data; the 1.7B files are unsloth's. Read the 0.6B rows as the trend: 8-bit is nearly lossless (the top token changes about 1 time in ), 4-bit is not on a model this small (about 1 time in ). Larger models lose much less at 4 bits.
Decode wastes most of the hardware on one token per step. Speculative decoding lets a small draft model guess the next k tokens cheaply, then the big target model checks all k in one batched step and keeps the longest correct prefix plus one token of its own. In exact arithmetic the output follows exactly the target's own distribution (at temperature 0, the same text); in real floating point a batched check can round differently, so text can occasionally differ (MLX did at k = 6, below). Mainly the speed changes. It pays when checking k tokens costs about the same as producing one, and when the draft guesses well.
Measured cost of one target step with 1, 2, 4, 9 and 17 tokens (llama-bench, Qwen3-4B Q4_K_M, 5 repetitions) against a step whose cost does not grow with k (the ideal of a large memory-bound model on a datacenter GPU at small batch, labelled illustrative). Expected tokens per step with acceptance a and draft length k: (1 − ak+1) / (1 − a) (Leviathan et al., 2023); time per step: k draft steps plus one target step of k+1 tokens. Interpolated between measured points.
Chat assistants send the same long system prompt with every request, and multi-turn conversations resend the whole history. If the server keeps the KV cache of a prompt it has already read, a new request that starts with the same tokens skips straight to the part that differs. llama-server keeps each slot's last prompt (and, by default, up to 8 GiB of older prompts in host memory); vLLM and SGLang keep cached blocks in a hash table or a radix tree (see the Reading tab).
The same closed-loop workload (410-token prompts, 128 output tokens) against three engines. llama.cpp and MLX run Qwen3-0.6B on the GPU at about 4.5 to 5 bits per weight; vLLM runs it on 4 CPU cores in 32-bit floats, so compare its shape with the others, not its speed.
Median over seeds; each cell's range in brackets. Throughput is output tokens per second over the whole run.
--spec-type draft-simple as well as -md: with only -md the draft model was loaded and never used (default spec type none in 0.5.0).VLLM_CPU_KVCACHE_SPACE=2) it reported room for tokens (4-byte KV: bytes per token). With 16 users of about 540 tokens each that pool ran out: the engine's log showed KV usage up to % with requests waiting, its metrics counted preemptions (a running request evicted and later recomputed), and throughput fell from tokens/s at 8 users to at 16. That is the KV cache acting as the scarce resource, measured. Its scheduler, block manager and prefix cache are the same code as on a GPU; only the kernels differ.-xeon) are x86-64 only (Docker Hub, checked ); an arm64 Dockerfile exists that builds from source, which was not attempted on this shared laptop. TensorRT-LLM needs an NVIDIA GPU.| Finding here | On an H100-class GPU | Why |
|---|---|---|
| Prefill is many times faster per token than decode | Transfers, and the gap is larger | The gap is set by FLOP per byte: the M1 Pro GPU does about 5 TFLOP/s on 0.15 TB/s (ridge about 32 FLOP per byte, measured on Topic: hardware); an H100 SXM does 989 dense BF16 TFLOP/s on 3.35 TB/s (about 295 FLOP per byte, NVIDIA). Decode at batch 1 uses about 2 FLOP per weight byte at 8 bits, far below either ridge. |
| Decode slows linearly with context (KV reads) | Transfers | Bytes per token are a property of the model; the slope is KV bytes divided by bandwidth on any hardware. |
| Small models are overhead-bound at batch 1 | Transfers, and engines fight it | Kernel launches and Python scheduling cost microseconds per step on any GPU; vLLM and SGLang capture whole decode steps as CUDA graphs to remove them (see Streams, CUDA graphs and multi-GPU). |
| Batching multiplies decode throughput | Transfers, and goes much further | With a ridge near 295 FLOP per byte, an H100 stays memory-bound up to batches of a few hundred tokens per step, so total throughput keeps climbing long after this GPU flattens. |
| KV bytes per token, sequences that fit | Transfers exactly | Same formula, bigger memory (80 to 192 GB); KV memory, not compute, still caps concurrency. |
| The throughput-latency curve bends | Shape transfers, position does not | Every queue bends near capacity; where depends on the hardware and the scheduler (chunked prefill moves the TTFT and TPOT trade-off). |
| Speculative decoding did not pay | Does not transfer: it usually pays at small batch | Here, checking 4 tokens cost x one token. On large memory-bound models on GPUs the check is close to free: Leviathan et al. (2023) report 2x to 3x on T5-XXL, and EAGLE's authors report 2.7x to 3.5x latency speed-up on LLaMA2-Chat 70B (paper, authors' measurements). Gains shrink as batch size grows. |
| 4-bit costs quality on a 0.6B model | Partly: depends on model size and method | Larger models lose much less; calibrated methods (AWQ, GPTQ, imatrix) and FP8 on Hopper and Blackwell tensor cores change the trade-off (see Quantization and Precision). |
| Prefix caching cuts TTFT by the cached fraction | Transfers | Skipped prefill is skipped compute on any hardware. |
| Absolute tokens/s, ms, requests/s | Do not transfer | Use the Capacity planner and published GPU results for those. |
Model paths are written as <models>/. Load is the one-minute load average of the 10-core machine at the start (and end) of the run. Raw results, the load generator and the scripts are in src/bench/.
How many GPUs a model needs to serve a given traffic within a latency promise, what that costs per million tokens, and whether an API would be cheaper. You choose the model, the precision, the GPU, how the model is split across GPUs, the traffic and the latency targets; the planner works out the memory each GPU spends, how many conversations fit at once, how long each engine step takes, the most traffic one copy of the model can carry inside the targets, and the bill. The formulas are the hardware root's Performance calculator (FLOPs and bytes per step, KV cache per token, the same functions) and they extend the Performance math page's serving frontier with queueing, latency targets and prices. Every result is an estimate from a stated model whose two engine constants are fitted to published MLPerf runs; the residuals are shown below, not hidden.
Try: start from the running example (a chat assistant on Llama 3.1 70B), then open the worked examples: each one sets every control and says what to notice and how the planner compares with what was published.
Each point is the steady state at one arrival rate: more traffic means more sequences decoding together and more prefill per second, so each step grows. The dashed lines are your targets; the planner takes the highest rate that meets both. Where the curve turns up is where to stop adding load.
One GPU's memory filled step by step (weights, activations, other, then the KV cache), conversations packed into the cache until it is full, one decode step timed, and the fleet that results. The two rows are the same deployment and traffic with one setting changed; both are drawn to the same scale.
The planner has two engine constants that no datasheet gives: the share of peak compute the engine reaches, and a fixed overhead per step (scheduling, sampling, kernel launches). They are fitted to MLPerf Inference v5.1 runs of Llama 3.1 8B whose full settings are public (vendor submissions, reviewed by MLCommons): the compute share so the offline ceiling equals the Offline result, the overhead so the simulated mean TPOT at the Server run's arrival rate equals the measured one. Everything else in the table is not fitted and tests the model: the Server throughput inside 2 s and 100 ms, the measured TTFT, another submitter's run, and each GPU's constants applied to the others. A third constant, the share of memory bandwidth reached (80%), is an assumption.
Latencies come from simulating 3,000 requests with one fixed random seed (the same arrivals at every rate, so curves are smooth). Near the knee a different seed gives a different answer, which is a real property of a loaded server, not only of the simulation: a burst lengthens steps, longer steps let more sequences pile up, and the queue takes a while to drain. Five seeds at the calibration points:
MLPerf Inference datacenter results, closed division, one machine, output tokens per second per GPU. All are vendor or partner submissions reviewed by MLCommons; the settings differ (precision, engine, accuracy target), so read them as what a tuned stack reached, not as a ranking.
Not modelled: speculative decoding, varying prompt and output lengths (fixed here; real spread lengthens the TTFT tail, as the MLPerf check shows), preemption churn, prefill/decode disaggregation, CPU offload of the cache, request routing across copies (assumed perfect), and cold starts.
Prices fetched 2026-10-08: GPU-hours from Lambda, DigitalOcean and RunPod list prices (on demand, before tax); API prices per million tokens from OpenRouter's provider list. Model shapes from each model's config.json; chip figures from the shared facts file used by the hardware root's Chip atlas (dense peaks, vendor pages, fetched 2026-10-05) and the L40S product page (fetched 2026-10-08). Engine defaults from vLLM v0.31.0's source.
The tabs of this page, the knowledge base pages it leans on, the papers behind each mechanism and the best outside resources, each with an approximate time. Links checked on 2026-10-08.
The map of a serving stack, one request's prefill and decode, the three regimes, every lever on one screen, the KV cache, batching and scheduling, latency and cost, the engines compared, cheaper tokens, many GPUs, production and the child pages. see the header
A serving engine in the browser, checked step by step against vLLM's own scheduler: every switch (batching, paging, prefix caching, chunked prefill, preemption, admission, disaggregation) on your own traffic, the chunked-prefill stall, latency against load. 30 to 45 min
llama.cpp, MLX and vLLM measured on an M1 Pro: prefill against decode, batching, throughput against latency, KV memory, quantisation, speculative decoding, prefix caching, every run with its command. 30 min
Memory, step time, latency under load, GPUs and dollars for any model, GPU, precision and parallelism, calibrated on MLPerf; self-host against API. 20 to 40 min
Eight children in reading order; Reading, section 12 says what each owns. Times are each page's own header.
Continuous batching, paging, prefix caching and eviction, offload tiers, chunked prefill, preemption, scheduling policies, compressed caches, tuning. Child page, about 45 min, plus 19 in closed details
Search and sampling, twelve decoders on real text, logit processors, constrained decoding; its Sampler lab runs on a real model's logits. Child page, about 23 min, plus 4 in closed details
Draft, verify, accept; the exact acceptance rule; tokens per step; the batch-size crossover; drafters and trees; its Drafters measured tab. Child page, about 36 min, plus 8 in closed details
The request path, the scheduler loop and KV cache manager recorded on the real engine (sections 2 and 3), model runners, the knobs (section 5), metrics, upgrades, a first patch. Child page, about 41 min, plus 15 in closed details
The radix tree against hash blocks, cache-aware scheduling, the overlap scheduler, structured output, the router, large-scale serving, SGLang or vLLM. Child page, about 34 min, plus 16 in closed details
Bandwidth and fit, model file formats (section 3 and its File explorer tab), GGUF types from zero and measured, llama-server, MLX, Ollama, consumer GPUs, phones; its Fit and speed tab. Child page, about 48 min, plus 53 in closed details
Replicas and routing scores, tensor, pipeline and expert parallelism at serve time, prefill/decode disaggregation and when it pays (section 7), the serving layer. Child page, about 39 min, plus 21 in closed details
SLOs, goodput and cost per token (section 1), routing on real replicas, autoscaling (section 3), cold starts, multi-LoRA, metrics, load testing. Child page, about 34 min, plus 13 in closed details
The order matters more than any one link: every optimisation is an answer to a constraint met earlier. (1) What a request does: this page's sections 1 and 2, then kipply's Transformer Inference Arithmetic (30 min). (2) The model only as deep as the engines need: Brendan Bycroft's LLM Visualization (30 min). (3) The hardware: Horace He's Making Deep Learning Go Brrrr From First Principles (25 min) and Topic: hardware. (4) The techniques: sections 3 to 11 and the Serving simulator. (5) The engines: section 7, then Inside vLLM (60 min) and the vLLM architecture overview (30 min).
FLOPs and bytes per token, prefill and decode arithmetic, the serving frontier planner. 24 min
HBM, GDDR and SRAM; why bandwidth bounds decode, and the KV cache as physical memory. Reading: 27 min, plus 9 in closed details
Chip atlas, performance calculator, roofline lab; the measured M1 Pro roofline used here. 28 min
NVLink, InfiniBand, all-reduce cost: why tensor parallelism stays in one server. 34 min
SMs, tensor cores, FP8 and FP4 support by generation. 34 min
Kernels from the programmer's side (28 min, plus 4 in closed details). Children: Writing kernels (FlashAttention, split-KV decode, dequantizing GEMV; 34 min), Streams, CUDA graphs and multi-GPU (CUDA graphs in vLLM; 33 min), Compiler stack (37 min).
Formats, scales, AWQ and GPTQ, and what precision costs in quality. Reading: 34 min, plus 11 in closed details
Small models for serving and as speculative drafts. Reading: 25 min, plus 8 in closed details
One token through llama.cpp's code. 37 min
Server-sent events and how tokens reach the client. 38 min
LiteLLM, OpenRouter, fallbacks, budgets and rate limits in front of engines and APIs. 37 min
Agents are the heaviest prefix-reuse workload; client-side prompt caching is on its Context engineering child. 40 min
Whether models use the long contexts that are so costly to serve. 27 min
Tensor, pipeline and expert parallelism on the training side. Reading: 32 min, plus 5 in closed details
pytorch-ecosystem, ml-infra-and-orchestration (Kubernetes, clusters), jax-and-tpu. 40, 28 and 28 min
vLLM's paper: block tables, near-zero waste, sharing. 27 min
Attention without writing the score matrix to HBM. 26 min
Where keys, values and autoregressive decoding come from. 20 min
Orca (OSDI 2022): iteration-level scheduling. PagedAttention (SOSP 2023). SGLang and RadixAttention (2023). 40 to 60 min each
Sarathi (2023) and Sarathi-Serve (OSDI 2024): chunked prefill. DistServe (OSDI 2024): goodput. Splitwise (ISCA 2024). Mooncake (2024). 40 to 60 min each
Leviathan et al. (2022), Chen et al. (2023), Medusa (2024), EAGLE (2024). 30 to 45 min each
AWQ, GPTQ, FP8 formats, XGrammar. 30 to 45 min each
Punica, S-LoRA, ServerlessLLM, AIBrix. 30 min each
vLLM blog, 2025-09-05: the engine's request path, scheduler, paged cache, prefix caching, speculative decoding and disaggregation, read from the code. The best next step toward reading engines. 60 min
Chapter of "How To Scale Your Model" (Google DeepMind authors, 2025-02-04): the arithmetic of prefill, decode, KV cache and sharding, with worked problems. 60 to 90 min
Hugging Face blog, 2025-11-25. 25 min
Anyscale, 2023-06-22: the measurement that made continuous batching famous (vendor). 20 min
Databricks, 2023-10-12: TTFT, TPOT, memory bandwidth utilization and batch size in practice (vendor). 20 min
NVIDIA, 2023-11-17: an overview of batching, KV cache, parallelism and quantization (vendor). 25 min
Lilian Weng, 2023-01-10: a survey of model-side methods (distillation, quantization, pruning, sparsity). 40 min
LMSYS, 2025-05-05: DeepSeek-V3 on 96 H100s with prefill/decode disaggregation (vendor). 30 min
Baseten, 2026-09-02: techniques that move a deployment along the latency-throughput frontier against those that push it outward (vendor). 25 min
Cohere, 2026-09-08: a whole decode step as one kernel, batch-1 serving on H100 (vendor). 30 min
Inferact, 2026-09-23: Kimi K3 on TPU v7 against GB200 at batch 1 to 8 (vendor). 20 min
vLLM blog, 2025-01-27: why the engine was rebuilt around a token budget per step. 20 min
2026: random KV eviction as the control for any learned eviction policy. 30 min
Triton Inference Server, KServe, Ray Serve LLM, TensorRT-LLM disaggregated serving. reference
vLLM (its prefix caching design), SGLang, TensorRT-LLM, llama-server, mlx_lm.server, llm-d, NVIDIA Dynamo. reference
MLPerf Inference rules (scenarios, latency constraints), NVIDIA's LLM benchmarking metrics (TTFT, ITL, TPOT defined carefully), vLLM benchmarks, GuideLLM. 20 min each