Top-K Sampling limits the AI to choosing from the K most likely next words. Top-K=1: always picks the most likely word (deterministic). Top-K=50: chooses from top 50 options (more random). Higher K = more creative but less focused. Lower K = more predictable. Often used with Temperature. Most developers use Top-P (nucleus sampling) instead—it's more flexible. Top-K is simpler but cruder.
Most people don't adjust Top-K—use Temperature or Top-P instead, they're better. If you do use Top-K: set low (1-10) for factual tasks, high (50-100) for creative writing. OpenAI uses Top-P by default. Anthropic exposes Top-K. Don't tweak unless you understand the tradeoffs—Temperature is easier. Only adjust if default outputs aren't working.
Ai Vocabulary
Limit word choices