Back to glossary
Parameters

Top-P (Nucleus Sampling)

Sampling parameter limiting choices to tokens whose cumulative probability is ≤ P.

Definition

Top-P (also called nucleus sampling) is a sampling parameter that limits the model's next-token choices to the smallest set whose cumulative probability is at or below P. Top-P 0.9 means the model considers only tokens that together account for 90% of probability mass. Top-P interacts with temperature; in practice most users tune temperature and leave top-p at default (typically 0.95-1.0).

Example

Top-P 0.5 produces tighter, more predictable output. Top-P 1.0 considers all tokens, giving maximum variety.

When to use

Tune when temperature alone doesn't give the variation control you need. Most users leave at default.

Also known as

nucleus sampling

Related terms

Free Chrome Extension

Stop rewriting prompts. Start shipping.

Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 5.0★ on the Chrome Web Store.

Add to Chrome — Free