Theory of Intelligence
DEEP LEARNING•Generative Deep Learning•Autoregressive And Multimodal Generation•4.1 Autoregressive Generation & Sampling

Introduction

How language models generate text one token at a time, and the decoding knobs that shape it: temperature, top-k and top-p (nucleus) sampling, with a step-by-step generation loop.

Introduction

GPT-style models (Sequences tab, topic 4.5) don't write a whole paragraph at once. They generate one token at a time: predict a probability for every possible next token, pick one, append it to the text, and repeat. This is autoregressive generation: each new output depends on all the previous outputs.

How you pick each token matters enormously. Always picking the most likely one gives safe but dull, often repetitive text. Picking randomly from the full distribution gives variety but sometimes nonsense. Sampling strategies like temperature, top-k and top-p let you choose a point between "predictable" and "creative".

Think of a jazz musician improvising. At each beat they choose the next note. A cautious player always plays the most expected note: correct but boring. A wild player picks any note: surprising but often wrong. Great improvisers choose among the good options, with a bit of surprise. That's what good sampling does.

Discuss theoretical concepts, mathematical formulas, and architectural foundations.

Supports inline code with `backticks`
No comments yet. Be the first to start the discussion!