AI Blog

AI Blog

by Michele Laurelli

Nucleus Sampling (Top-P)

Technique
Definition

Text generation sampling from smallest set of tokens whose cumulative probability exceeds threshold P.

Dynamically adjusts vocabulary size based on probability distribution. More flexible than top-k. Common: P=0.9-0.95.

Examples

1

P=0.9 for diverse generation

2

Dynamic vocabulary selection

3

Better than top-k

Michele Laurelli - AI Research & Engineering