What Is Temperature?

Also called LLM temperature

Short Answer

Temperature is a setting that controls how random a language model's output is. A low temperature, near 0, makes the model pick the most likely tokens, giving focused and repeatable answers. A higher temperature spreads the choice across less likely tokens, giving more varied and creative text.

  • Taught in lesson 89

Why It Matters

Temperature is one of the few settings you control directly when calling a model. Setting it well makes outputs either consistent, for tasks such as extraction and classification, or varied, for tasks such as brainstorming, and it matters when you evaluate a system, because random outputs change scores between runs.

How It Works

At each step the model gives every possible next token a probability. Temperature reshapes those probabilities before one is picked: low values sharpen the top choice, high values flatten the field. It is often used together with top-p sampling.

Use low temperature for extraction, classification and code; use higher temperature for brainstorming. Even at temperature 0, answers are not always perfectly identical, and some reasoning models set temperature for you.

At temperature 0 the model mostly picks the single most likely token, so answers are nearly repeatable, although small differences can still occur. As temperature rises, less likely tokens get a real chance, adding variety and also more risk of odd or wrong output. Related settings such as top-p limit the choice to the most likely tokens. Some newer models fix or ignore temperature, so the provider's documentation is the guide.

Temperature in Practice

Everyday Example

Asking for ten product name ideas works better at a higher temperature; asking for the invoice total in a document works better near 0.

Industry Example: Pharma

A system that extracts lab values from reports runs at low temperature so the same document always gives the same structured result, which supports validation.

Where You Meet It

  • Parameters in model API calls.
  • Settings in AI playgrounds.
  • Evaluation setups that need repeatable results.
  • Brainstorming tools set to give varied ideas.

Key Ideas Around It

Sampling
Choosing the next token from the model's probabilities.
Top-p
Sampling only from the most likely tokens that add up to a set probability.
Determinism
Getting the same output for the same input.
Probability distribution
The chance the model gives to each possible next token.

A Common Mix-Up

A high temperature does not make a model more creative in a deep sense. It makes word choices more random, which can look creative but can also reduce quality.

Check YourselfWhich temperature suits extracting invoice numbers from emails?

A low one, near 0, because you want consistent, precise output, not variety.

Learn It on ai2hired

S8 · #89Controlling Generation

Coming in Season 8, Harnessing Models (CAM). Every ai2hired lesson is free on YouTube.

Questions People Ask

What temperature should I use?

Start near 0 for factual or structured tasks and around 0.7 to 1 for creative ones, then test on real examples.

Does temperature 0 make a model always correct?

No. It makes answers more consistent, not more accurate. A wrong answer can be consistently wrong.

Learn AI From Zero to Hired

Free lessons on YouTube, each one built from what real AI job ads ask for.