GenAIWiki
Inference

Top-p

Top-p, or nucleus sampling, draws the next token from the smallest set of tokens whose cumulative probability exceeds p.

Expanded definition

Instead of always taking the argmax or sampling the full vocabulary, top-p truncates the tail of the distribution. p=0.9 is a common starting point. Combined with temperature, it controls diversity. For JSON, tools, and classification, greedy or very low-p sampling is usually safer. Always record temperature, top-p, and top-k together in eval logs because they interact.

Related terms

Explore adjacent ideas in the knowledge graph.

Top-p FAQ

What is Top-p?

Top-p, or nucleus sampling, draws the next token from the smallest set of tokens whose cumulative probability exceeds p.

How is Top-p used in AI systems?

Instead of always taking the argmax or sampling the full vocabulary, top-p truncates the tail of the distribution. p=0.9 is a common starting point. Combined with temperature, it controls diversity. For JSON, tools, and classification, greedy or very low-p sampling is usually safer. Always record temperature, top-p, and top-k together in eval logs because they interact.

Related

Comparisons, tools, and models that connect to this idea.