AI & Machine Learning

Temperature (LLM sampling)

Also known as: LLM temperature, sampling temperature, AI temperature setting

Temperature is a setting that controls how much randomness an AI language model uses when picking each next word.

At low temperature, the model sticks to its most likely choices, giving focused and repeatable answers. At high temperature, it takes more chances, giving varied and creative but sometimes odd results. While temperature is often explained as a creativity dial, even a temperature of zero doesn't always guarantee identical answers.

Temperature (LLM sampling), explained at three levels

At home

Think of a jukebox that usually plays the most popular song, but sometimes picks something unexpected. Temperature sets how often it takes that chance. When an AI writes, it chooses each word from a list of likely options. A low temperature makes it nearly always pick the top choice, while a higher one lets less likely words through, making text more varied and sometimes stranger.

At work

Temperature is a setting that controls how much randomness an AI language model uses when choosing each next word. Low values give focused, repeatable answers; higher values give more varied, creative ones. Businesses set it per task, low for data extraction, classification, and code, and higher for brainstorming or marketing copy, and document it alongside the prompt so behaviour stays consistent.

Real-world examples

At home

Nadia used an AI to brainstorm names for her bakery. Turning up the temperature gave quirky, unexpected ideas, while a low setting kept repeating safe names.

At work

Carlos is a data engineer at a Saskatoon agriculture company. He set temperature to zero for an AI tool that pulls figures from invoices, reducing inconsistent results.

How it compares

featureLow temperatureHigh temperature
Word choicesMost likely onlyMore varied
RepeatabilityHighLow
Best forFacts, extraction, codeBrainstorming, fiction
RiskBland or repetitiveIncoherent or off-topic

Low temperature is steady. High temperature is surprising.

For analysts

For business processes, I'd set and document temperature with the prompt and model version. Treating it as part of the specification avoids mysterious changes in behaviour.

History & origin

The term comes from statistical physics, where temperature controls how evenly energy spreads across states, following Ludwig Boltzmann's work in the 1800s. Machine learning borrowed the idea for the softmax function, which turns model scores into probabilities; Geoffrey Hinton and colleagues used temperature in their 2015 work on knowledge distillation. As text generators improved, developers used temperature to balance coherence and variety. In 2019, Ari Holtzman and colleagues introduced nucleus sampling, or top-p, as a complementary control that limits choices to the most probable words. AI APIs from OpenAI, Anthropic, Google, and others exposed temperature as a standard parameter, though some reasoning models restrict changing it. In my view, temperature is the most misunderstood setting in AI, often blamed for problems that better prompts would fix.