Top-P

Nucleus sampling — choosing from the smallest set of tokens whose probabilities sum to P.

Top-P, also called nucleus sampling, controls randomness by dynamically adjusting how many candidate tokens the model considers. Rather than fixing a count, it includes the fewest tokens whose cumulative probability reaches the threshold P, so the pool shrinks when the model is confident and grows when it is uncertain. In Amazon Bedrock, Top-P sits alongside temperature and Top-K as an inference parameter. The exam distinction: Top-K fixes the candidate count regardless of the distribution, while Top-P adapts to it, so a low value like 0.1 yields more deterministic output.

PlayPrepHQ study notes are written and reviewed against primary exam sources. How we create & review content →

Related terms

Back to Applications of Foundation Models