Generative AI & LLMs

temperature

/ TEM-pur-uh-chur /

Temperature is a single dial that controls how adventurous a language model is when choosing its next word. At each step the model produces a ranked list of candidate words with probabilities — "the" likely, "banana" unlikely. Temperature reshapes that list before a word is picked. Low temperature sharpens the odds so the model almost always grabs the most probable word; high temperature flattens them, giving the underdogs a real chance and letting surprising words slip through.

Think of it as a creativity-versus-reliability knob. Turn it down near zero and the model becomes focused and repetitive, ideal when you want the same correct answer every time — extracting a date, returning valid code, doing arithmetic. Turn it up and the model becomes loose and inventive, good for brainstorming, fiction, or varied phrasing — at the price that it wanders, contradicts itself, and is likelier to say something false. Most chat assistants sit at a moderate setting that balances the two.

A crucial honesty check: temperature changes how the words are selected, not how much the model actually knows. Cranking it to zero makes the output deterministic and tidy, but a confident, low-temperature answer can be just as wrong as a wild one — it simply commits to its single best guess. Temperature tunes the style and variety of the output; it does nothing to make the underlying knowledge more correct.

Prompt: "A name for a coffee shop:". At temperature 0 the model returns the same safe "The Daily Grind" every time. At temperature 1.0 it returns "Bean There," "Cup of Dawn," "Steam & Stone" — different and more inventive on each run, but occasionally odd.

Low temperature: safe and repeatable. High: varied and surprising.

Temperature 0 makes output (nearly) deterministic and is great for tasks needing one correct, repeatable answer — but it does not make the answer correct. A low-temperature model still hallucinates; it just hallucinates the same thing every time.

Also called
sampling temperature温度溫度采样温度