LLM Sampling Visualizer
Every token an LLM writes is picked from a probability distribution. Drag the sliders below and watch how temperature, top-p, and top-k reshape a real softmax distribution, then hit Sample to draw a token the same way a model does.
Temperature divides every logit before the softmax. Low values sharpen the distribution so the most likely token dominates (at 0 it becomes pure argmax, always "Paris"). High values flatten it, giving unlikely tokens a real chance, which reads as more creative but also more error-prone.
Top-p keeps only the smallest set of tokens whose probabilities add up to at least p, then renormalizes and samples from that "nucleus". At p = 1 nothing is cut. At p = 0.5 you only sample from the tokens covering the top 50% of probability mass, trimming the long tail of nonsense.
Top-k is a hard cutoff: keep only the k highest-probability tokens and throw the rest away before sampling. k = 1 is greedy decoding (always the single best token). Unlike top-p, the cutoff does not adapt to how confident the model is, it is always exactly k tokens.