BasicsOpen
What is temperature in AI, and why the dial is disappearing
A language model does not choose its next word. It ranks every candidate, and a throw of weighted dice does the rest. Temperature decides how heavily the dice are loaded. Here you can throw them yourself.
Temperature in AI is a number that sets how much chance decides a language model's next word. At 0, the model always takes its top-ranked candidate. At 1, it draws from its own probabilities as they stand. Higher values flatten those probabilities, so unlikely words get through more often.

It looks like the simplest setting in AI. It is also the most misread: guides promise that a low value makes answers factual and that 0 makes them repeatable. Neither is quite true, and the largest AI companies have started to remove the dial altogether.
How temperature works in an LLM
A model reads your text as tokens and gives a score to every token that could come next. A function called softmax turns the scores into probabilities. Temperature steps in just before that: each score is divided by it.2
There is an easier way to see what the division does. Take two candidates and look at the odds between them. Temperature raises those odds to the power of one over the temperature.
In our own measurement, an open model continuing "The old man opened the box and found a" gave small 26.6% and note 7.9%. The odds are about 3.4 to 1. At temperature 0.5 they are squared, to about 11 to 1. At temperature 2 they shrink to their square root, about 1.8 to 1. The ranking never changes. Only the gap does.
The name is borrowed from physics, where heat decides how often a system visits unlikely states. Neural networks took it over with Boltzmann machines in 1985.3
Try it: turn the dial on a real model
Three sentences, three kinds of knowledge. Start with the box, push the temperature to 2 and draw a hundred words. Then do the same with the Moon. Then try the person we made up.
The third sentence is the one to remember. A low temperature did not make the model more truthful about a person who was never born. It made the model pick March every time.
What 1,200 runs show
We let the same model continue two sentences 100 times at each of six temperatures, with every other filter switched off.
- Different story openings
- Runs that said Armstrong
"Different story openings" counts distinct first five words after "The old man opened the box and found a". At 0 there was one opening, repeated a hundred times. By 0.7 there were 88. Meanwhile the Moon landing held firm at 100 out of 100 up to temperature 1, then collapsed.
The text itself tells the story better than the count:
| Temperature | What the old man found |
|---|---|
| 0 | a small, silver key. He turned it over in his hand, feeling… |
| 0.7 | a single, bright, red stone. He smiled, knowing that this is… |
| 1.0 | a map of the city, with a red circle on each of the homes… |
| 1.5 | a silver toasterhlung! CBDishing Gene unique unexpectedly… |
| 2.0 | a voucher truly sooner plus past whole favorite queries… |
Between 0.7 and 1 sits invention. Past it lies noise, because tens of thousands of hopeless candidates, each nearly impossible, become likely together.
That last point was made in a 2019 paper with a lovely title, "The Curious Case of Neural Text Degeneration". It described an "unreliable tail" of improbable tokens, and showed the opposite failure too: always choosing the likeliest text gives bland prose that falls into loops.5
Temperature vs top-p: what is the difference?
The same paper introduced top-p, or nucleus sampling. Temperature reshapes the whole list. Top-p cuts it: keep the smallest group of candidates whose probabilities add up to p, and drop the rest.5
Its cousin top-k keeps a fixed number of candidates, however sure or unsure the model is.6 Go back to the dial, set the temperature to 1.5 and lower top-p to 0.5: most of the list switches off. OpenAI's documentation advises changing one of the two, not both.7
Is temperature 0 deterministic?
In theory, yes: the top candidate is always the top candidate. In practice, often not, as the Feynman test shows.
The usual explanation is rounding errors on graphics chips. Thinking Machines traced the larger cause elsewhere. A server processes your request together with other people's, and the size of that batch slightly changes the arithmetic. So your answer can depend on how busy the server was. With software rewritten to ignore batch size, all 1,000 of their answers came out identical.1 Our own machine, with no one else in the queue, also gave the same story a hundred times out of a hundred at 0.
It matters beyond curiosity. A separate study ran five models on eight tasks, ten times each, with settings meant to be deterministic. Accuracy varied by up to 15% between runs, and none of the models repeated itself on every task.8 If you compare models on one run each, part of what you measure is traffic.
Does a lower temperature mean fewer errors?
Less than people think. Researchers gave nine models multiple-choice problems at rising temperatures. From 0 to 1, they found no statistically significant difference in accuracy. In the model they pushed further, accuracy fell to zero by about 1.6.9
Our Moon test fits that shape. When a model knows something, a moderate temperature rarely hides it. When it does not, temperature 0 only makes the error consistent. That deeper problem has its own briefing: why AI models hallucinate.
Why AI companies are removing the dial
Here is what most guides have not caught up with. In November 2026, the documentation of the three largest model providers says this:
| Provider | What happens to temperature | Since |
|---|---|---|
| Anthropic | Non-default values return an error; on the API version dated 21 October 2026, any value does10 | Claude 4.7 and later |
| Ignored, with an error announced for future models11 | Gemini 3.6 Flash and 3.5 Flash-Lite, then all later models | |
| OpenAI | Must be left out of requests12 | GPT-6.2 migration guide |
| DeepSeek | Accepted but without effect in thinking mode13 | Thinking mode |
For earlier Gemini 3 models, Google had already warned that moving these settings from their defaults could degrade reasoning.14 Anthropic now points developers to prompting instead, and adds a quiet correction to years of folklore: temperature 0 "never guaranteed identical outputs".15
Our reading, which no provider states in these words: models that reason at length are tuned as a whole, and a thousand-step chain of thought is a poor place for a user to load the dice. The control that replaces it is effort: how long the model thinks, not how wildly.
On open models that you run yourself, the dial is still yours.
What temperature should you use?
If your model still accepts one, start from its documented default and change one thing at a time. DeepSeek publishes unusually concrete advice for its own API, and it is a useful corrective to the idea that every serious task wants a low number:
- One right answer (extraction, classification, code): low. It buys consistency, not knowledge.
- Many good answers (names, openings, ideas): near 1. Ask for ten and choose; that is what the dice are for.
- Nonsense appearing: lower the temperature or top-p, not both at once.
- Repeatable results required: do not rely on 0. Store the output, or run the model on software built for determinism.
Frequently asked questions
What is temperature in AI?
Temperature is a setting that controls how much chance decides a language model's next word. It divides the model's scores before they become probabilities: below 1 the favourites gain, above 1 the outsiders do.2
How does LLM temperature work?
The model scores every possible next token. Dividing the scores by the temperature widens or narrows the gaps between candidates, without changing their order, and then one token is drawn at random.2
What's a good temperature for AI?
It depends on the model and the task, so start from the documented default. DeepSeek, for example, suggests 0 for coding and math, 1.3 for conversation and 1.5 for creative writing.16
Is temperature 0 deterministic?
Not reliably. In a 2025 test, 1,000 requests at temperature 0 gave 80 different answers, because the size of the batch a server processes together changes the arithmetic slightly.1
Does a lower temperature reduce hallucinations?
It makes answers more consistent, not better informed. A study of nine models found no significant change in problem-solving accuracy between temperature 0 and 1.9
What is the difference between temperature and top-p?
Temperature reshapes the probabilities of all candidates. Top-p removes candidates, keeping only the smallest group whose probabilities add up to p.5
How we measured
We ran gpt-oss-20b on our own machine on 24 November 2026, giving it raw text without its chat format, so it continued sentences rather than answering as an assistant. Each story run was 14 tokens and each Moon run 3 tokens, with seeds 100 to 199. Top-k, top-p, min-p and repetition penalties were off. The interactive figure uses the model's 20 best candidates for one step, rescaled to 100%. Results from one compressed open model on one machine show the mechanism; they do not rank models.
References
- He, H. and Thinking Machines Lab, "Defeating Nondeterminism in LLM Inference", 10 September 2025. https://thinkingmachines.ai/blog/defeating-nondeterminism-in-llm-inference/
- Hinton, G., Vinyals, O. and Dean, J., "Distilling the Knowledge in a Neural Network", 2015, equation 1 (softmax with temperature), arXiv:1503.02531. https://arxiv.org/abs/1503.02531
- Ackley, D. H., Hinton, G. E. and Sejnowski, T. J., "A Learning Algorithm for Boltzmann Machines", Cognitive Science 9(1), 1985. https://doi.org/10.1016/S0364-0213(85)80012-4
- OpenAI, gpt-oss-20b open-weight model, Apache 2.0 licence. https://huggingface.co/openai/gpt-oss-20b
- Holtzman, A. et al., "The Curious Case of Neural Text Degeneration", ICLR 2020, arXiv:1904.09751. https://arxiv.org/abs/1904.09751
- Fan, A., Lewis, M. and Dauphin, Y., "Hierarchical Neural Story Generation", ACL 2018, arXiv:1805.04833. https://arxiv.org/abs/1805.04833
- OpenAI, API reference, "Create a model response", temperature and top_p parameters, accessed 24 November 2026. https://developers.openai.com/api/reference/resources/responses/methods/create
- Atil, B. et al., "Non-Determinism of 'Deterministic' LLM Settings", arXiv:2408.04667. https://arxiv.org/abs/2408.04667
- Renze, M. and Guven, E., "The Effect of Sampling Temperature on Problem Solving in Large Language Models", 2024, arXiv:2402.05201. https://arxiv.org/abs/2402.05201
- Anthropic, Claude documentation, "Working with the Messages API", note on sampling parameters, accessed 24 November 2026. https://platform.claude.com/docs/en/build-with-claude/working-with-messages
- Google, Gemini API documentation, "API changes and parameter updates" for Gemini 3.6 Flash, accessed 24 November 2026. https://aistudio.google.com/docs/whats-new-gemini-3.6
- OpenAI, API documentation, latest model guide, unsupported parameters for GPT-6.2, accessed 24 November 2026. https://developers.openai.com/api/docs/guides/latest-model
- DeepSeek, API documentation, "Thinking Mode", accessed 24 November 2026. https://api-docs.deepseek.com/guides/thinking_mode
- Google, Gemini API documentation, prompting strategies, note on model parameters, accessed 24 November 2026. https://aistudio.google.com/docs/prompting-strategies
- Anthropic, Claude documentation, Claude Opus 5.5 migration guide, "Sampling parameters removed", accessed 24 November 2026. https://platform.claude.com/docs/en/models/opus-5-5/migration-guide
- DeepSeek, API documentation, "The Temperature Parameter", accessed 24 November 2026. https://api-docs.deepseek.com/quick_start/parameter_settings


