Book a demo →

LLM Temperature

Definition

LLM temperature in the sources: how IBM and vendor docs define it, ranges and defaults, what temperature 0 does, and models that no longer accept it.

In short

LLM temperature is a setting that changes how random a language model's word choice is when it writes text. Vendors give different ranges and defaults, and their pages differ on whether temperature 0 repeats an answer. Anthropic, Google and OpenAI document newer models that do not take the setting.

What is LLM temperature?

The sources describe LLM temperature as a setting for how much chance enters the choice of the next word or token. On 6 December 2026, the six definitions read as follows:

Source and dateWording
IBM, “What is LLM Temperature?” (published 16 December 2024, updated 2 April 2026)“Temperature controls the randomness of text that is generated by LLMs during inference.”
OpenAI API reference, Chat Completions (page without date)“What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.”
Anthropic Messages API reference, archived copy of 16 September 2025“Amount of randomness injected into the response.”
Google Cloud, “Content generation parameters” (last updated 4 December 2026)“Temperature controls the degree of randomness in token selection.”
Renze and Guven, arXiv 2402.05201, version 3 (2 October 2024)“Sampling temperature is a hyperparameter of an LLM used in a temperature-based sampling process.”
Ollama Modelfile documentation (page metadata 3 December 2026)“The temperature of the model. Increasing the temperature will make the model answer more creatively.”

Four of the six quotes speak of randomness (IBM, OpenAI, Anthropic and Google). Renze and Guven call temperature a hyperparameter, and the Ollama documentation ties a higher value to answers given “more creatively”.

How temperature changes the choice of the next word

IBM writes: “LLMs generate text by predicting the next word (or rather, the next token) according to a probability distribution.” The same page continues: “A lower temperature essentially makes those tokens with the highest probability more likely to be selected; a higher temperature increases a model's likelihood of selecting less probable tokens.” Renze and Guven (version 3) put the temperature into the softmax formula: “In this modified softmax function, vk is the k-th vocabulary token, lk is the token’s logit, and τ is a constant temperature.” Holtzman et al. describe the low end in version 1 (22 April 2019): “As t →0 this approaches greedy decoding”; at the high end the paper names uniform sampling from the vocabulary. Google's Vertex page (4 December 2026) places the step: “The temperature is used for sampling during response generation, which occurs when topP and topK are applied.”

Example computed with the softmax formula, not from a source. Each row sums to 100 percent. The higher the temperature, the flatter the bars.

Ranges and defaults by vendor

Range and default value differ by vendor. On 6 December 2026, the pages read as follows:

Source and dateRange and default
OpenAI API reference, Chat Completions, parameter temperature (page without date)“optional number or null (default: 1) What sampling temperature to use, between 0 and 2.”
Anthropic Messages API reference, archived copy of 16 September 2025“Defaults to 1.0. Ranges from 0.0 to 1.0.”
Google Cloud, “Experiment with parameter values” (last updated 4 December 2026)“Gemini models support a temperature value between 0.0 and 2.0. Models have a default temperature of 1.0.”
Mistral API reference (page without date)“What sampling temperature to use, we recommend between 0.0 and 0.7.”
Ollama Modelfile documentation (page metadata 3 December 2026)“Increasing the temperature will make the model answer more creatively. (Default: 0.8)”
llama.cpp server README on GitHub (page without date)“temperature (default: 0.80)”

Google also names a starting point: “1.0 is the recommended starting value for temperature.” The Anthropic row comes from an archived copy, because the current Anthropic pages list the parameter as unsupported for newer models (see below).

Temperature and top_p

Four vendors name top_p or topP next to temperature; Google describes the order of the steps:

Source and dateWording
OpenAI API reference (page without date)“We generally recommend altering this or top_p but not both.”
Mistral API reference (page without date)“We generally recommend altering this or top_p but not both.”
Anthropic Messages API reference, archived copy of 16 September 2025“You should either alter temperature or top_p, but not both.”
Google AI Studio, “Prompt design strategies” (page without date)“Tokens are then further filtered based on topP with the final token selected using temperature sampling.”
Holtzman et al., arXiv 1904.09751, version 2 (14 February 2020)“we propose sampling from the top-p portion of the probability mass, expanding and contracting the candidate pool dynamically.”

OpenAI and Mistral use the same sentence. Google's Vertex page adds a third setting: “A top-K of 1 means the next selected token is the most probable among all tokens in the model's vocabulary (also called greedy decoding)”.

Does temperature 0 give the same answer every time?

The sources disagree:

Source and dateWording
Google AI Studio, “Prompt design strategies” (page without date)“A temperature of 0 is deterministic, meaning that the highest probability response is always selected.”
Google Cloud, “Content generation parameters” (last updated 4 December 2026)“In this case, responses for a given prompt are mostly deterministic, but a small amount of variation is still possible.”
Anthropic Messages API reference, archived copy of 16 September 2025“Note that even with temperature of 0.0, the results will not be fully deterministic.”
Horace He, Thinking Machines (10 September 2025)“LLM APIs are still not deterministic in practice”

The Google AI Studio page notes that the temperature, top_p and top_k parameters “control how earlier models generate responses”.

