Temperature
Temperature is a sampling parameter that controls the randomness of a language model's output. It scales the token probability distribution before sampling: values near zero make output nearly deterministic and focused, while higher values flatten the distribution, producing more diverse and creative but less predictable text.
Definition
TemperatureAt each generation step a model produces a probability for every possible next token. Temperature divides the underlying logits before they are turned into probabilities. A low temperature sharpens the distribution so the most likely tokens dominate, favoring consistency and factual tasks; a high temperature flattens it, giving lower-probability tokens a real chance and increasing variety.
Temperature is often tuned alongside top-p (nucleus) sampling. Providers generally recommend adjusting one or the other rather than both at once, since they interact. For tasks that need reproducibility, a temperature at or near zero is typical.
Frequently asked questions
What is Temperature?
Temperature is a sampling parameter that controls the randomness of a language model's output. It scales the token probability distribution before sampling: values near zero make output nearly deterministic and focused, while higher values flatten the distribution, producing more diverse and creative but less predictable text.
Sources
Related terms
← Full AI & prompt engineering glossary
Put Temperature to work with Prompeteer, the Agentic Contextual AI Platform →