Glossary · Models & inference

Top-k Sampling

A decoding method that restricts the next-token distribution to the k highest-scoring candidates, renormalizes their probabilities, and samples from that set.

Why it matters

It removes the long low-probability tail from sampling while keeping a fixed maximum candidate count.

In practice

Evaluate k together with temperature, top-p, and stop settings, and record the complete sampler configuration with generated results.

Common confusion

Top-k uses a fixed candidate count, while top-p uses a probability-mass threshold whose candidate count changes by step.

Related terms

Sources

Browse the learning paths to see this term in context — every lesson is free to read.