What Temperature Does
Temperature controls how much randomness the model uses when picking from the probability distribution. At temperature 0, it always picks the most likely token (deterministic, repetitive). At temperature 1, it samples proportionally (creative, varied). At temperature 2, even unlikely tokens get a chance (chaotic, often nonsensical). Most APIs default to 0.7-1.0.
Key insight: Temperature and prompt specificity work together. A vague prompt + high temperature = chaos. A specific prompt + low temperature = predictable, focused output. For factual tasks (data extraction, code), use temperature 0-0.3. For creative tasks (brainstorming, writing), use 0.7-1.0.
Temperature Effects
# Same prompt at different temperatures:
# "Name a color"
# Temperature 0 (always most likely):
"Blue" → "Blue" → "Blue" → "Blue"
# Temperature 0.7 (balanced):
"Blue" → "Red" → "Green" → "Blue"
# Temperature 1.5 (very random):
"Cerulean" → "Mauve" → "Burnt sienna"
# Practical settings:
# Code generation: T = 0
# Data extraction: T = 0
# General chat: T = 0.7
# Creative writing: T = 0.9-1.0
# Brainstorming: T = 1.0-1.2