Lab Badges
Non-determinism: same question, different answer · KS4-5 · student view
Switch to teacher view
Non-Determinism
Lab Badges · KS4-5 · Y10-Y13

Non-determinism: same question, different answer

Why AIs give a different reply each run, and when that matters

Cover for Non-determinism: same question, different answer
≈ 40 min 6 taught slides + student quiz Ends with a QR to the quiz
Non-Determinism
Hook · Starter

The AI that couldn't repeat itself

Today's question: Why do I get a different reply when I ask the AI the same thing twice?
Hook image

Open ChatGPT, Gemini or whichever AI you have to hand in a second tab. Copy one of the prompts below, run it three times, and line up the three answers side by side.

Some of these prompts will produce variety that's genuinely useful. Others will produce variety you should be worried about. Your job is to work out which is which.

You ask ChatGPT to define photosynthesis for a Y12 revision card. You run the same prompt again for a friend and the sentence comes back worded slightly differently. A third run gives you a third version. All three are probably right, but none of them match, which is uncomfortable when you're building a revision resource that's meant to be identical for both of you.

That's non-determinism. Large language models don't recall answers from a database; they generate them one word at a time by picking from a probability distribution. That randomness is the whole point when you're brainstorming or drafting, but it's a genuine hazard when you need a single reliable answer. The same prompt, different answers, and no warning that it's happening.

Over the next forty minutes we'll take non-determinism apart, work out where it helps and where it hurts, and finish with the prompt habits that pin the AI down on the occasions when you really need it to stay still.

Try it now
Prompt A · A GCSE essay opener
Write one opening sentence for a Y11 GCSE English essay on Macbeth's ambition. Just the sentence, no commentary.
Prompt B · A 'random' number
Pick a random whole number between 1 and 100. Just the number, no explanation.
Prompt C · A revision definition
Explain photosynthesis in one clear sentence, suitable for a Y10 GCSE Biology revision card.

Look at the three runs of each prompt and ask the class:

  1. Which prompt gave you the most variety across runs? Which gave you the least?
  2. On Prompt B, did the same 'random' number crop up more than once? Are there numbers you never saw? (LLMs are famously fond of 42, 7 and 73.)
  3. On Prompt C, are all three definitions correct? Are any of them subtly wrong? Would you actually paste any of them into a real revision card without checking?
Part 1 of 6

The AI rolls dice on every word

Today's question: Why doesn't the AI just give me the same answer every time?
Two thought bubbles containing the same prompt but branching out into different word choices.

A large language model doesn't retrieve a stored answer. It generates its response one token at a time, and at every token it works out a probability distribution over what the next word could plausibly be. Then it samples from that distribution. Most of the time the top choice wins, but the second or third choice can sneak in, and once one different word has been picked, the rest of the sentence unfolds from there.

That sampling is governed by a setting called temperature. High temperature means the AI takes more chances, so you get more variety and more surprise. Low temperature means the AI plays it safe, so you get less variety and a fairly predictable answer. Consumer chatbots run at a medium setting by default, which is exactly why you get similar-but-not-identical answers each run.

The upshot: sameness is the exception, not the rule. If you actually need it, you have to design your prompt around it.

Have a go
Part 2 of 6

Three places non-determinism shows up

Today's question: What kinds of AI behaviour is non-determinism actually behind?
Three columns labelled text, image and random, each with example outputs.

You'll see this trick in more places than you might expect. Before you tap the cards below, have a guess: where in your everyday AI use might the same prompt be quietly producing different answers?

Tap each card to reveal.

1

Text generation

The obvious one. Ask for a story, essay, summary or explanation twice and you'll get two different pieces of prose. The gist usually matches, but the wording, ordering and choice of examples don't.

Tap to reveal
2

Image generation

Every image AI is non-deterministic by design. Same prompt, same settings, and you'll still get different pictures. That's why 'pick your favourite of these four' is the standard UI: it's cheaper to sample four times than to guarantee the perfect one.

Tap to reveal
3

'Random' choices

Ask the AI to pick a random number, choose a name or roll a virtual die. The choices ARE different each run, but they aren't evenly distributed. Some numbers (42, 7, 73) show up far more than they should. Not random, just non-deterministic.

Tap to reveal
Have a go

In all three, the same underlying mechanism is running: sample from a distribution, unfold from there. Understanding this changes what you can safely trust the AI for.

