IntegrAuth Academy
Identity, security and practical AI — free, from zero. Byte-sized lessons, real diagrams, hands-on labs, zero fluff. Two programs, each with its own exam and certificate.
English is hard? Your browser can translate this page into Tamil, Telugu, Kannada, Malayalam or Hindi. Tech words stay in English so you learn the real names.
How?
- Chrome on phone: ⋮ menu → Translate
- Chrome on computer: right-click → Translate to …
- Edge: the translate icon in the address bar
Why answers change: temperature
Priya presses Regenerate and gets a different meeting summary. Nothing is broken. Your goal: learn what the temperature setting changes, and when to turn it down.
🧪 Interactive lab — enable JavaScript to play with this one.
- The AI picks each next word with a kind of dice roll. So answers can change.
- Temperature changes how much answers vary. It does not make the AI smarter.
- Go low for jobs with one right answer. Go higher to brainstorm.
- Different answers to a fact question? The AI is not sure. Check a source.
Rolling a die
The model gives every possible next token a score. This raw score is a logit. A formula turns the scores into chances that add up to 100%. This formula is softmax.
Now there are two ways to pick. The model can always take the top choice. This is greedy decoding. Or it can roll a die where likely tokens come up more often. This is sampling. Most chat assistants sample. That is why their answers change.
The dial
Before the roll, one setting changes the shape of the die. It is called temperature. Low temperature makes the favorite even more likely. Near 0, the favorite almost always wins. High temperature gives unlikely words a real chance, even odd ones.
Think of a cook at a tiffin shop. At a low setting, the cook makes the same dish the same way every day. At a high setting, the cook tries new fillings. Some are lovely. Some are strange.
Pick the setting for the job
| Job | Start with |
|---|---|
| Pull facts from a file, sort tickets, write code | Low |
| Everyday emails and summaries | The default |
| Brainstorm names and ideas | Higher |
These are starting points. Test the results with an eval.
Now guess the dial from five runs.
🧪 Interactive lab — enable JavaScript to play with this one.
Go deeper: the math behind the die
Take the prompt “The weather today is”. Say there are three choices. “Sunny” scores 4, “cloudy” scores 3 and “purple” scores 1. Softmax turns these into about 70.5%, 25.9% and 3.5%. With sampling, “sunny” wins about 70 times in 100.
Temperature is a number, T. Each score is divided by T. Then softmax runs as usual: p = softmax(score ÷ T). T = 1 keeps the chances as the model made them. T below 1 makes them sharper. T above 1 makes them flatter. T close to 0 acts like greedy decoding.
Greedy decoding gives the same answer each time. But its text can be flat, and it can repeat itself in a loop. Sampling usually sounds more natural. The model’s knowledge is the same at every setting.
Go deeper: top-k and top-p
A model has a list of tens of thousands of tokens, or more. Most make no sense as the next word. Each one has a tiny chance, but together they add up. Two settings drop these unlikely tokens before the roll.
- Top-k keeps only the k most likely tokens, for example the top 40.
- Top-p keeps the smallest group of top tokens whose chances add up to p, for example 90%. Its other name is nucleus sampling.
Here is top-p at 90% with the weather example. “Sunny” and “cloudy” already reach about 96%. So “purple” is dropped. The two that are left are scaled back up to 100%. They become 73.1% and 26.9%.
The order is: scores, divide by T, softmax, top-p, then the roll. These settings work on the same thing. So change one at a time.
Go deeper: temperature 0 is not a promise
Temperature 0 gives nearly the same answer each time, but not always. Some providers say so in their own documentation. Tiny math differences on the servers can change a close choice. One different token changes all the text after it.
A low setting also does not make answers right. The model picks its top guess every time. A top guess can be wrong every time, too.
Priya labels support tickets as billing, login or bug. Each run gave different labels. She set the temperature to 0. She gave the model a fixed list of labels, with an example of each. The labels became stable. She still checks a sample each week. Stable and right are different things.
Must a result be exactly repeatable, like an audit record? Save the output you used. Do not run the prompt again. See agent audit trails.
Go deeper: when you cannot set it
As of October 2026, many reasoning models reject or ignore a custom temperature. For others, the provider advises leaving it at the default. You steer them with other settings, like effort level, and with your prompt. See Choosing a model.
Chat apps rarely show the dial. But it is a real setting in many APIs (ways for programs to call a model), and in models you run yourself. See Open and closed models. The allowed range can differ from one provider to the next.
To move a real dial, try Transformer Explainer. It runs a small model in your browser, with temperature, top-k and top-p controls.
The same answer five times is not proof. It only shows the AI is consistent. See When AI makes things up.
Ask any AI for “five names for a coffee shop run by robots” three times. Then ask one fact question three times. Which set changed more?