---
title: Temperature — AI Glossary
description: 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.
canonical: https://prompeteer.ai/glossary/temperature
---

# 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

At 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.

## Sources

- [OpenAI — API reference (temperature parameter)](https://platform.openai.com/docs/api-reference/chat/create)
- [Holtzman et al. (2020), The Curious Case of Neural Text Degeneration](https://arxiv.org/abs/1904.09751)

## Related terms

- [top-p](https://prompeteer.ai/glossary/top-p)
- [inference](https://prompeteer.ai/glossary/inference)
- [hallucination](https://prompeteer.ai/glossary/hallucination)
