711
Dictionary

Top-p (Nucleus Sampling)

Restricting sampling to the smallest set of tokens whose probability sums to p.

1 min readupdated 2026-07-04

/ quick answer

Top-p sampling picks from the smallest set of highest-probability tokens whose cumulative probability exceeds p (e.g. 0.9), producing more coherent output than pure temperature scaling. Restricting sampling to the smallest set of tokens whose probability sums to p.

Restricting sampling to the smallest set of tokens whose probability sums to p. Top-p sampling picks from the smallest set of highest-probability tokens whose cumulative probability exceeds p (e.g. 0.9), producing more coherent output than pure temperature scaling. In practice: top_p=0.9 with temperature=0.7 is a common default for creative writing.
Definition
Top-p sampling picks from the smallest set of highest-probability tokens whose cumulative probability exceeds p (e.g. 0.9), producing more coherent output than pure temperature scaling.
Example
top_p=0.9 with temperature=0.7 is a common default for creative writing.

/ frequently asked

What is Top-p (Nucleus Sampling)?

Top-p sampling picks from the smallest set of highest-probability tokens whose cumulative probability exceeds p (e.g. 0.9), producing more coherent output than pure temperature scaling.

What is an example of Top-p (Nucleus Sampling)?

top_p=0.9 with temperature=0.7 is a common default for creative writing.

Why does Top-p (Nucleus Sampling) matter?

Restricting sampling to the smallest set of tokens whose probability sums to p.

What should I learn after Top-p (Nucleus Sampling)?

Open the related workflows and prompts further down this page: they show how this idea is applied in a real task, step by step.

/ continue exploring

Related concepts

The vocabulary this page depends on.

all dictionary →

Related workflows

Turn this into a repeatable process.

all workflows →

Related tool stacks

The tools that run it in production.

all tool stacks →

Related prompts

Reusable prompts for this job.

all prompts →

Comparisons & alternatives

Pick between the options.

all comparisons →