LLM Sampling Explorer

See what temperature, top-k, top-p and min-p do to a model's next-token choices.

After sampling

Examples

Questions

What does temperature do?

It divides every logit before the softmax. Below 1, the top token gets even more of the probability. Above 1, unlikely tokens get a real chance. At 0 the model always takes the most likely token (greedy decoding).

What is the difference between top-k, top-p and min-p?

All three remove unlikely tokens, in different ways. Top-k keeps a fixed number of tokens. Top-p keeps the smallest set whose probabilities add up to p. Min-p keeps tokens at least p times as likely as the top one.

In what order are they applied?

Temperature, then top-k, then top-p, then min-p, as in Hugging Face transformers. Some runtimes let you change the order, which can change the result.

Are these real model outputs?

No. The examples are made-up logits. Paste your own, one token and logit per line. The maths is exact for what you enter, and nothing here calls a model.