Skip to the page

What is temperature in AI?

A setting that controls how much chance goes into each word a model picks. Low gives focused, predictable answers; high gives more varied ones.

beginner · Also called Temperature (Sampling), Sampling Temperature

A model writes one TokenTokenThe small piece of text a language model reads and writes, often part of a word. Prices, limits and the context window are all counted in tokens. at a time. At each step it does not know the next word. It has a score for every possible next piece, from very likely to very unlikely. Then something has to pick one.

The simplest rule is to always take the top-scoring piece. That gives the same answer every time, but on longer text it starts to repeat itself. So most apps pick at random, weighted by the scores. The favourite is chosen most often, the runner-up less, and anything with a chance above zero can come up now and then.

Temperature reshapes those chances before the pick.

  • Low temperature makes the favourite even more likely. Answers are focused and predictable.
  • High temperature evens the chances out. Answers are more varied, and more often odd.

Even at 0, the exact same words are not guaranteed every time.

Which setting for which job

There is no single right value. DeepSeek, for example, recommends 0 for coding and maths and 1.5 for creative writing and poetry. You want the same answer to a sum every time, and a few surprises in a poem.

You often cannot set it any more

In the chat apps, temperature is set for you. In the APIs it used to be a standard dial, and that is changing. Kimi K3 fixes it at 1. Anthropic's newer models, from Claude Opus 4.7 on, return an error if you send anything but the default. Google deprecated it for Gemini in July 2026. And DeepSeek's models ignore it whenever they are in thinking mode.

What to do with this

If an answer comes out different each time you ask, that is the dice, not a fault. Ask for the format or tone you want in words, which works everywhere. And if your code still sends a temperature, check the model's documentation: on some models it is ignored, and on others it is now an error.

Try it: temperature

The cat sat on the …

  • mat50%
  • sofa22%
  • floor17%
  • roof7%
  • keyboard4%
  • moon1%

Low temperature: the likeliest word nearly every time. High: the unlikely words get a real chance. The scores are made up to show the effect.

Sources

Where each fact comes from

This page was last checked against these sources on 14 October 2026.

  1. 1
    Glossary

    Anthropic, Claude API documentation · 14 October 2026

    Temperature controls how random the model's predictions are. Higher values give more varied output and lower values give more predictable output. Even with temperature set to 0 the results are not fully the same every time.

  2. 2
    Generation strategies

    Hugging Face, Transformers documentation · 14 October 2026

    Greedy search picks the most likely next token at each step. It works for short outputs and breaks down on longer ones because it begins to repeat itself. Sampling picks a token at random according to the model's probabilities, so every token with a chance above zero can be chosen, and it reduces repetition.

  3. 3
    The Temperature Parameter

    DeepSeek API documentation · 14 October 2026

    DeepSeek recommends a temperature of 0.0 for coding and maths and 1.5 for creative writing and poetry.

  4. 4
    Kimi K3 quickstart

    Moonshot AI, Kimi API documentation · 14 October 2026

    Kimi K3 fixes temperature at 1.0 and top-p at 0.95.

  5. 5
    Thinking Mode

    DeepSeek API documentation · 14 October 2026

    Thinking mode does not support the temperature setting. A value sent with the request has no effect.

  6. 6
    Claude Platform release notes

    Anthropic · 14 October 2026

    Setting temperature, top_p or top_k to a non-default value returns a 400 error on Claude Opus 4.8, as on Opus 4.7, and Claude Sonnet 5 and Claude Haiku 5.5 return 400 for non-default temperature too.

  7. 7
    Gemini API release notes

    Google · 14 October 2026

    On 21 July 2026 the sampling parameters temperature, top_p and top_k were deprecated in the Gemini API.