# Top-p (nucleus sampling)

> A sampling setting that limits the model's next-word choice to the smallest set of tokens whose probabilities add up to p.

Source: Promptea — https://www.promptea.me/en/glossary/top-p · Language: English · Last updated: 2026-11-09

## What it means

- Definition: with top-p (also called nucleus sampling) at 0.9, the model considers only the most likely tokens whose combined probability reaches 90% and ignores the long tail of unlikely ones.
- Why it matters: it is another way to trade steadiness for variety. Lower values make answers more focused; values near 1 leave the full range open.
- How to apply it: providers commonly advise adjusting temperature or top-p, not both at once, so you can tell what changed the result. Many chat products do not expose either; check the API or playground documentation of the model you use.
- Setting it low does not make an answer true — it only narrows word choice. For reliable structure rely on a precise prompt and validation.

## Example

```text
I will run this prompt with a low top-p for consistency.
Task: write a 2-sentence product description for [product].
Constraints: plain language, one concrete benefit, no superlatives.
Return only the two sentences.
```

[Open in Promptea](https://www.promptea.me/en/analyzer?prompt=I+will+run+this+prompt+with+a+low+top-p+for+consistency.%0ATask%3A+write+a+2-sentence+product+description+for+%5Bproduct%5D.%0AConstraints%3A+plain+language%2C+one+concrete+benefit%2C+no+superlatives.%0AReturn+only+the+two+sentences.&purpose=text&target=gpt)

## Frequently asked questions

### What is the difference between top-p and temperature?

Temperature reshapes the probability of every token; top-p cuts the list of candidates to the likeliest ones. Both control randomness, in different ways.

### Do I need to set top-p?

Rarely. The provider's default works for most prompts. Reach for it when you call an API and need a specific balance of consistency and variety.

## Related

- [Structured output prompting: how to get reliable JSON, tables, and lists from any AI](https://www.promptea.me/en/guides/structured-output-prompting)
- [AI brainstorming prompts: generate and filter ideas without generic filler](https://www.promptea.me/en/guides/brainstorming-prompts)
- [How to score and improve your prompt quality before sending it](https://www.promptea.me/en/guides/prompt-quality-scoring)
- [Temperature](https://www.promptea.me/en/glossary/temperature)
- [Tokens](https://www.promptea.me/en/glossary/tokens)
