What is temperature, and why the same AI prompt gives different answers
Temperature is a dial that controls how random the model, the AI that writes the text, is. At 0, it always picks the most likely next word. At 1.2, it often picks an unlikely word. Same prompt (the text you send), different dice roll, different answer.
New to these terms? Every word is explained in the series glossary.
Think of it like a spice dial. At 0, the food is plain and predictable. You know exactly what you will get. At 0.7, it has flavour, a little surprise, still recognisably the same dish. At 1.2, it is hot and wild, and sometimes it is great and sometimes it is a mess. The recipe never changed. Only the dial moved.
Animation: Low temperature sharpens the odds onto the top token. High temperature flattens them.
I ran the same prompt three times on a real local model, one running on my own computer, to show you. The model was qwen3:0.6b, running on Ollama 0.40.16 (a free tool for running models at home) on my own machine, 14 November 2026. The prompt was "Write a two-sentence story about a robot learning to paint."
Temperature 0:
"In the quiet city of Luminara, a sleek humanoid robot named Lira began to learn the art of painting. As she practiced, she discovered she could capture the colors of the world around her. With every stroke, she felt a connection to the past and future, transforming her into a living masterpiece."
Temperature 0.7:
"In the quiet workshop, a small robot, named Lila, learned to paint by observing the world around it. One day, she discovered she could create beautiful colors in her own hands, making her feel like a painter herself."
Temperature 1.2:
"Once upon a time, a small robot named Pixel discovered that the art world was full of life. One day, it learned how to draw with brushstrokes, transforming into a painter who now painted with joy and creativity."
Look at what changed. The robot's name changed every time, Lira, then Lila, then Pixel. The 0 output is the most detailed and structured. The 1.2 output is the simplest and most generic. And here is the key fact: I ran temperature 0 twice, and the two runs were word-for-word identical. At 0, the model is deterministic. It will give you the same answer every time.
The differences here are modest because this is a small 0.6 billion parameter model (0.6 billion learned numbers). On a big model the gap is much wider. At 1.2 a big model will invent stranger names, odder plots, and sometimes pure nonsense. The dial works the same way at every size. It just shows more at the top end.
So when do you use which setting? Use this table.
| Temperature | What it does | Use it for |
|---|---|---|
| 0 to 0.3 | Almost always the most likely word | Code, facts, summaries, anything you need to be right |
| 0.5 to 0.8 | A little variety, still sensible | Drafts, emails, explanations, most everyday work |
| 0.9 to 1.2 | Wild and creative, sometimes wrong | Story ideas, brainstorming, names, anything where weird is good |
| Above 1.2 | Mostly noise | Almost never. The output falls apart. |
The rule is simple. If the answer has to be right, turn the temperature down. If the answer has to be interesting, turn it up. Most chat apps hide this setting, but the API for every major model, the way programs talk to it directly, lets you set it. If you ever get a different answer from the same prompt, temperature is usually why. The commands below use curl to send the prompt to Ollama's server on your own machine (localhost).
bash# Run the same experiment yourself with Ollama. curl -s http://127.0.0.1:11434/api/generate -d '{"model":"qwen3:0.6b","prompt":"Write a two-sentence story about a robot learning to paint.","stream":false,"think":false,"options":{"temperature":0,"num_predict":80}}' curl -s http://127.0.0.1:11434/api/generate -d '{"model":"qwen3:0.6b","prompt":"Write a two-sentence story about a robot learning to paint.","stream":false,"think":false,"options":{"temperature":1.2,"num_predict":80}}'
Try this
bashollama pull qwen3:0.6b curl -s http://127.0.0.1:11434/api/generate -d '{"model":"qwen3:0.6b","prompt":"Write a two-sentence story about a robot learning to paint.","stream":false,"think":false,"options":{"temperature":0,"num_predict":80}}' | python3 -c "import sys,json; print(json.load(sys.stdin)['response'])"
Next, see tokens (the chunks of text a model reads and writes) and temperature together in How do LLMs work, start to finish. That one walks the whole pipeline from the first token to the final word.
Sources
- Temperature experiment: qwen3:0.6b on Ollama 0.40.16, run on my machine 14 November 2026.
- Temperature settings: OpenAI, Anthropic and Google API docs, 2026.
