HomeGlossary › Top-K Sampling

Top-K Sampling

A definition from the GenAI for Business glossary.

Top-K limits how many possible next words (tokens) the model considers. For example, with K = 50, the model only looks at the 50 most likely next words and picks one according to their probabilities. This helps control randomness and ensures coherent, focused output, often used together with Top-P (nucleus sampling).

Want the full picture? This term comes from GenAI for Business, a complete free book on generative AI strategy and implementation by Prof. Shubin Yu (HEC Paris).
TemperatureRetrieval-Augmented Generation (RAG)