Skip to content
AI Explained

What Is LLM Temperature? The Dial Behind AI Randomness

How temperature shapes the way a language model picks each word, which settings suit which tasks, why temperature 0 still isn't repeatable, and how to get the same effect with prompts now the newest models lock it.

Illustration of LLM temperature: a white outline thermometer with a filled bulb and level line next to four scale marks, on a deep-blue-to-orange gradient

Ask a chatbot the same question twice and you'll often get two different answers. Part of the reason is a setting called temperature. It decides how adventurous a language model is when it picks its next word: low and it plays safe, high and it takes chances. This guide explains what LLM temperature is, how it works, which values suit which tasks, why temperature 0 still isn't perfectly repeatable, and why the newest models from OpenAI, Anthropic and Google no longer let you change it at all.

What LLM temperature is, in plain English

A large language model writes one token at a time. If you've read our guide to what an LLM is, you'll know that at every step it doesn't produce a single answer: it produces a score for every token it knows, which is then turned into a list of probabilities. "Tea" might get 57%, "coffee" 35%, and tens of thousands of other tokens share what's left.

Something then has to pick one. That step is called sampling, and temperature is the main dial that controls it:

  • Low temperature sharpens the odds. The favourite becomes even more likely and the long shots almost disappear. Output gets more predictable, more conventional and more repetitive.
  • High temperature flattens the odds. Less likely tokens get a real chance. Output gets more varied and surprising, and eventually less coherent.
  • Temperature 0 means, in theory, always take the single most likely token. This is often called greedy decoding.

Temperature doesn't change what the model knows, only how boldly it chooses from what it already considers plausible. A low temperature makes the model more consistent, which is not the same as more correct.

How temperature works: a worked example

