Skip to content

Top-p

← All terms · AI providers and models

Also called Nucleus sampling

A parameter that controls output randomness by restricting the AI to only choose from a subset of the most probable next tokens.

What it is

Top-p (nucleus sampling) alters the pool of available tokens the model can select from. A Top-p of 0.9 means the model only considers the tokens that make up the top 90% of the probable mass. It is an alternative to Temperature for controlling creativity and ensuring the model doesn't output complete nonsense.

When you would use it

You use Top-p alongside or instead of Temperature when you want to restrict the model from picking wildly improbable words, while still allowing for some natural variance.

Common operations

  • Fine-tuning the balance between creativity and coherence in text generation.

Related terms

Where this is taught

No learning path uses this term yet. Browse the Learning Atlas for guided sequences through related ideas.