All terms
Foundations

Temperature

Also known as: sampling temperature, softmax temperature

A sampling parameter controlling randomness in an LLM's output. 0 is deterministic and conservative; ~1 is creative and varied; above 1 starts to incoherent.

What it means

Temperature is a number (typically 0 to 2) that scales the model's probability distribution before sampling the next token. At temperature 0, the model always picks the highest-probability token — output is repeatable and conservative. At temperature 1, you sample from the model's natural distribution — varied but coherent. Above 1, you flatten the distribution toward uniform, which produces increasingly weird and ungrounded text. In practice, the useful range is 0 to about 1.2. Use 0 (or near-0) for code generation, structured extraction, classification, factual Q&A, and anything where you want the same input to produce the same output. Use 0.7-1.0 for creative writing, brainstorming, varied responses, and chat. Use higher only when you specifically want chaos — generating diverse synthetic data, breaking out of repetitive loops. Temperature 0 is not actually deterministic in most production APIs: floating-point non-determinism, batch effects, and routing across hardware mean the same prompt at temp 0 can still vary slightly across calls. If you need bit-exact reproducibility, you typically need a seed parameter (where supported) or a self-hosted model. Some 2026 reasoning models (GPT-5 Thinking, Claude with extended thinking) ignore temperature for the reasoning trace itself and only apply it to the final output.

Example

Asking 'name a color' at temperature 0 might always give 'Blue.' At 0.7 you'd get a mix of Blue, Red, Green, Crimson. At 1.5 you'd start getting 'Periwinkle', 'Gamboge', and eventually nonsense.

Why it matters

Temperature is the easiest knob to get wrong. People crank it up hoping for 'better' output and get more hallucinations. People leave it at default (often 1.0) for code generation and get inconsistent results. Matching temperature to the task — low for facts, higher for creativity — is a free quality improvement.

Related terms