SESK: Stuff Everyone Should Know · sesk.info/ai-nucleus-top-p-sampling
What does nucleus (top-p) sampling do when picking the next token?
Samples only from the most likely tokens and cuts off the unreliable tail.
- Always picks the single most likely token
- Picks any token in the vocabulary equally
- Samples from the top tokens, dropping the unlikely tail ✔
Why: Top-p keeps the smallest group of tokens whose probabilities add up to p, then samples among them. You still get variety, but the weird low-probability tokens are thrown out.
Huh, didn't know that: Nucleus sampling was introduced in the 2019 paper The Curious Case of Neural Text Degeneration.
Nucleus sampling is like ordering at a restaurant. You pick from the favorites, not the mystery soup.
Like this card?
References
Answer: Samples from the top tokens, dropping the unlikely tail. Top-p keeps the smallest group of tokens whose probabilities add up to p, then samples among them. You still get variety, but the weird low-probability tokens are thrown out.
- Holtzman et al., The Curious Case of Neural Text Degeneration (arXiv 1904.09751) arxiv.org/abs/1904.09751
sampling text from the dynamic nucleus of the probability distribution, which allows for diversity while effectively truncating the less reliable tail
Checked 2026-10-10.
Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.
More stuff everyone should know
That's stuff everyone should know.