Top-p (Nucleus Sampling)
Also known as: Nucleus Sampling, Top-k, Sampling Strategy
In one sentence
A parameter that controls randomness in AI text generation by choosing from the smallest set of words whose probabilities add up to p%. Lower values (0.1-0.5) make output more focused; higher values (0.9-1.0) make it more creative.
Explain like I'm 12
Imagine the AI has a list of possible next words ranked by how likely they are. Top-p says 'only pick from the most likely words that add up to 90%' (if p=0.9). This makes the AI more predictable than letting it pick from all words.
In context
Example: For factual tasks use top-p=0.1-0.3 for consistency. For creative writing use top-p=0.8-0.95 for variety. Top-k is similar but picks from the top K words (e.g., top-k=40 means choose from the 40 most likely words).
See also
Related Guides
Learn more about Top-p (Nucleus Sampling) in these guides: