Skip to content

Glossary: Transformers Basics

Top-p sampling

Also written: top-p, nucleus sampling

Sampling from the smallest set of top tokens whose probabilities add up to at least p. It keeps few tokens when the model is sure and many when it is unsure.

Where the book teaches it

Related terms

Top-k samplingTemperature