Skip to content

Evidence-first authority page

What Is Temperature in LLM Sampling?

What the temperature parameter actually controls in LLM output generation, and how to choose a setting for a given task.

Direct answer

Temperature controls how much randomness a model uses when selecting its next output token — lower temperature (closer to 0) makes output more deterministic and focused, while higher temperature increases variability and creativity at the cost of consistency; use low temperature for tasks needing a single reliable answer (extraction, classification, tool calls) and higher temperature for creative or brainstorming tasks.

Last reviewed 2026-08-29

This page remains noindex while its page-level source receipts are completed and verified. It is available for review, not presented as publication-ready authority.

What's actually happening under the hood

At each step, a model computes a probability distribution over possible next tokens. Temperature reshapes this distribution before a token is sampled — a low temperature sharpens the distribution toward the highest-probability tokens (more deterministic, repeatable output), while a high temperature flattens it, giving lower-probability tokens more chance of being selected (more varied, less predictable output).

Choosing a setting by task type

  • Near-zero temperature: structured extraction, classification, tool-call argument generation, and any task where you want the same input to reliably produce the same output.
  • Moderate temperature: general conversation and drafting, where some variation is fine and even desirable.
  • Higher temperature: brainstorming, creative writing, and generating diverse options where variety is the actual goal.

Why this matters for agent reliability testing

A low but non-zero temperature is still not fully deterministic — see AI agent testing & evaluation frameworks for why a single test run's pass/fail result is less informative than a pass rate across repeated runs, which this variability directly explains.

Continue researching