LLM Decoding Playground: Temperature, Top-k, Top-p

A language model outputs probabilities, not words. See how temperature, top-k and top-p decide what comes next.

Large language models don't choose words directly: at every step they output a probability for each possible next token. A decoding strategy then turns those probabilities into an actual choice, and the settings you see in LLM APIs (temperature, top-k and top-p) control exactly that step.

Pick a prompt and move the sliders. Temperature rescales the scores before the softmax: values below 1 sharpen the distribution (safer, more predictable), values above 1 flatten it (more creative, more surprising), and 0 means greedy decoding. Top-k keeps only the k most likely tokens; top-p (nucleus sampling) keeps the smallest set of tokens whose probabilities add up to p, so the number of candidates adapts to how confident the model is.

Sample one token at a time or a hundred at once and compare your samples with the probabilities. Try top-p 0.5 on a confident prompt like "The capital of France is" and on an open one like "My favourite colour is" to see why nucleus sampling adapts while top-k does not.

Schedule a meeting