# Top-p Sampling

> Top-p sampling, also called nucleus sampling, draws each next token only from the smallest set of candidates whose cumulative probability exceeds a threshold p.

- Identifier: PTL-0007
- Category: Foundations
- Canonical URL: https://protologue.com/t/top-p-sampling/
- Also known as: nucleus sampling
- Introduced: 2019

## Description

It was proposed to avoid both the repetitive text produced by greedy or beam decoding and the incoherent text produced by sampling from the full distribution. It is usually combined with temperature.

## Related terms

- [Temperature](https://protologue.com/t/temperature/)

## Sources

- Holtzman et al. (2019). The Curious Case of Neural Text Degeneration. https://arxiv.org/abs/1904.09751

## Cite this entry

Protologue. (2026). Top-p Sampling. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.0.0, PTL-0007). https://protologue.com/t/top-p-sampling/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
