Top-K Sampling (TopK)

A setting that restricts an AI to picking its next word from only the K most likely options, ignoring all less probable choices.

Technically: At each step, Top-K sampling keeps only the K highest-probability tokens, renormalizes their probabilities (proportionally, not uniformly), and samples from that pool. The fixed cutoff is simple and fast but ignores the model's varying confidence — K=50 may admit implausible tokens when the model is certain. Often paired with temperature or Top-P to soften its rigidity.

Category: Prompting & Inference

Related ideas