Interactive Lab ยท LLMs

How does an AI choose its next word?

A language model doesn't "know" the next word, it produces a score for every word, then samples one. A single knob, temperature, controls whether it plays it safe or gets creative. Don't take my word for it, drag the knob and watch.

๐ŸŽฌ Watch the 45-second explainer, then turn the knobs yourself below โ†“

The setup, the model just read this prompt

"The weather today is โ–ฎ"

Below are the model's raw scores (logits) for what comes next. Higher = the model likes it more. But scores aren't probabilities yet, temperature + softmax turn them into the odds it actually rolls.

โ–ถ The playground, turn the knobs

0.1 ยท safe & boringcreative & risky ยท 2.0
1 ยท greedyall ยท full tail
Predictability

๐Ÿงญ Where this fits

Temperature is the first parameter in every LLM API call you'll ever make, OpenAI, Anthropic, Gemini all expose exactly this dial. The repeatable-vs-chaotic spectrum you just sampled is why code assistants run near 0.2 and creative-writing prompts near 1.0, and it composes with top-p (see that lab) in every production sampler.

The code that's actually running



  

๐Ÿ”ฎ Predict, then test

Set temperature to 0.3 and hit "Roll 25ร—". Now set it to 1.6 and roll again. Before you do: guess how many of the 25 will be "sunny" at each setting. Were you right? What does that tell you about when to use low vs. high temperature?

The takeaway

Your new mental model of temperature