Home▸AI & Machine Learning▸Token Sampling Lab: Temperature, Top-k & Nucleus Sampling

Token Sampling Lab: Temperature, Top-k & Nucleus (Top-p)

Interactive 3D simulator of how a language model picks its next word: watch a token-probability distribution reshape live as you drag temperature, top-k and top-p (nucleus) sliders, then sample a real token from it.

AI & Machine Learning3DModerate60 FPS📱 Mobile-adapted⇄ 2D version
Token Sampling Lab: Temperature, Top-k & Nucleus Sampling ↗ Open standalone

Every time a large language model writes a word, it first computes a probability for every token in its vocabulary, then samples one. This simulator renders that vocabulary as a ring of 3D bars whose heights are live token probabilities, and lets you drag the same three decoding knobs real LLM APIs expose — temperature, top-k and top-p (nucleus) — to watch the distribution sharpen, flatten, and get truncated in real time. Pressing "Sample next token" performs a real weighted random draw over whatever survives the filters and appends the chosen word to a growing sentence, while live readouts track the distribution's entropy, how many candidates remain after filtering, and the probability of whichever token just got picked.

⚙ Under the hood

Watch a language model's next-token probability distribution reshape in 3D as you drag temperature, top-k and top-p (nucleus) sliders, then sample a real weighted-random token from it.

LLMsamplingtemperaturetop-pdecodingNLP

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)