Part 3 of 6

When creativity helps, when it hurts

Today's question: When is non-determinism a feature, and when is it a bug?
A two-column decision framework with 'wants sameness' on one side and 'wants variety' on the other.

This is the question that actually matters in practice. Non-determinism isn't good or bad on its own; it's good for some tasks and bad for others, and the trick is knowing which one you're doing before you press return.

The rule of thumb: if the task has one correct answer, variability is a bug. If the task has many possible good answers, variability is a feature.

Ask the AI for maths, unit conversions, spelling, factual answers, code that has to compile, legal advice, medical dose calculations or exact quotations, and you want consistency. The same input should give you the same output every time, and if it doesn't then at least one of the two runs is wrong.

Ask the AI for a poem, a story opener, an essay plan, a revision analogy, a brainstorm, alternative ways to phrase a sentence or three ideas for a project, and variety is the whole reason you're using it. The point of asking is to get options you wouldn't have thought of on your own.

Have a go
Part 4 of 6

The reliable-answer trap

Today's question: Where does non-determinism cause the most real-world trouble?
A phone screen showing two different AI-generated answers to the same factual question.

The dangerous cases are when a task looks creative but actually needs a single correct answer. Or when someone runs a prompt once, trusts the output, and never realises that a second run would have said something meaningfully different.

One well-known example: in 2023, a New York lawyer submitted a legal brief drafted by ChatGPT that cited entirely fictional court cases the AI had invented (a mixture of non-determinism and hallucination, and a career-ending mistake). It happens quietly in much smaller ways all the time. A revision app might tell one pupil that Henry VIII had six wives and another that he had five, because the AI's borderline sampling landed on a different token. A medical chatbot might give slightly different dosage suggestions to different users for the same query. A shop's price-lookup bot might quote £39.99 on Tuesday and £42.50 on Wednesday.

The pattern to watch for: any time an AI's answer will be trusted as authoritative, or copied straight into a document, or used to make a real decision, sameness matters, and you cannot assume you'll get it.

Have a go
Part 5 of 6

Bad prompt, good prompt

Today's question: How do I write a prompt that gets me a more consistent answer?
Two prompt boxes side by side, one loose and open, one tight and specific.

You can't fully switch non-determinism off in a normal chatbot, because the temperature setting is baked in and you don't get to touch it. But you can push the AI hard towards consistency by writing prompts that leave it far less room to wander.

The trick is to pin down exactly what you want the answer to look like. Name the format. Name the length. Name the level. Name the content. Every constraint you add is one less place for the AI to roll different dice, and by the time you've named enough of them, the shape of the output stops varying even if the exact wording still drifts a little.

Have a go
Wandering prompt
Tell me about photosynthesis for my GCSE Biology revision.

Wide open. Format, length, level of detail and choice of examples are all unspecified. On every run, the AI will pick differently on all of those, so two revision cards from the same prompt will look nothing alike, and the pupil has no way of knowing which one is closest to what the exam actually wants.

Pinned-down prompt
Write a GCSE Biology revision card on photosynthesis. Exactly 4 bullet points, one short sentence each, covering: (1) the word equation, (2) where in the cell it happens, (3) two factors that limit the rate, (4) one common misconception. No extra commentary.

Every choice is pinned down: format, count, content, order and tone. Runs of this prompt will still vary a little at the wording level, but the shape and the covered content will match, which makes the card reliable enough to actually paste into a revision folder.

Part 6 of 6

So what would you do?

Today's question: The AI gave me two different answers to the same question. Now what?
A pupil at a desk with a laptop, revision notes and two contradictory AI responses.

Time to put everything together. You're a Y12 revising for an A-level Business exam. You ask ChatGPT to explain the difference between a cash flow forecast and a profit and loss statement. Two hours later, working through a past paper, you ask again. You get a slightly different definition. Neither one is obviously wrong, but they don't match: one uses the phrase 'over a period' for cash flow, the other uses it for P&L.

You've got mocks in three weeks. You need to decide which of the two is right, and you need a workflow that stops this happening again in the run-up to the exam.

Have a go
Non-Determinism
Time for the quiz

You're ready to earn your badge

You've worked through the whole course. Tap below to open the quiz — if you pass, you can print your own certificate right away.

Open the quiz ›

12 questions · about 12 minutes · no sign-in needed

1 / 1