Temperature
Temperature is a setting that controls how random a language model's output is. Low values make the model pick the most likely tokens, giving consistent, focused answers; higher values allow less likely tokens, giving more varied and creative text but also more errors. Many APIs and some apps let you adjust it.
At each step, a model assigns a probability to every possible next token. Temperature rescales those probabilities before one is sampled: values below 1 concentrate the distribution on the top choices, and values above 1 flatten it. At or near zero, output becomes close to deterministic. It is often used alongside other sampling settings such as top-p (nucleus sampling), described by Holtzman et al. (2019).
Why it matters: the right temperature depends on the task. Data extraction, classification and code usually benefit from a low temperature for repeatable results; brainstorming and creative writing can use higher values. Products often set it for you, which partly explains why the same model feels different across tools.
Example: asking for ten product name ideas at a low temperature may return similar, safe names; a higher temperature produces more unusual options.
Limits: a low temperature makes answers more consistent, not more accurate. Some reasoning models fix or restrict temperature, and the valid range differs between providers.
Related terms
Learn it step by step
Sources
- The Curious Case of Neural Text Degeneration. Holtzman et al., arXiv, April 2019
Topic: Prompt engineering
Last updated