Temperature
Temperature is a sampling parameter that controls randomness in a language model's output, where 0 is fully deterministic and higher values introduce more variety.
In more detail
What it means
Temperature rescales the probability distribution from which the model samples its next token. At temperature 0 the model picks the single highest-probability token every time (effectively greedy decoding). Higher temperatures flatten the distribution so lower-probability tokens are also sampled, producing more diverse and creative outputs. For factual tasks, code generation, and JSON extraction, set temperature to 0–0.3. For brainstorming, creative writing, and ideation, 0.7–1.0 is typical. Most modern APIs accept temperature in 0–2; values above 1.0 often produce incoherent output and are rarely useful.
Part 1 of 2
When to use it, and when not
Use it for
- Temperature 0–0.3: facts, code, structured output, agent reasoning.
- Temperature 0.5–0.8: copywriting, marketing, conversational responses.
- Temperature 0.9–1.2: creative writing, idea generation.
Part 2 of 2
Common mistakes
- Defaulting to 1.0 for production — leads to flaky outputs and harder eval.
- Trying to fix hallucinations by raising temperature (it usually makes them worse).
- Using high temperature with JSON mode — often breaks the schema.
FAQ
Questions readers ask.
What is temperature?
Temperature is a sampling parameter that controls randomness in a language model's output, where 0 is fully deterministic and higher values introduce more variety.
When should you use temperature?
Temperature 0–0.3: facts, code, structured output, agent reasoning. Temperature 0.5–0.8: copywriting, marketing, conversational responses. Temperature 0.9–1.2: creative writing, idea generation.
What are the common mistakes with temperature?
Defaulting to 1.0 for production — leads to flaky outputs and harder eval. Trying to fix hallucinations by raising temperature (it usually makes them worse). Using high temperature with JSON mode — often breaks the schema.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/temperature.md. Found a mistake? Tell us.