Top-p (Nucleus) Sampling
Sampling the next token from the smallest set of candidates whose probabilities sum to p.
Instead of considering all tokens, nucleus sampling keeps only the most probable ones up to a cumulative probability p (e.g. 0.9), then samples from that "nucleus." It adapts the candidate pool to the model’s confidence and is often used alongside temperature.