You ask your AI a question. Then you ask the exact same question again, and the answer comes back different. Not wrong, exactly. Just different. It feels like the tool is broken, or was not listening the first time. Neither is true. The difference is built into how the answer is made, one word at a time, and a setting called temperature decides how much of it is left to chance.

Chapter 38 of the Deployed Lab course, on how LLM inference works, follows a single guess through the model. The AI writes its answer one word at a time. For each new word, it rates every possible next word with a score. You might expect the top score to win every time. In practice, real models pick among the top few scores rather than always taking the single best, and that is why the same question gets slightly different answers each time. The chapter's own example is small: after the words "See you", the word "soon" scores top and gets picked. On another run, a different top-scoring word can win, and one different word early can steer everything after it.

The choice among the top few is what the temperature setting controls. Chapter 55 of the course, on demo craft, gives it an everyday picture: at each step the model picks the next word from several likely options, with some chance involved, like rolling a weighted die. So the same question can get two answers. The chapter's example is a refund question: one run answers "Yes, refund it within 30 days", and the next answers "Yes, if it is under 30 days old". Temperature controls how much chance is involved in that roll. Turn it down and the safest, most likely word wins almost every time, so answers stay steadier. Turn it up and the odds flatten, so riskier words get picked more often, and answers come out more varied and surprising. One warning from the chapter is worth keeping: turning temperature down reduces the variation, but in general it does not remove it.

Why it matters

Once you know the dice are there, you stop judging an AI by a single answer. A better or worse reply on the second try does not mean the model got smarter or dumber between your two questions. It means the roll landed differently. Chapter 55 draws the practical lesson for anyone showing or shipping an AI tool: say up front that answers can vary, and measure quality across a fixed test set, not by one lucky run. If a tool matters to you, ask how it performs across many questions, including the ones it gets wrong, instead of trusting the one answer you happened to see.

Sources: this story teaches from Chapter 38, How LLM inference works, and the "Why do AI answers change" section of Chapter 55, Demo craft, of the Deployed Lab course.

Go deeper

Chapter 38 goes further: prefill and decode, the KV cache sticky notes, and the memory maths that decide how many chats fit on one GPU. Chapter 55 covers how to talk about varying answers honestly, with measured results. The full interactive course, 11 chapters free, no signup, is at deployedlab.dev.

← All the latest in AI