What is Temperature (Sampling)

Definition

Temperature is a sampling parameter that controls the randomness of a language model's output, where lower values make responses more focused and deterministic and higher values make them more varied and creative, letting users tune the balance between predictability and diversity.
« Back to Glossary Index
  • Tunes output between deterministic precision and creative variety
  • Low temperature improves consistency for factual or structured tasks
  • High temperature encourages diverse, creative generation
  • Gives fine control over model behaviour without changing the model

Real World Example

A developer sets a low temperature when extracting data into a fixed format for reliable, consistent results, then raises it for brainstorming taglines where varied, creative output is the goal.

FAQs

What does temperature control?

It controls the randomness of the model's token choices, trading off between focused, predictable output and diverse, creative output.

When should temperature be low?

For tasks needing accuracy and consistency, such as data extraction, classification, or factual answers.

How does temperature relate to top-p?

Both control output randomness; temperature scales probabilities, while top-p limits sampling to the most probable tokens, and they can be combined.

Hello popup window