LiveFR

Top-k (sampling)

Definition: Top-k limits the next-word choice to the k most probable candidates, from which the model samples one at random.

A small k makes the output safer and more repetitive, a large k makes it more varied. It is often used alongside top-p and temperature.

See also

← Full AI glossary · AI news