Home▸Algorithms & AI▸LLM Next-Token Sampling Lab: Temperature, Top-k, Top-p and Entropy

🎲 LLM Next-Token Sampling Lab: Temperature, Top-k, Top-p and Entropy

Edit the logits of a 12-token vocabulary and watch softmax with temperature, top-k, top-p (nucleus), min-p and repetition penalty reshape the next-word distribution, with entropy, perplexity, chi-square checks, a Gumbel-max equivalence test and a toy bigram sentence generator (not a real language model). Unlike the existing attention and tokenization labs, this one covers the decoding step.

Algorithms & AI2DModerate60 FPS📱 Mobile-adapted
llm-next-token-sampling-temperature-top-k-top-p-softmax-entropy-lab ↗ Open standalone
⚙ Under the hood

Edit the logits of a 12-token vocabulary and watch softmax with temperature, top-k, top-p (nucleus), min-p and repetition penalty reshape the next-word distribution, with entropy, perplexity, chi-square checks, a Gumbel-max equivalence test and a toy bigram sentence generator (not a real language model). Unlike the existing attention and tokenization labs, this one covers the decoding step.

Trending ScienceAILanguage ModelsProbabilityEntropy

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)