parameter

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.

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.

When to use temperature

Common mistakes

FAQ

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 I 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 most 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.