Temperature
In short
Temperature is a setting that changes how random a language model's word choices are. A low value favours the most likely next words. A high value flattens the odds, so less likely words can appear.
- Also called
- Sampling temperature, Softmax temperature
- Topic
- How AI models work
- Level
- Beginner
- First described
- Holtzman and colleagues trace temperature, as a way to reshape a probability distribution before sampling text, to Ackley, Hinton and Sejnowski (1985). Their 2019 paper states the formula used in text generation.1
A language model ends each step with a score for every possible next token. Those scores are turned into probabilities, and a token is picked. Temperature sits inside that conversion. Holtzman and colleagues write it as a softmax of the scores divided by a temperature t: the probability of a token is proportional to e raised to its score divided by t.1
They report that a t below 1 pushes probability towards the already likely tokens and shrinks the tail of rare ones. Lowering temperature makes the text more coherent and less varied, and it increases repetition. They also argue that temperature does not reliably cut off the long tail of unlikely tokens, which is why they introduced nucleus sampling, also called top-p, as a separate control. They trace the device to Ackley, Hinton and Sejnowski's 1985 paper on Boltzmann machines.1
APIs in 2026 do not all still offer the dial. OpenAI's Responses API documents temperature as a number from 0 to 2. Higher values such as 0.8 make the output more random. Lower values such as 0.2 make it more focused and deterministic. OpenAI recommends changing temperature or top-p, but not both.2 Its guide to GPT-6 says that when reasoning effort is not set to none, temperature should be left out of the request, along with top-p.3
Anthropic marks the parameter as deprecated. Models released after Claude Opus 4.6 do not support setting it. A value of 1.0 is accepted for backwards compatibility, and any other value is rejected with a 400 error. On older models the range was 0.0 to 1.0, nearer 0 for analytical tasks and nearer 1 for creative ones. Anthropic notes that even a temperature of 0.0 is not fully deterministic.4
Google's note on Gemini 3.8 Flash tells developers to remove temperature, top-p and top-k as deprecated.5 An earlier Gemini 3 guide had instead said to keep temperature at the default of 1.0, and warned that a value below 1.0 could cause looping or worse results on hard reasoning tasks.6
Temperature does not measure whether an answer is true. It only changes which of the model's scored words are likely to be picked.12 It is not top-p. Top-p drops the low-probability tail, while temperature rescales every score.1
Example
OpenAI's documentation uses 0.2 as its example of focused, deterministic output and 0.8 as its example of more random output. On a request for a cafe name, the lower setting stays with likely words and the higher setting can let less likely words through.2
Why it matters
It was the simple dial for a safer answer or a more surprising one. On several current APIs the setting is deprecated or rejected, so that advice is no longer universal.345
Questions people ask
Is temperature the same as top-p?
No. Temperature rescales every score before the probabilities are computed. Top-p, or nucleus sampling, keeps the smallest set of tokens that covers a chosen share of the probability and drops the rest. OpenAI says to change one of the two, not both.12
Related terms
Sources
- Holtzman, Buys, Du, Forbes and Choi, The Curious Case of Neural Text Degeneration, arXiv:1904.09751 (ICLR 2020)
- OpenAI, Responses API reference, create method, temperature parameter (read 12 October 2026)
- OpenAI, Using GPT-6, API parameter guidance (read 12 October 2026)
- Anthropic, Create a Message, temperature parameter (read 12 October 2026)
- Google, What's new in Gemini 3.8 Flash, migration note on deprecated sampling parameters (read 12 October 2026)
- Google, Gemini 3 developer guide, temperature section (read 12 October 2026)