Top-P Sampling
Domain: LLM Concepts
π― Motivation
Instead of a fixed number of options (Top-K), Top-P takes the smallest set of tokens whose probabilities sum to P (e.g., 0.9), adapting to how confident the model is.
π Concrete Example
If the model is 95% sure the next word is the, Top-P=0.9 only offers the. If itβs uncertain (many words at 5-10% each), Top-P=0.9 might include 10-15 options.
π Analogy
A smart multiple-choice test - if the question is easy, give just 2 options. If itβs hard, give 5. The number adapts to difficulty. Top-P adapts the candidate pool to model confidence.