How does autoregressive decoding work? Temperature, top-k, top-p?medium

Type
conceptual
Topic
does-autoregressive-decoding-work-temperature-top-k-top-p
Frequency
common
Tags
llms, how, does, autoregressive, decoding, work
Answer

At each step, model outputs a probability distribution over vocabulary, samples a token, appends it to context, repeats.

Explanation

At each step, model outputs a probability distribution over vocabulary, samples a token, appends it to context, repeats. Temperature scales the distribution (lower = more deterministic). Top-k samples only from the k highest-probability tokens. Top-p (nucleus sampling) samples from the smallest set whose cumulative probability ≥ p — adapts dynamically, preferred over fixed top-k.

Follow-upCan you give a production example?