Back to glossary

Term

Temperature

Temperature is a sampling parameter that controls how deterministic or creative a language model's responses are — low values stay conservative, high values produce more variety.

Temperature — explained in more detail

For every token, the model computes a probability distribution over possible next tokens. Temperature rescales that distribution before sampling: values near 0 sharpen it (the most likely token almost always wins), values near 1 leave it unchanged, values above 1 flatten it and mix in rarer tokens more aggressively. Temperature 0 is effectively deterministic; temperature 2 often produces incoherent text.

Example / Practical context

For code generation, data extraction, or summarisation, low values (0–0.3) make sense — you want reproducible, precise output. For brainstorming, creative writing, or generating variants, higher values (0.7–1.0) are common. Most APIs (OpenAI, Anthropic, local servers) accept temperature in the 0–2 range, with 1.0 as default.

Temperature is just one of several sampling knobs. Top-p (nucleus sampling) and top-k truncate the distribution differently — they limit the candidate set rather than only rescaling its shape. In practice the parameters are often combined or swapped against each other.

Entdecke mehr