Chip Foundry Services Request Assessment

Top-P Sampling (Nucleus)

Top-p sampling (nucleus sampling) selects the smallest set of tokens whose cumulative probability mass reaches a threshold p, then samples the next token from only that set. Unlike top-k sampling's fixed token count, top-p's included-token count varies naturally with the model's confidence at each step, since a highly confident prediction reaches the probability threshold p with very few tokens while a highly uncertain prediction needs to include many more tokens before reaching that same cumulative threshold.