Top-P (Nucleus Sampling) — AI Glossary

Top-P, also known as nucleus sampling, is a parameter that controls which tokens the model considers when generating each word. It sets a cumulative probability threshold — for example, Top-P of 0.9 means the model only considers the smallest set of tokens whose combined probability reaches 90%, filtering out unlikely options. It works alongside temperature to fine-tune output randomness.