Secure Systems Group
Menu×

Wiki Home

Decoding and sampling strategies

Definition

An autoregressive language model emits one token at a time, each drawn from a distribution over the vocabulary conditioned on the prompt and the tokens generated so far. A decoding strategy decides how to turn that distribution into an actual token. Greedy decoding takes the single most probable token; sampling draws a token at random from the distribution. Three knobs shape sampling: temperature rescales the logits so the distribution is flatter (more random) or sharper (more deterministic); top-k restricts the draw to the k highest probability tokens; top-p, or nucleus sampling, restricts it to the smallest set of tokens whose probabilities sum past p. These are inference-time settings and do not change the model weights.

Prefilling forces a response to begin with a fixed string, so the model continues from chosen opening tokens rather than picking its own first token. A locally served open model exposes full control over decoding and prefilling; some hosted interfaces expose prefilling for steerability. Because the same controls are available to whoever calls the model, they are also an attack surface.

Papers that use this concept

See also