Temperature
Temperature is a setting that controls how random a language model's output is: low values make it pick the most likely words, high values spread its choices across less likely ones.
A language model does not produce a word directly. At each step it scores every possible next token, and those scores are turned into probabilities by a function called softmax. The software then picks a token from that distribution. Temperature adjusts the distribution before the pick: the scores are divided by the temperature, so a low value exaggerates the gap between likely and unlikely tokens and a high value narrows it.
A worked example shows the effect. Suppose the model rates the next word as "sunny" 60 per cent, "warm" 30 per cent and "humid" 10 per cent. At a temperature of 0.5 those become roughly 78, 20 and 2 per cent, so "sunny" almost always wins. At a temperature of 2 they become roughly 47, 33 and 19 per cent, so the less likely words come up far more often. As the temperature approaches zero, sampling becomes the same as always taking the top token, which Hugging Face's guide notes is equivalent to greedy decoding.
The name comes from physics. The softmax function is the same mathematics as the Boltzmann distribution in statistical mechanics, where temperature controls how evenly a system spreads across its possible states. Hot systems explore more states; cold ones settle into the most likely.
Providers give rough guidance rather than rules. Google's Vertex AI documentation says lower temperatures suit less open-ended prompts and higher ones give more varied or creative output, and that even at zero the output is mostly but not completely deterministic. Temperature usually works alongside two other sampling settings, top-k and top-p, which cut off unlikely tokens before the pick. Some newer models fix these settings: in December 2026 Google's documentation said custom temperature values are ignored for Gemini 3.6 Flash and later.
Two misconceptions are worth clearing up. A high temperature does not make a model more imaginative in any deep sense; it just makes it more random, and too high produces nonsense. A low temperature does not make a model truthful; it makes it consistent, which means a wrong answer will be repeated consistently too.
It controls how random the model's word choices are. Low temperature makes the model stick to the most probable next tokens, giving focused, repeatable output. High temperature spreads the choice across less probable tokens, giving more varied and less predictable output. Lower values suit tasks with a clear right answer, such as extraction, classification or code, and higher values suit brainstorming or creative writing. Ranges and defaults differ by provider and model, and some recent models ignore custom values, so check the documentation for the model you use. Not completely. At zero the model takes the most likely token each time, so output is mostly repeatable, but Google's documentation notes small variations are still possible. Setting a fixed seed, where offered, helps but is not a guarantee either. It reduces randomness, which can cut down on odd, low-probability statements, but it does not make a model accurate. If the model's most likely answer is wrong, a low temperature will produce that wrong answer reliably.Common questions
What does temperature do in a language model?
What temperature should I use?
Does temperature 0 make AI output deterministic?
Does lowering the temperature reduce hallucinations?
Search for "LLM sampling temperature", "softmax temperature", "top-p nucleus sampling" or "generation parameters" with your provider's name. The most reliable sources are the API documentation from model providers, which gives ranges, defaults and model-specific behaviour, and technical explainers from libraries such as Hugging Face Transformers. Rules of thumb in blog posts often go out of date as providers change defaults for new models.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.