Temperature (AI)

Also called: sampling temperature, temperature parameter

Filed under AI & modern tech

What Temperature (AI) means in practice

At each step a model scores every possible next token. Temperature reshapes those scores before one is picked: values below 1 sharpen the gap between likely and unlikely options, and values above 1 flatten it.

You meet it as a slider or parameter in AI playgrounds and APIs, often next to top-p. Ranges differ by provider: Anthropic’s API accepts 0 to 1, while OpenAI’s classic APIs accept 0 to 2, so the same number does not mean the same thing everywhere.

One nuance: a low temperature makes output more consistent, not more accurate. It changes how the model chooses words, not what it knows.

Using temperature 0.2 to extract invoice fields and 0.9 to brainstorm product names.

Used in a sentence: Turn the temperature down; the summaries keep changing every time we run them.

Often confused with

Top-p
Top-p (nucleus sampling) limits choices to the smallest set of likely tokens whose probabilities add up to a threshold. Temperature reshapes all the probabilities instead. Both control randomness, in different ways.
Creativity or intelligence
A higher temperature adds variety, not insight. The model does not get smarter; it just takes less likely paths, which can read as more creative.

What does temperature mean in AI? →

How it works, examples, and common questions, explained in plain English.

Common questions

What does a temperature of 0.7 mean?

It is a moderate setting: the model mostly picks likely words but allows some variety. On a 0-to-1 scale it leans toward varied; on OpenAI’s 0-to-2 scale it sits below the default of 1, so slightly more focused than standard.

Does temperature affect cost or speed?

Not directly. Temperature changes which tokens are chosen, not the price per token or how fast they are generated. It can change reply length, though, which changes the total number of output tokens you pay for.

Sources and further reading

  1. The Curious Case of Neural Text Degeneration (Holtzman et al., 2019) — arXiv
  2. How to generate text: using different decoding methods for language generation with Transformers — Hugging Face

Read more