AJ Learning Hub logoAJ Learning Hub

Top-p / Nucleus Sampling

also nucleus sampling

Top-p is a sampling method where the model only chooses from the smallest set of next tokens whose combined probability exceeds a threshold p, trimming off unlikely options.

Analogy

Like only picking from the most likely answers that together make up 90% of the odds, ignoring the long-shot rest.

Why it matters

It is an alternative to temperature for tuning output variability, useful when you need fine control over how predictable an automated response is.

In practice

With top-p of 0.9, the model samples only from the top tokens covering 90% of the probability mass.

Related terms:TemperatureInferenceToken