Inference / Decoding
verifiedAutoregressive Decoding
A language model does not write a sentence, it writes a token and then reads what it wrote. Each step produces a distribution over the vocabulary, one token is chosen from it, and the choice becomes part of the input for the next step. The whole output is that loop, run until something stops it.
Every step is a full forward pass for a single token, which makes generation memory-bound rather than compute-bound: the weights are read in their entirety to produce one token. That imbalance is why batching helps so much, and why speculative methods that verify several tokens per pass are worth the complexity.
x sub t ~ p(· | x sub <t ) with p from a softmax over logits, optionally temperature-scaled or truncated by top-k or nucleus sampling. Generating n tokens costs n sequential forward passes regardless of hardware width, so latency is bounded by depth rather than throughput.
8 values. The left group decays steeply; the right group is 33% of the way to flat, and reads flatter than the left.
The distribution over candidate tokens at one step, before and after temperature. Drag it up to watch the choice spread out toward uniform — the collapse onto one token is the same knob turned the other way, past the left edge of this figure.
Reviewed by opendroid · 2026-08-17
- arXiv:2005.14165 — Language Models are Few-Shot Learners
- arXiv:2211.05102 — Efficiently Scaling Transformer Inference