Back to glossary
AITerm

Top-p / Top-k

top-p sampling · nucleus sampling · top-k sampling · sampling parameters

Top-p and top-k limit candidate tokens during sampling. Supported controls and their interaction depend on the model.

Top-p, or nucleus sampling, limits sampling to a set of tokens whose cumulative probability reaches a chosen threshold. Top-k instead limits candidates to a specified number of the highest-probability tokens, where supported. The supported values and interaction with other settings depend on the model implementation.

It can affect variation, but it does not establish factual accuracy or guarantee repeatable output. Not every model exposes this control.

Evaluate representative tasks before changing sampling settings, and avoid attributing an improvement to one parameter when several inputs or model versions changed together.

Related terms

Need help applying this to your project?

I review metrics, calculate unit economics and build measurable funnels. Book a free 30-minute introduction to discuss your project.