Skip to content
ai

Top-p

Top-p (Nucleus) Sampling

Definition

Top-p (nucleus) sampling selects the smallest set of tokens whose cumulative probability exceeds p, then samples from this nucleus. Unlike top-k, the nucleus size adapts to the model's confidence — when the model is certain, few tokens dominate, and when uncertain, more tokens are included.

A typical production value is p=0.9 or p=0.95, balancing diversity against incoherence.

Can this ship? Are we exposed? Can you prove it?

Every CISO is asking these three questions. We answer them with facts, not guesses, from repository to runtime.