Skip to content
Inside AI

Temperature: Why the Same Question Gets Different Answers

Why AI answers the same question differently: what temperature is, how it spreads out the odds for each word, and when to turn it down or up.

Rodrigo Faustino ·

Call number
DEN-003
Level
Beginner
Reading
5 min
Published
Lab
Temperature

The same question gets different answers because AI doesn’t pick the next word with certainty: it calculates a probability for every possible word and draws from among them. Temperature is the setting that controls that draw. Set low, the AI almost always takes the most probable word. Set high, it takes chances on less obvious words.

AI Writes One Word at a Time

A language model generates text one piece at a time. At each step, it looks at everything written so far and assigns a score to each piece that could come next. Those scores are turned into percentages that add up to 100%.

Think of the sentence “I looked out the window and the sky was.” The word “blue” is very likely. “Cloudy” and “clear” also make sense. “Green” is possible, but strange. The model doesn’t store a ready-made answer. It stores this list of odds.

Bar chart with the probability of each next word for the sentence the sky was: blue 36.3%, cloudy 24.3%, clear 14.8%, gray 12.1%, starry 5.4%, beautiful 4.4%, orange 2.2%, and green 0.4%
Illustrative numbers, built for the example. In a real model the list has tens of thousands of options.

After calculating the odds, the program draws a word, adds it to the text, and starts over. Because each draw changes what comes next, two answers that start out different can end up on very different paths.

What Temperature Does to the Odds

Temperature comes in before the draw. It divides the scores by a number and only then turns everything into percentages. The effect is easy to see:

  • Temperature near 0: the gap between words widens. The most probable one gets almost all of the odds.
  • Temperature 1: the odds stay as the model calculated them.
  • Temperature above 1: the gap shrinks. Rare words gain ground and the text gets more varied, sometimes to the point of nonsense.

The name comes from physics: in a hot system, higher-energy states become more likely. Here, the higher the temperature, the more the odds spread out to less probable words. It’s an analogy, not a real thermometer.

Three side-by-side panels with the odds for the words blue, cloudy, clear, gray, and green: at temperature 0, blue has 100%; at temperature 1, blue has 36.3%; at temperature 2, blue drops to 24.3% and green rises to 2.6%
At temperature 2, the odd word is more than six times as likely as at temperature 1.

Play with the Temperature

In the lab, drag the slider from 0 to 2 and watch the bars. Then use the button that draws 20 words at once, at each temperature, and compare the results.

LabTemperatureTry it

Illustrative data Example values to show the idea. Not output from a real model.

SentenceI looked out the window and the sky was ___

Chance of each next word (Temperature 1.0)

  • blue36.3%
  • cloudy24.3%
  • clear14.8%
  • gray12.1%
  • starry5.4%
  • beautiful4.4%
  • orange2.2%
  • green0.4%
Open this lab on its own page →
What to notice: At 0 you always get the same word. Near 2 the bars almost even out and odd words show up often.

If you drew 20 times at a high temperature, you probably saw “orange” appear and, with some luck, even “green.” Now imagine that happening at every word of an entire paragraph: that’s how creative text is born, and also how a text goes off the rails.

Where This Control Lives

In an everyday chat app, you normally can’t see the temperature. The company has already chosen a value. The control shows up in the developer version, the API, and in test panels that some companies offer.

In OpenAI’s API, for example, the documentation lists a temperature between 0 and 2, with a default of 1, and recommends adjusting either the temperature or another sampling parameter called top_p, but not both at once. Other companies use different scales, so check the documentation for the tool you use.

Even without the control, you can get a similar effect through your request:

Give me 10 names for a neighborhood bakery. I want options that are
very different from one another, including some unexpected ones.
Extract only the date and the purchase amount from this text. Don't
add anything that isn't written there.

The first request invites variety. The second shuts the door on creativity. The draw still happens, but you’ve changed what’s probable.

When to Turn It Down and When to Turn It Up

The rule of thumb is simple: the more there’s one right answer, the lower the temperature. The more you want options, the higher.

Two-column chart: low temperature for extracting data, summarizing, classifying, generating code, and repeatable answers; high temperature for brainstorming, names, poems, multiple versions, and avoiding the obvious
Start with the default and adjust a little at a time.

Cautions

Temperature 0 doesn’t guarantee the same answer every time. Anthropic’s glossary warns that even at 0, output through the API isn’t fully deterministic: identical inputs can produce different responses. If you need exact repetition, save the answer instead of asking again.

Low temperature doesn’t fix mistakes. It only makes the model choose the most probable option. If the most probable option is wrong, it will be wrong more consistently.

Asking again is a tool. Because every answer is a draw, generating two or three versions and comparing them helps you see what’s solid (it shows up in all of them) and what’s invented on the spot (it changes each time).

Keep Reading

References

  1. OpenAI. API Reference: Create chat completion (temperature parameter). Consultado em Nov 28, 2026.
  2. Anthropic. Glossary: Temperature. Consultado em Nov 28, 2026.
  3. Jurafsky, Daniel; Martin, James H.. Speech and Language Processing, 3rd edition, online draft, chapter on large language models (2025).

On the same shelf2 books