Chip Foundry Services Request Assessment

Nucleus Sampling

Nucleus sampling (also called top-p sampling) restricts token selection to the smallest set of tokens whose cumulative probability exceeds a threshold p, then samples from only that restricted set rather than considering the full vocabulary. This adaptive restriction is nucleus sampling's key advantage over a fixed top-k cutoff: the actual number of tokens considered shrinks when the model is highly confident (concentrating probability on few tokens) and grows when the model is more uncertain (spreading probability across many tokens), automatically adjusting to the model's own confidence at each generation step.