esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Does Temperature Control?

What temperature does to an AI model's word choices, why zero is still not fully fixed, and when to turn it up or down, for your AI interview.

In short

Temperature is a setting that controls how random a model's word choices are. A low setting makes the most likely word win, so answers stay steady. A high setting lets less likely words through, so answers vary more.

10 min readBeginnerVery common · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

Temperature controls how random the model's word choices are. For each word it writes, the model gives every candidate a chance. A low temperature makes the likely words much more likely, so answers are steady, which suits pulling out fields or sorting tickets. A high temperature spreads the chances out, so the wording varies more. Even at zero, results are not fully fixed between calls, so I never rely on temperature for accuracy. I check figures in code.

What does temperature mean, in plain words?

A language model writes text one token at a time. A token is a small piece of text, often part of a word. Before each token, the model gives every possible next token a score, and those scores turn into chances.

Temperature is the dial that decides how strictly the model follows those chances. Turn it down and the likeliest choice wins most of the time. Turn it up and the model is more willing to try a less likely word.

Think of a call centre agent reading from a script. At a low setting, they read the approved line every time. At a high setting, they choose from a wider set of phrasings, so two calls sound different. A wider choice also means a poor phrasing can come out. In the model, the same choice happens for every word, so a bank's drafted reply can vary from run to run.

Key words

Chance
The score turned into a percentage. The chances for all candidate words add up to 100%.
Softmax
The step that turns raw scores into chances. Temperature acts just before it.
Sampling
Picking one word at random, weighted by its chance.
Greedy decoding
Always taking the single most likely word.

How does temperature change the chances?

The model first gives every candidate a raw score. A step called softmax turns those scores into chances. Temperature is applied to the scores before that step, so it reshapes the chances without touching the model's knowledge.

How one word gets picked

Language model

scores every candidate word

Shape the chances

Temperature

sharpens or flattens the scores

Top-k or top-p

keeps only the likely few

Pick one word

drawn by its final chance

Add it and repeat

until the reply ends

  1. 1Every candidate word gets a score from the model.
  2. 2The scores are reshaped, then one word is drawn from what is left.
  3. 3The chosen word joins the text, and the loop starts again.
The model scores every candidate, the settings reshape those scores, and one word is drawn from what is left. Temperature is one of the settings in the middle.

Here is a worked example. A made-up model has just read a refund policy for a bank and must finish a policy sentence that starts with refunds over $500 needing a manager's. Its own chances are 62% for approval, 18% for sign-off, 10% for review, 6% for check and 4% for form.

Five candidates for one word

The sentence so far

Refunds over $500 need a manager's

Model's own chances (1.0)

approval 62%

the likeliest next word

sign-off 18%

a distant second

others 20%

review, check and form together

Temperature 0.5

approval 89%

almost nine in ten picks

sign-off 8%

shrinks toward zero

others 3%

review, check and form together

Temperature 1.5

approval 47%

still top, but not by much

sign-off 21%

now close to approval

others 32%

three lower words, a real share

  1. 1The prompt goes to the model, which scores five candidate words.
  2. 2A temperature of 0.5 sharpens those chances, so the top word takes most picks.
  3. 3A temperature of 1.5 flattens them, so the lower words get a real share.
The model's own chances come first, then the same five candidates at two temperatures. At 0.5 the top word takes 89% of picks. At 1.5 the lower words get a real share.

A temperature below one makes the top choice pull further ahead. A temperature above one flattens the spread, so more words get a turn. Geoffrey Hinton and his co-authors used a higher temperature to produce softer training signals, so a small model could learn from a large one.

Here is the same maths in a short Python program. It starts from the same five chances and prints what each setting does.

Python
import math

WORDS = [" approval", " sign-off", " review", " check", " form"]
SCORES = [math.log(p) for p in (0.62, 0.18, 0.10, 0.06, 0.04)]

def chances(scores, temperature):
    scaled = [s / temperature for s in scores]
    top = max(scaled)
    exps = [math.exp(s - top) for s in scaled]
    total = sum(exps)
    return [e / total for e in exps]

for t in (0.5, 1.0, 1.5):
    row = chances(SCORES, t)
    shown = "  ".join(f"{w.strip()} {p:.0%}" for w, p in zip(WORDS, row))
    print(f"temperature {t}: {shown}")

Output

temperature 0.5: approval 89%  sign-off 8%  review 2%  check 1%  form 0%
temperature 1.0: approval 62%  sign-off 18%  review 10%  check 6%  form 4%
temperature 1.5: approval 47%  sign-off 21%  review 14%  check 10%  form 8%

Some tools also offer top-k and top-p. These two settings cut the list of candidate words before one is picked. Top-k keeps only the k most likely words. Top-p keeps the fewest likely words whose chances add up to p. Check your provider's guidance before you change more than one of these at once.

Which setting should you use, and when?

Pick the setting for the job at hand. Low settings suit jobs with one right answer, such as pulling fields out of a form or routing a ticket. Higher settings suit drafts and options, where variety is the point.

  • Lower

    Extraction and routing

    Claim numbers, ticket labels and fields copied from a form. The same input should give the same answer, and code checks it.

  • Higher

    Drafts and options

    Subject lines, five ways to open a complaint letter, or names for a new product. A person reviews every one.

  • Watch out

    Higher adds no facts

    Turning it up only changes which words are picked. A wrong figure can still come out in smooth, fluent text.

  1. 1

    Start low for routing

    A complaint about a fee gets the same label each run, so the queue stays right.

  2. 2

    Check the output in code

    The label must be one of the six known labels. Anything else goes to a person, not the customer.

  3. 3

    Raise it only for wording

    Drafted replies can use a higher setting, and an agent signs off before anything is sent.

  • “Even with temperature set to 0, the results will not be fully deterministic, and identical inputs might produce different outputs across API calls.”

    Anthropic

  • “Temperature is a parameter that controls the randomness of a model's predictions during text generation.”

    Anthropic

Tip

If asked how to make output repeatable, say a low setting helps. It is still not a guarantee. Anthropic's glossary warns that identical inputs can still produce different outputs, even at zero.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: temperature reshapes the chances the model picks from.
  • What a low and a high setting do, with a chance example.
  • Why zero is still not a guarantee of identical output.
  • Temperature changes which words get picked, so it cannot fix wrong facts.
  • Low for extraction and routing, higher for drafts.
  • Code checks anything that must be exact.

Common traps

  • Trap"Set the temperature to 0 and the answers are always correct."

    BetterZero makes the output steadier, but it does not make facts correct. Check figures in code.

  • Trap"A higher temperature makes the model smarter."

    BetterIt only changes which words get picked.

  • Trap"Temperature 0 gives identical output every time."

    BetterNot guaranteed. Results are not fully deterministic across calls.

Can you spot the problem?

Spot the setting

A claims team wants one setting for a model that reads claim forms and writes 12 fields into the claims database. Which config is right?

Quick check

A discharge-note tool gives different wording on each run, and a nurse says a dose line changed. What do you do first?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q011What is top-k sampling?11 min
  2. Q012What is top-p (nucleus) sampling?10 min
  3. Q013Greedy vs beam search vs sampling?12 min
  4. Q014Why can one prompt give different answers?11 min
  5. Q022What are logits, and what does softmax do?11 min
  6. Q023What is a hallucination, and why does it happen?11 min

Learn it in depth

Last updated on 26 November 2026

Building an AI tool that must give the same answer twice?

I design and build AI products and agents (the UI and the system behind it), so book a short call and say what you need.