Top-p (nucleus) sampling
Keeps the smallest set of tokens whose probabilities already add up to p, then samples within it. The cutoff moves with the model's confidence, which is what makes it behave better than a fixed top-k.
- The full vocabulary.
- The nucleus — the kept set.
- The cumulative probability mass to retain, often 0.9.