Imagine the model is completing "Would you like a cup of…" and, simplifying hugely, only four tokens are in the running. Here is how the probabilities shift as temperature changes:

  • Temperature 0.2: tea 92%, coffee 8%, water and sunshine effectively 0%.
  • Temperature 0.5: tea 72%, coffee 27%, water 1%, sunshine almost 0%.
  • Temperature 1.0 (the model's natural odds): tea 57%, coffee 35%, water 8%, sunshine 1%.
  • Temperature 1.5: tea 49%, coffee 35%, water 13%, sunshine 3%.
  • Temperature 2.0: tea 44%, coffee 34%, water 16%, sunshine 6%.

Under the bonnet, the model's raw scores are divided by the temperature before they're turned into probabilities. Dividing by a small number stretches the gaps between scores, so the leader pulls away; dividing by a large number squeezes them together, so everyone gets closer to an equal chance.

One odd word rarely matters. But sampling happens hundreds of times in a single reply, and every pick becomes context for the next, so small detours compound. That's how a high temperature turns a sensible paragraph into a rambling one.

Ranges vary by provider. Anthropic's older Claude models accepted 0 to 1, and OpenAI's and Google's older models 0 to 2, so the same number doesn't mean the same thing everywhere. Defaults vary too: many APIs used 1.0, while Ollama, a popular way to run open models on your own computer, defaults to 0.8.

Temperature vs top-p and top-k

Temperature rarely works alone. Most tools that expose it also offer settings that cut the list of candidate tokens before one is picked:

  • Top-k keeps only the k most likely tokens. With top-k 40, the model chooses from its 40 favourites, however the probabilities are spread.
  • Top-p, also called nucleus sampling, keeps the smallest group of tokens whose probabilities add up to p. With top-p 0.9, it keeps the most likely tokens until they cover 90% of the probability, and ignores the rest.
  • Min-p, found in many open-model tools, keeps only tokens that are at least a set fraction as likely as the top choice.

Top-p came from a 2019 paper by Holtzman and colleagues, who found that the decoding method alone can dramatically change the quality of text from the same model. Their argument: the long tail of very unlikely tokens is where nonsense comes from, so cut it off. Top-p also adapts better than top-k: when the model is confident, the nucleus might hold three tokens; when many continuations are reasonable, hundreds.

The practical rule, where these settings are still available: change one at a time. Temperature and top-p both control how far into the unlikely options the model will go, and adjusting both at once makes it hard to tell which change did what. Several providers have advised changing one or the other, not both.

Which temperature to use for which task

If you're working with a model that still accepts the setting, these ranges are reasonable starting points. Treat them as a rough guide, not a rule, and test on your own task:

  • 0 to 0.3: extraction, classification and data work. Pulling fields from invoices, tagging support tickets, converting text to JSON, answering from a supplied document. You want the same input to give the same output.
  • 0.2 to 0.5: code and factual answers. Code needs to be precise, and a creative variable name is no gain.
  • 0.5 to 0.8: everyday writing. Emails, summaries, explanations, rewrites. Enough variety to sound natural, not so much that it wanders.
  • 0.8 to 1.1: brainstorming and creative drafts. Headlines, names, story ideas, angles for a campaign, where you'll pick from many options anyway.
  • Above about 1.2: experiments only. Output gets strange quickly, then incoherent. Occasionally useful for deliberately odd ideas; rarely for anything you'd publish.

Don't treat temperature as a creativity knob, though. A 2024 study by Peeperkorn and colleagues tested it on stories written by Llama 2-Chat and found that higher temperature was only weakly linked to novelty, but moderately linked to incoherence. Real creativity comes far more from the prompt: the constraints, the angle and the examples you give.

Tip: To test a temperature properly, run the same prompt five times at each value you're considering and read the results side by side. One run tells you nothing about a setting whose whole job is to control variation; five runs show you both the typical answer and the worst one.

Why temperature 0 isn't perfectly repeatable

Many developers set temperature to 0 expecting identical output every time. In practice it often isn't. Anthropic's own glossary says that even at temperature 0, results will not be fully deterministic, and identical inputs might produce different outputs across API calls.

The clearest demonstration came from Thinking Machines in September 2025. Researchers asked an open model, Qwen3-235B, "Tell me about Richard Feynman" 1,000 times at temperature 0. They got 80 different completions. All of them matched for the first 102 tokens; then most continued with "Queens, New York" and a handful with "New York City", and from there the texts diverged.

The cause isn't hidden randomness in the model but the server. Providers process many users' requests together in batches whose size depends on how busy the service is. Different batch sizes group the maths slightly differently, changing scores in the last decimal places, and when two tokens are nearly tied that's enough to flip the choice. Once one token differs, everything after it can too. The researchers showed this can be fixed, at a cost in speed, but most hosted services haven't done so.

So if your workflow needs exactly the same answer twice, don't rely on temperature. Store the answer, validate the output against rules or a schema, and design the system so small wording differences don't matter.

Why the newest models no longer let you change it

Here is the twist: temperature is disappearing from the latest models. As of November 2026:

  • OpenAI tells developers moving to its latest models to omit temperature and top-p from their requests. Its reasoning models stopped accepting custom values some time ago.
  • Anthropic accepts only the default settings on Claude 4.7 and later models, and a new API version released in October 2026 rejects any request that sends temperature, top-p or top-k at all. Its migration notes add, pointedly, that temperature 0 never guaranteed identical outputs on earlier models either.
  • Google says Gemini 3.6 and later ignore custom temperature, top-p and top-k values and will reject them in future releases. For earlier Gemini 3 models, it advises keeping the defaults to avoid degraded reasoning performance.

Why? Modern models are increasingly reasoning models: they write long internal working before they answer and are trained with a particular sampling setup. Forcing a low temperature onto that process can make them loop, repeat themselves or reason worse. The labs have decided that the default, tuned during training, is the right setting, and that the way to steer the model is the prompt.

Temperature still matters on older models that are still on sale and on open models, whether hosted or run yourself through tools such as Ollama or llama.cpp. On the newest models from the big three, it's a setting you'll read about rather than use.

And it was never in the chat apps. ChatGPT, Claude and Gemini don't offer a temperature control to ordinary users. Typing "set your temperature to 0.2" into a chat doesn't change any setting. The model may respond by writing in a more cautious style, which is the prompt doing the work, not a dial.

How to get the effect of temperature with prompts

Whether the dial is locked or out of reach in a chat app, you can get most of what temperature offered through the prompt. Google's advice for its newest models is exactly this: for consistency, write clear rules in the system instruction.

For low-temperature behaviour, consistent and predictable output, remove the choices the model would otherwise make for you:

Classify each customer message below into exactly one category: [CATEGORY 1], [CATEGORY 2], [CATEGORY 3] or "other". Rules: - Use only these labels, spelled exactly as written. - If a message fits two categories, choose the one listed first. - If you are unsure, use "other". Do not invent new categories. Output one line per message: message number, then the label. Nothing else. [PASTE MESSAGES]

Fixed labels, a tie-break rule and an exact output format do more for consistency than any temperature setting. A system prompt that holds rules like these once, for every request, works even better.

For high-temperature behaviour, variety and surprise, ask for the spread explicitly. Models left to themselves tend to give the most typical answers, even at high temperature:

Give me 12 name ideas for [PRODUCT OR PROJECT], aimed at [AUDIENCE]. Make them genuinely different from each other: - 3 plain and descriptive - 3 playful - 3 based on a metaphor from [UNRELATED FIELD, E.G. SAILING] - 3 that break a convention of [INDUSTRY] Avoid the obvious names a competitor would choose, such as [OBVIOUS NAME]. For each, add one line on the feeling it gives.

Categories, unusual sources of inspiration and a ban on the obvious push the model further than a higher temperature would, without the incoherence.

And when consistency matters for a judgement rather than a format, use the variation instead of fighting it. This is the idea behind self-consistency, a technique covered in our guide to chain-of-thought prompting: ask several times and trust the answer that keeps coming back.

Answer the question below three times, independently, as if you had not seen your previous answers. Question: [QUESTION, E.G. WHICH OF THESE TWO CONTRACT CLAUSES LIMITS OUR LIABILITY MORE?] [PASTE MATERIAL] Then compare your three answers. If they agree, give the shared answer. If they disagree, say where and why, and which answer you trust most.

In an API, you'd make three separate calls for a truer test; in a chat app, this is a reasonable approximation that often exposes uncertainty a single answer would hide. If a prompt still gives you inconsistent results, our prompt optimizer can help you tighten the instructions.

Tip: If you're migrating code from an older model that used a low temperature for consistency, don't just delete the setting and hope. Collect twenty real inputs, compare the old and new outputs, and add rules to the prompt for every place the new model varies more than you'd like.

Limits worth knowing

Temperature is one of the most misunderstood settings in AI. Limits to keep in mind:

  • Low temperature doesn't stop hallucinations. If the most likely continuation is a confident invention, temperature 0 will give you that invention every time. Consistency and accuracy are different things; see our guide to AI hallucinations.
  • High temperature isn't creativity. It adds randomness, which sometimes looks original and often looks like nonsense. The prompt is a far stronger creative lever.
  • Temperature 0 isn't a guarantee. As the Thinking Machines experiment showed, identical requests can still produce different text on hosted services.
  • Numbers don't transfer. 0.7 on one model isn't 0.7 on another. Ranges, defaults and training differ, so retest whenever you switch.
  • On the newest models, you can't change it. If an article, course or tool tells you to tune temperature, check whether the model you're using still accepts it.

LLM temperature is a dial for how adventurous a model is when it picks each next token: low for predictable, high for varied. It explains why AI output varies, and it's still useful on open and older models. On the newest models, though, the dial is fixed and the prompt has taken over its job. Write clear rules when you need consistency, ask for real variety when you need ideas, and check the answers either way.

References

Put this into practice. Apply what you just read with our free tool: AI Prompt Generator →
By AI enthusiast & advanced user

Jordi Benitez has been using AI tools day to day for years. No researcher, no academic title — just an advanced user who has spent enough hours prompting ChatGPT, Claude, Gemini and image models to know what actually works, and built GetEasyPrompt to share it in plain language.

FAQ

Frequently asked questions

Temperature is a setting that controls how adventurous a language model is when it picks each next word. A low temperature makes it stick to the most likely words, so answers are predictable and consistent. A high temperature gives less likely words a real chance, so answers are more varied, and at very high values less coherent.
It depends on the task. Roughly 0 to 0.3 suits extraction, classification and data work, 0.2 to 0.5 suits code and factual answers, 0.5 to 0.8 suits everyday writing, and 0.8 to 1.1 suits brainstorming. Treat these as starting points, test on your own task, and remember that the same number behaves differently on different models.
Not reliably. In theory it always picks the most likely word, but on hosted services, requests are processed in batches of varying size, and tiny numerical differences can flip near-tied choices. In a 2025 Thinking Machines experiment, 1,000 identical requests at temperature 0 produced 80 different completions.
Not in the chat apps: they don't offer a temperature control, and asking the model to change its temperature doesn't change any setting. The newest models from OpenAI, Anthropic and Google also no longer accept custom temperatures through their APIs. You get similar effects through the prompt: clear rules for consistency, explicit requests for variety.

Write your next prompt in seconds

Turn a rough idea into a clear, structured prompt any AI can follow. Free, private, and no account needed.

Open the Prompt OptimizerSee all tools