Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
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.
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.
What an interviewer would ask next. Try answering before peeking at the approach.
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.