Lab

Temperature & top-p playground

Drag two sliders and watch a language model's next-token distribution sharpen, flatten and lose its tail.

temperature-playgroundinteractive
  • mat47.1%
  • floor23.4%
  • sofa14.2%
  • windowsill7.8%
  • keyboard4.3%
  • roof2.6%
  • moon0.5%
  • spreadsheet0.2%

What you’re looking at

Each bar is one candidate next token. Its probability comes from a softmax over made-up logits:

  • Temperature rescales the logits before the softmax. Low sharpens the distribution and high flattens it. The ranking never changes.
  • Top-p (nucleus sampling) keeps the smallest set of tokens whose probabilities add up to at least and drops the rest. Then it renormalises.
  • Entropy measures how uncertain the distribution is, in bits. With 8 candidates the maximum is 3 bits.

Everything runs in your browser. Nothing is sent anywhere.