Plain-language explainer
Temperature, explained
Temperature is a sampling setting that reshapes a language model's next-token probabilities before one is chosen. Low temperature sharpens the distribution so the top choice almost always wins, giving consistent answers. High temperature flattens it so less likely tokens get real chances, giving variety and more errors. It never changes what the model knows.
What does the temperature setting actually do to an AI model?
Temperature reshapes the model's next-word probabilities before it picks one. Low temperature sharpens them, so the top choice wins almost every time and answers come out consistent. High temperature flattens them, so second and third choices get real chances, which reads as variety or creativity, and sometimes as nonsense. It changes nothing about what the model knows. It only changes how much risk the model takes when choosing among words it already considers plausible.
Last reviewed
Reading is the slow way. Start with a free lesson you can operate right now.
Start free: Predict the next word →Free, no code, no signup.
Ten seconds, no lesson: play with the standalone widget, and embed it in your own page.
Then go deeper: Tuning the model's creativity Locked
What people get wrong
- Temperature makes the model more creative, like a mood. It is arithmetic on probabilities, nothing more.
- Temperature 0 means the answer is correct. It means the answer is consistent. A confidently wrong top pick stays wrong at every temperature.
- High temperature unlocks hidden knowledge. Same knowledge, riskier picks among the words the model already had in mind.
Where you see it in real products
- API playgrounds expose the dial directly, usually from 0 to 2.
- Writing tools' precise and creative modes are largely this one setting.
- The regenerate button gives a different answer because sampling rolls the dice again.
Common questions
- What temperature should I actually use?
- Near zero for anything with a right answer: extraction, classification, code, structured output. Around 0.7 to 1.0 for brainstorming and drafting where variety helps. If you are unsure, start low, since you can always ask again for more options.
- Does temperature 0 guarantee the same answer every time?
- It makes it very likely, not guaranteed. Providers batch requests and the arithmetic can differ slightly between runs, so answers can still vary. Treat repeatability as a strong tendency rather than a contract.
- What is the difference between temperature and top-p?
- Temperature reshapes the whole distribution. Top-p first throws away the long tail, keeping only the most likely options that add up to p, then samples from what is left. They are often used together, and changing both at once makes results hard to reason about.
- Why do I get different answers to the same prompt?
- Because the final step is a random draw from the model's next-token probabilities, and at any temperature above zero the draw can land on a different token each time. Setting temperature to zero makes the top token win every time, which makes answers repeatable but not more correct.
- Is temperature the same across providers?
- The formula is the same, dividing the scores by the temperature before softmax, but the useful range differs by model and the defaults differ by product. Most APIs accept 0 to 2 and default near 1 or 0.7. Treat the number as a dial to tune per task, not a universal constant.
Related explainers
More in Speed, cost and control
- What is model routing, and how do you choose which AI model to use?
- What is the KV cache, and why does it matter for speed and cost?
- What is quantization, and how does it let big models run on small hardware?
- Why are GPUs, and not CPUs, the hardware of the AI boom?
- How do reasoning models actually work?
- What is speculative decoding and why does it make models faster?
- What is prompt caching and how much does it actually save?
- Why is running AI so expensive, and what are you paying for?
One idea at a time, in your inbox
New lessons and explainers, written the way these pages are. Now and then, not daily, and never a sales sequence.
We email you a confirmation link first. Unsubscribe in one click, any time. Privacy.
Part of See How AI Works, a free interactive course, where you learn how modern AI works by operating it, not watching videos.