Reference · Glossary

Top-p (nucleus sampling)

A sampling setting that limits the model to the **smallest set of likely next tokens** whose combined probability reaches *p* — trimming long tails of weird choices.

When to use

Pair with temperature for creative writing. Lower top-p (0.1–0.5) keeps outputs focused; higher allows more variety.

When not to

For deterministic code or JSON, prefer low temperature **and** low top-p (or greedy decoding).

Example

At top-p 0.9, the model might consider only the top words that together cover 90% of probability — dropping rare tokens like nonsense spellings.