Temperature
Temperature is a sampling parameter for large language models (LLMs). It reshapes the probability distribution the model uses to pick the next token: lower values make the most likely tokens even more likely, and higher values give less likely tokens more chance. It lets you trade consistency for variety in the output.[1][3]
What does Temperature mean in simple terms?
An LLM writes one token (a word or part of a word) at a time, choosing from a list of candidates with probabilities. Temperature is the dial that decides how strictly it sticks to the top candidates. Near 0, it almost always takes the most probable choice, so answers stay focused and similar. Higher values let it pick less obvious words, so answers vary more. For models that support this setting, OpenAI’s Chat Completions reference describes a range of 0 to 2, and Anthropic’s Messages reference describes 0 to 1 with a default of 1.0.[1][2] As a rule of thumb, use low values for analysis, classification and multiple-choice tasks, and values closer to the top of the range for creative or generative work.[2] Not every model lets you change it, so check the model's documentation first.[2][7]
How can Temperature be explained with an analogy?
It is like telling a new team member, before they draft a report, whether to stick strictly to the template or to feel free to add their own ideas.
Where is Temperature used?
Support ticket classification — Low temperature for consistent labels (illustrative)
Suppose an operations team sorts incoming customer messages into "refund", "shipping", "account" and "other", or pulls amounts and due dates from quotes into JSON. The same input should get the same label every time. Anthropic's API reference recommends a temperature closer to 0.0 for analytical and multiple-choice tasks, while noting that even 0.0 does not make results fully deterministic.[2] Keep a small set of test messages and check that the labels stay stable whenever you change the prompt or model.
Result: An illustrative setup, not a measured company result. Low temperature reduces, but does not remove, variation between runs.[2][4]
Ad copy brainstorming — Higher temperature for variety (illustrative)
When a marketing team wants several different headline ideas to choose from, a higher temperature produces more varied drafts.[3] A study by Peeperkorn et al. tested this on story generation with a fixed prompt and model. Temperature was only weakly correlated with novelty, moderately correlated with incoherence, and showed no relationship with cohesion or typicality.[5] Raising the dial gives you more variety to review, not reliably better ideas.
Result: In the studied story-generation setting, novelty had a weak positive relationship with temperature and incoherence a moderate one; review drafts rather than treating higher temperature as better creativity.[5]
Code generation — Low temperature, but still test the output
Ouyang et al. sent the same coding prompts to ChatGPT repeatedly across 829 problems from three benchmarks. At default settings, the share of tasks with no identical test output across requests was 75.76% (CodeContests), 51.00% (APPS) and 47.56% (HumanEval). Setting temperature to 0 reduced this variation compared with the default of 1, but did not guarantee identical code.[4] Teams that generate code or SQL with an LLM should keep tests and reviews in place even at temperature 0.
Result: Temperature 0 gave less non-determinism than temperature 1, but not determinism.[4]
IBM Granite demo — Same prompt, three temperatures
IBM ran one prompt, "Write a story about a data scientist who loves Python", through its Granite 3.1 2B model at temperatures of 0.1, 0.75 and 1.25. The three stories began in a similar way, but details varied more as temperature rose; at 1.25 the story added a cat named Suki.[3] Running one prompt at a few settings like this is a quick way to see the effect on your own tasks.
Result: Higher temperature produced more variable text and details from the same prompt.[3]
Try it today
- Pick one prompt you use often and run it five times each at two or three temperature settings your model supports (for example 0, 0.5 and 1.0).
- Put the outputs side by side and note where answers start to differ and how much extra review the variation costs.
- Agree on team defaults by task type, such as low values for classification, extraction and code, and higher values for drafting and brainstorming.[2]
- Change either temperature or top_p, not both at once, so you can tell which setting caused a difference. Both OpenAI and Anthropic documentation give this advice.[1][2]
- State in your runbook that temperature 0 does not guarantee identical outputs, and keep regression tests with a fixed set of sample inputs and expected answers.[2][4]
Limits and direction
Temperature 0 does not make an LLM fully deterministic. Anthropic says so in its API reference, and a study of ChatGPT code generation found differing outputs even at temperature 0.[2][4] Treating temperature as a "creativity dial" is also an overstatement: its link to novelty is weak, while its link to incoherence is moderate.[5] The best value depends on the task and the model. A 2025 study of open models at three size ranges found skill-specific effects of temperature, and found that the point where performance changes sharply rises with model size.[6]
Control over temperature is also narrowing. Anthropic now marks the temperature, top_p and top_k parameters as deprecated: models released after Claude Opus 4.6 accept only a temperature of 1.0 and reject other values.[2] OpenAI notes that parameter support differs by model, particularly for newer reasoning models.[7] Before building a workflow around a specific temperature, check what your model supports, and rely on prompts, examples, output formats and tests for consistency.
Which concepts are related to Temperature?
- Similar conceptPrompt VersionRecord the temperature with each prompt version so results can be compared and reproduced.
- Similar conceptPrompt LibraryShared prompts work best when the recommended model settings, including temperature, are saved with them.
- Similar conceptPersona PromptingBoth shape the style of a response: a persona through instructions, temperature through sampling.
Which sources explain Temperature?
- OpenAI — API reference: Create chat completion, temperature and top_p parameters (accessed 2026-10-14) — https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create
- Anthropic — Claude API reference: Create a Message, temperature parameter (accessed 2026-10-13) — https://platform.claude.com/docs/en/api/messages/create
- IBM — What is LLM temperature? (2024-12-16, updated 2026-04-02) — https://www.ibm.com/think/topics/llm-temperature
- Ouyang, Zhang, Harman, Wang (arXiv) — An Empirical Study of the Non-determinism of ChatGPT in Code Generation (2023-08-05, v2 2024-10-17) — https://arxiv.org/abs/2308.02828
- Peeperkorn, Kouwenhoven, Brown, Jordanous (arXiv) — Is Temperature the Creativity Parameter of Large Language Models? (2024-05-01) — https://arxiv.org/abs/2405.00492
- Li, Sleem, Gentile, Nichil, State (arXiv) — Exploring the Impact of Temperature on Large Language Models: Hot or Cold? (2025-06-08) — https://arxiv.org/abs/2506.07295
- OpenAI — API reference: Create chat completion (accessed 2026-10-13) — https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create
Tell us what you think
Your feedback helps us improve the content.