Temperature is a tuning parameter for language models that controls how random or deterministic a model is when choosing words.
For every generated token, a language model computes a probability distribution over all possible next words. A low temperature (close to 0) makes the model almost always pick the single most likely word, producing consistent, predictable but sometimes repetitive answers.
A higher temperature (roughly 0.7 to 1.0 or above) lets the model pick less likely words more often, producing more creative and varied but also more error-prone answers.
For tasks such as code generation, factual answers or data processing, a low temperature is usually recommended, while creative writing or brainstorming benefits from a higher temperature.



