On this page
Definition
Temperature is a numerical parameter, typically between 0 and 2, that adjusts how a language model samples from its predicted probabilities for the next word, controlling the balance between predictability and variation in its output.
Simple explanation
At every step, a language model calculates probabilities for what word might come next, then picks one. Temperature controls how boldly it picks: at a low temperature it almost always chooses the most likely word, giving safe, consistent answers. At a high temperature it is more willing to choose less likely words, giving more varied and surprising output.
Think of it like asking someone the same question repeatedly. At low temperature they give nearly the same careful answer each time. At high temperature they riff more, sometimes brilliantly, sometimes oddly.
Why it matters
Temperature is one of the few settings that lets you directly shape a model's behaviour for a given task, without changing the prompt or the model itself.
Getting it wrong has real consequences: too low for creative writing produces dull, repetitive text; too high for factual or code-generation tasks increases the chance of errors and inconsistency.
How it works
- 1Probability calculationThe model computes a probability score for every possible next word.
- 2Temperature scalingTemperature adjusts those probabilities — sharpening them at low values, flattening them at high values.
- 3SamplingThe model picks the next word by sampling from the adjusted probabilities.
- 4RepeatThis happens for every word generated, shaping the overall tone and predictability of the response.
Real examples
Products named for illustration only. Inclusion is not an endorsement.
- OpenAI API temperature parameterDevelopers set a value from 0 to 2 when calling the API.
- Anthropic API temperature parameterClaude's API exposes a similar setting for controlling output variability.
- Creative writing toolsMany AI writing assistants use a higher default temperature to encourage varied phrasing.
Advantages
- Gives developers direct control over consistency versus creativity.
- Requires no retraining or fine-tuning to adjust behaviour.
- Can be tuned per task — low for facts and code, higher for brainstorming.
- Applies instantly and cheaply, as a single API parameter.
Limitations
- Too high a temperature increases the risk of incoherent or inaccurate output.
- Too low a temperature can make output repetitive or overly generic.
- The right setting varies by task and is often found through trial and error.
- Temperature alone does not fix a poorly written prompt.
Common misunderstandings
- ClaimTemperature of 0 guarantees identical output every time.RealityIt makes output far more consistent, but some models can still vary slightly due to other implementation details.
- ClaimHigher temperature makes a model smarter.RealityIt only changes how much randomness is introduced into word choice; it does not add reasoning ability.
Frequently asked questions
What temperature should I use for factual tasks?
A low value, often close to 0, is best for tasks that need consistent, precise answers, like code or data extraction.
What temperature is best for creative writing?
A higher value, often around 0.7 to 1, tends to produce more varied and interesting text.
Can I change temperature in ChatGPT's interface?
The consumer ChatGPT app does not expose it directly, but developers using the API can set it explicitly.
Does temperature affect cost?
No, it does not change pricing — cost is based on the number of tokens processed, not the temperature setting.
Is temperature the only way to control randomness?
No — parameters like top-p sampling also influence variability and are sometimes used alongside or instead of temperature.
The Tool Money Lab perspective
Temperature is one of the simplest levers available to anyone building on top of an AI model, yet it is often left at a default that does not suit the task.
We recommend explicitly setting temperature per use case rather than trusting a single default across an entire product — factual features and creative features rarely want the same value.
Conclusion
Temperature controls how predictable or varied a language model's output is, by adjusting how boldly it samples from its next-word probabilities.
A small setting with an outsized effect, it is worth deliberately tuning for each task rather than leaving untouched, particularly where accuracy or creativity genuinely matters.