Thinking Machines sampled “1000 completions at temperature 0” from the model Qwen3-235B-A22B-Instruct-2507 for the prompt “Tell me about Richard Feynman”. The post reports: “we generate 80 unique completions, with the most common of these occuring 78 times.” The completions were “identical for the first 102 tokens”. The post traces the variation to missing “batch invariance”, which lets a request's output “depend on the batch size of our forward pass”.

What research says about temperature

Holtzman et al. (version 2) write: “recent analysis has shown that, while lowering the temperature improves generation quality, it comes at the cost of decreasing diversity”. Renze and Guven tested “four popular LLMs” in version 1 (7 February 2024) and found that “changes in temperature in the range 0.0 to 1.0 do not have a statistically significant impact on LLM performance for problem-solving tasks”. Version 3 (2 October 2024) covers “nine popular LLMs”, raises the temperature “from 0.0 to 1.6” and keeps the finding for 0.0 to 1.0. Li et al. (arXiv 2506.07295, 8 June 2025) report: “Our findings reveal distinct skill-specific effects of temperature on model performance”. Peeperkorn et al. (arXiv 2405.00492, 1 May 2024) test creativity: “We find that temperature is weakly correlated with novelty, and unsurprisingly, moderately correlated with incoherence, but there is no relationship with either cohesion or typicality.” IBM adds: “Temperature is often conflated with ‘creativity’ but this isn’t always the case.” The studies test different tasks, models and ranges.

Models that no longer accept the setting

Anthropic's migration page for API version 2026-10-21 (page without date) states: “In 2026-10-21, a request that sends temperature, top_p, or top_k returns a 400 error, even at the parameter’s default value.” Anthropic's page “Using the Messages API” adds: “The temperature, top_p, and top_k sampling parameters are not supported on Claude 4.7 and later models and Claude Mythos Preview, or on any model starting with API version 2026-10-21.” The same page continues: “Setting them to a non-default value returns a 400 error, and starting with 2026-10-21 any value does.”

Google's Vertex page (4 December 2026) writes: “For Gemini 3.6 Flash and later models, custom values for token sampling parameters” namely temperature, topP and topK “aren't supported and are ignored if set”. Google's AI Studio page on Gemini 3.6 calls the parameters deprecated: “The API ignores these parameters and returns an error in future model generations.” OpenAI's guide to its latest models (page without date) writes for GPT-6.2 Astra and GPT-6.2 Sol: “Unsupported parameters: When migrating Chat Completions requests, omit temperature, top_p, logprobs, and top_logprobs.” The OpenAI API reference still lists temperature with a range from 0 to 2.

What each vendor's documentation says about newer models, as retrieved on 6 December 2026. The three pages do not use the same wording.

Other meanings of “temperature”

This entry covers the setting used when a model writes text. Holtzman et al. (version 2) cite earlier work for the temperature setting: “Another common approach to sampling-based generation is to shape a probability distribution through temperature (Ackley et al., 1985).” A temperature T also appears when a smaller model learns from a larger one; the entry on knowledge distillation covers that use. Questions about GPU temperature, which Google lists for some searches on LLM temperature (US, 6 December 2026), concern the heat of hardware.

Large language model. Text is written one token at a time; the large language model entry describes how.

AI inference. Running a trained model on a request, the step in which temperature applies; the entry on AI inference covers it.

Knowledge distillation. The softmax temperature T that Hinton et al. use to train a student model; the entry on knowledge distillation explains it.

Speculative decoding. Methods that speed up generation, including a quote on greedy decoding; the speculative decoding entry has them.

AI search tracking. Answers that change from one run to the next are the subject of the AI search tracking entry.

Softmax. The function that turns logits into the token probabilities that temperature reshapes; the entry on softmax gives the formula and a worked example.

Source

Frequently asked questions

What is a good temperature for an LLM?

The pages give different starting points. Google writes “1.0 is the recommended starting value for temperature.” Mistral writes “we recommend between 0.0 and 0.7”. Anthropic's reference, archived on 16 September 2025, says “closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks”. Of the three, only Anthropic's text depends on the task.

What is the range of temperature parameters?

OpenAI documents “between 0 and 2” with “(default: 1)”. Google writes “between 0.0 and 2.0”, and Anthropic's reference, archived on 16 September 2025, “Ranges from 0.0 to 1.0”. Values above 1 are allowed in two of the three. For newer models, Anthropic, Google and OpenAI list the parameter as unsupported.

What happens when the temperature is 0 in LLM?

Holtzman et al. (version 1) write “As t →0 this approaches greedy decoding”. Google Vertex says responses are “mostly deterministic”. Anthropic's reference, archived on 16 September 2025, says “the results will not be fully deterministic”. Thinking Machines counted 80 unique completions out of 1000 at temperature 0 for one model and one prompt.

What is the purpose of temperature in softmax?

Renze and Guven (version 3) place the temperature in the softmax formula, where “τ is a constant temperature”. IBM describes the effect: “A lower temperature essentially makes those tokens with the highest probability more likely to be selected”. According to IBM, a higher temperature works the other way and makes less probable tokens more likely.

What is the temperature top p and top k in LLM?

Temperature, top_p and top-K are three settings for choosing the next token. Google describes the order: “Tokens are then further filtered based on topP with the final token selected using temperature sampling.” OpenAI and Mistral “generally recommend” altering temperature or top_p, not both; Anthropic's reference, archived on 16 September 2025, says “either alter temperature or top_p, but not both”.