Top-p sampling

Also: nucleus sampling, top-p

Keeping the smallest set of tokens whose probabilities add up to p, then sampling from that set. The cutoff moves with the model's confidence: a near-certain continuation leaves one candidate, an open-ended one leaves hundreds.

A definition is not an understanding. This is taught properly in How a model picks the next token, part of Sampling & decoding.

Learn this properly