You hit send, wait a beat, and watch the answer type itself out. That beat is the whole prompt being read at once. The typing is tokens being born one at a time, each one joining the conversation for the next. The sentence to remember: the prompt is processed all at once up front; the answer is generated one token at a time, each new token reading everything that came before.
Inference is what happens when a trained model meets your prompt. Training is the months-long factory run that builds the weights; inference is the everyday job of running those weights to turn request tokens into response tokens. Every chat reply, agent action, and voice call you have ever used runs on this loop, and it has a strange shape: your thousand-token prompt is swallowed in a single parallel gulp, then the answer dribbles out one token per pass. That asymmetry explains the pause before the first word, why replies stream, why long prompts are slow to start but fine once they get going, and why serving models is mostly a memory-management business. This primer walks the loop step by step, with a machine you can run yourself.
Seven mechanisms, each doing one job. Tap each card for the plain-language version, one concrete example, and what changed recently. Then run the token machine below it.
The whole primer in one picture: prefill reads the entire prompt in one forward pass, decode emits one token per pass and repeats.
Why the cache exists: every token leaves its keys and values behind, so each new token reads the past instead of recomputing it.
Run one real request, click by click. The prompt is "Capital of France?" and the model answers "The capital of France is Paris". The token splits and the sampling odds are illustrative, not measured. One tap per step, or use the arrow keys.
Illustrative, not measured: the token split, the candidate odds, and the pass counts are a teaching model. The shape of the loop is real.
Each race is measured on one rig, so the ball speeds are comparable inside each race only. The motion is the data: a faster ball means a faster machine.
Race 1. Qwen3.8-27B (NVFP4) on two RTX 5090s, vLLM 0.27.0, 60K-token prompt. Prefill swallows 60,000 tokens in 26.4 seconds, about 2,270 tokens per second of effective throughput; decode streams at 80.9 tokens per second. Measured by pavle-scalably, Hugging Face blog, 2026.
Race 2. LLaMA2-Chat 13B on one RTX 3090. Vanilla autoregressive decode at 24 tokens per second against EAGLE speculative decoding at 160 tokens per second. Measured by the EAGLE authors, Jan 2024.
Drag the slider. The wait before the first word grows steeply with prompt length; the stream after it barely moves.
Illustrative model fit to two measured points on Qwen3.8-27B NVFP4 (two RTX 5090s, vLLM 0.27.0): 60K tokens took 26.4 s to first token, 120K took 62.5 s, while decode held at 81 to 87 tok/s. The curve follows the measured ratio; the point is the shape.
Eight moments that built modern serving, 2022 to 2026. One tap per step, or use the arrow keys.
Five people and teams who built this, measured it, or poked holes in it. The real action is at the bottom, where the last two collide.
Frozen as of October 2026. Every item names its people. The research turned up real agreement on the direction and one named bet on where the decode loop itself is headed.
Inference is two machines sharing one box: a parallel reader that swallows your prompt in a single pass, and a serial writer that emits one token per pass, reading everything written so far from the KV cache. The wait before the first word is the reader. The stream after it is the writer. Everything in serving, batching, paging, chunking, speculating, is about keeping the writer fed without letting the reader interrupt it.
Every reply you have ever watched type itself out was this loop: read everything at once, then write one word at a time, rolling the dice on each.
Every factual claim in sections 2 through 5 traces to one of these.