Graph
Temperature

🌡️Temperature

NEW

A parameter controlling randomness in probabilistic token sampling.

DESCRIPTION

Temperature rescales logits before softmax to modulate output randomness. Lower values make distributions peakier and outputs more deterministic; higher values increase diversity and risk of errors. It interacts with Top-k and Top-p to fine-tune style. For safety-critical tasks, temperatures near zero improve consistency. Creative tasks often benefit from moderate temperatures.

ALTERNATIVE DEFINITIONS

OpenAI

Temperature controls the randomness of the model’s output; lower values make it more focused and deterministic, while higher values increase diversity.

Directly links temperature to determinism versus diversity trade-off.

Source

Hugging Face

Temperature is a scaling factor applied to the logits before softmax; decreasing it makes the distribution sharper, increasing it makes it flatter.

Explains the mathematical effect on logits and distribution sharpness.

Source

Top-k Sampling Nucleus Sampling Greedy Decoding Softmax Logit Entropy Decoding Strategies Language Model

COMPETING TERMS

Deterministic Decoding

KNOWLEDGE AREAS

AI Data Science

TARGET AUDIENCE

AI Engineer Data Scientist MLOps Engineer

EXTERNAL SOURCES

TOP QUESTIONS

How does Temperature affect outputs?

Lower temperatures reduce randomness and increase determinism; higher values increase diversity at the cost of coherence.

Category: Concept

What Temperature should I use?

Start near 0.2–0.7 for balanced quality. Lower for factual tasks, higher for creative ones.

Category: How-to

Can I tune Temperature with Top-p or Top-k?

Yes. Joint tuning refines style; many teams adjust one primary parameter to avoid overcoupling.

Category: BestPractice

Does Temperature impact greedy decoding?

No. Greedy selects the argmax regardless of temperature scaling.

Category: Misunderstanding

What are risks of high Temperature?

Increased hallucinations, off-topic drift, and unstable outputs. Calibrate carefully per use case.

Category: Risk

How to evaluate Temperature choices?

Run A/B tests across temperatures and measure task metrics and human preferences.

Category: Evaluation

Is Temperature tied to model size?

Not directly. Optimal values vary by model family, domain, and prompt structure.

Category: Opinion

Should I change Temperature mid-generation?

Advanced setups do, but it complicates control. Most use a fixed value per request.

Category: Requirements

How does Temperature relate to entropy?

Lower temperature reduces entropy, concentrating probability mass; higher temperature increases entropy.

Category: Concept