Autoregressive generation samples one token at a time conditioned on every token before it. Each step emits a vocab distribution, samples a token, appends it to the context, and repeats until a stop condition fires.
Imagine writing a story one word at a time, where every word you pick depends on everything you have already written. After each word, you look back at the whole draft and ask, given all of this, what feels like the next word. You sample one option, write it down, and ask the question again with the longer draft. That loop is autoregressive generation. The model is the author, the draft is the context, the sampling step is the actual choice of word, and the loop only stops when the model itself decides to end the story (the end-of-text token), or when it runs into a stop word the user set, or when it hits a maximum length cap.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
2 min: autoregressive factorization + four-step decode loop + KV cache as the inference-time response + termination conditions + why every optimization respects the dependency.
Real products, models, and research that use this idea.
- GPT-5.5, Claude Opus 4.7, Gemini 3.1 Pro, Llama 4 Maverick, and DeepSeek V4 are all autoregressive transformers; the entire frontier model lineup in 2026 still uses the same left-to-right factorization.
- vLLM, SGLang, and TensorRT-LLM all implement the same autoregressive decode loop under the hood, differing only in how they manage the KV cache and schedule the batches.
- DeepSeek V4 ships multi-token prediction during training to amortize the autoregressive loop at inference, generating several tokens per forward pass when speculation succeeds.
- Medusa (Stanford) and EAGLE (Microsoft) are speculative-decoding techniques that propose multiple tokens per step while preserving the autoregressive distribution exactly.
- OpenAI's o-series, Anthropic's extended-thinking Opus, and DeepSeek V4 reasoning all autoregressively generate hidden chain-of-thought tokens before the visible answer, which is why those models bill more output tokens per request.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy is prefill parallel while decode is sequential, even though both use the same model?
QHow does speculative decoding preserve the autoregressive distribution while running multiple tokens per step?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Believing the model generates the full output in one shot. Each token is its own forward pass, conditioned on every earlier token, which is what makes decode slow and bandwidth-bound.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.