# 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.

- Page: https://tecyfy.com/concepts/temperature
- Subject: How AI works (https://tecyfy.com/concepts)
- Level: beginner
- Also called: Temperature (Sampling), Sampling Temperature
- The lesson: How AI writes its answers: one piece at a time (https://tecyfy.com/learn/how-ai-works/how-ai-writes)
- Last checked: 2026-10-14

A model writes one [Token](https://tecyfy.com/concepts/token) 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.

(An interactive demo goes with this on the page: https://tecyfy.com/concepts/temperature)

## Related

- [Token](https://tecyfy.com/concepts/token): The 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.
- [Top‑p Sampling](https://tecyfy.com/concepts#top-p-sampling): A decoding strategy that samples from the smallest set of tokens whose cumulative probability exceeds p
- [Top‑k Sampling](https://tecyfy.com/concepts#top-k-sampling): A decoding strategy that restricts choices to the k most probable tokens
- [Inference](https://tecyfy.com/concepts/inference): Using a trained model to produce an answer. Training builds the model once; inference is every time someone asks it something, and it is what you pay for per token.

## Sources

- [Glossary](https://platform.claude.com/docs/en/about-claude/glossary), Anthropic, Claude API documentation, 2026-10-14. 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.
- [Generation strategies](https://huggingface.co/docs/transformers/main/en/generation_strategies), Hugging Face, Transformers documentation, 2026-10-14. 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.
- [The Temperature Parameter](https://api-docs.deepseek.com/quick_start/parameter_settings), DeepSeek API documentation, 2026-10-14. DeepSeek recommends a temperature of 0.0 for coding and maths and 1.5 for creative writing and poetry.
- [Kimi K3 quickstart](https://platform.kimi.ai/docs/guide/kimi-k3-quickstart.md), Moonshot AI, Kimi API documentation, 2026-10-14. Kimi K3 fixes temperature at 1.0 and top-p at 0.95.
- [Thinking Mode](https://api-docs.deepseek.com/guides/thinking_mode), DeepSeek API documentation, 2026-10-14. Thinking mode does not support the temperature setting. A value sent with the request has no effect.
- [Claude Platform release notes](https://platform.claude.com/docs/en/release-notes/api), Anthropic, 2026-10-14. 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.
- [Gemini API release notes](https://ai.google.dev/gemini-api/docs/changelog), Google, 2026-10-14. On 21 July 2026 the sampling parameters temperature, top_p and top_k were deprecated in the Gemini API.
