Why does the AI give a different answer every time?
That is the whole lesson. Every word an AI writes is picked from a probability distribution. It is essentially rolling weighted dice at every step. Two runs of the same prompt take two different paths through those dice rolls. This is called non-determinism, and it is on purpose. The opening 'Run It Twice' section makes it visible in ten minutes with any class.
Does turning down the AI's 'temperature' setting get rid of non-determinism?
It reduces it substantially but not always fully. Temperature controls how much the AI weighs less-likely next-token choices. At zero, the model picks the top-scoring token every time, so two identical prompts usually produce identical answers. Yet many deployed chatbots add small randomness at other layers, or route your prompt to different underlying servers, so true zero-variance behaviour is not guaranteed.
Are all AI systems non-deterministic, or only large language models?
Only some. Traditional programs, a calculator or a payroll system, are deterministic by design: same input, same output, every time. Large language models and image generators sit at the other end because they sample from probability distributions. Recommender systems, spam filters and search rankers sit in between, mostly deterministic but with randomised elements added to keep results fresh. Non-determinism is a choice, not an accident.
What if pupils get very different results from the AI demo?
That is the lesson. Ask them to compare answers, note the differences, and discuss why the outputs diverged. The variety is the point, not a fault to fix. If a pupil says 'the AI is broken', that is exactly the moment to introduce non-determinism as the answer. The classroom noise around that comparison is often the most memorable part of the hour.
Does non-determinism mean AI cannot be trusted for maths, code, or anything with a right answer?
It means the same prompt can produce different answers, some correct and some wrong. The workaround is verification, not avoidance. Run the prompt twice; if the maths matches, trust it more; if it disagrees, dig in. For code, run the code. For citations, check the source. Non-determinism is a reason to build a checking step into the workflow, not to avoid AI outright.
Can two identical prompts ever produce identical answers?
Yes, but only in narrow conditions. If the temperature is set to zero, the same server is used, no context or memory has changed, and the model has not been silently updated, then the outputs can match exactly. Change any one of those variables and the answers diverge again. Most consumer chatbots do not expose those controls, so identical replies are rare in classroom use.
Is non-determinism a bug or a feature?
A feature, and a deliberate one. A model that produced the same reply every time would be repetitive, brittle, and often stuck on a mediocre answer that happened to score highest. Sampling from a range of plausible next tokens produces the variety, creativity and paraphrase we actually want from a chatbot. The cost is unpredictability, which we then manage with prompting, verification and temperature control.
How does non-determinism affect using AI for medical or legal work?
It raises the stakes on verification. A radiologist asking a chatbot to summarise a scan cannot trust that two runs of the same query produce the same summary, so any AI-derived clinical detail must be cross-checked against the primary record. Legal drafting is the same: a clause paraphrased by AI in one session may reappear differently in another. Non-determinism forces a human-in-the-loop discipline.