Why the same prompt gives different answers
The short answer
The model does not choose a word — it produces a ranking of candidates, and something outside it draws one. In the recorded distribution below, two different continuations of the same sentence sit at 49.6% each, so which one you get is a coin flip. OpenAI states that its APIs are non-deterministic by default and that even a fixed seed does not guarantee identical output.
one prompt, two equally likely answers
recorded for gpt-4o-mini in OpenAI’s cookbook — the same distribution as the demo below
Two recorded distributions, each resampled at the temperature you choose. In the first, the top two continuations of the same prompt sit at 49.6% each at temperature 1 — a coin flip decides which one you see, and raising the temperature to 2 only lifts the third candidate from 0.8% to 6.0%. In the second, three words further into the same sentence, one continuation holds 97.1% and the same dial pulls it down to 80.9%.
What’s actually happening
At every position, the model produces a score for each possible next token. OpenAI describes what
those scores are: “A logprob is log(p), where p = probability of a token occurring at a specific
position based on the previous tokens in the context”, and higher values “suggest a higher
likelihood of the token in that context”.
Note what that is and is not. It is a ranking. It is not a decision. Something has to turn the ranking into one actual word, and that something draws at random — weighted by the scores, but at random.
The demo above uses a distribution OpenAI published in its own cookbook, so nothing here is simulated. Rescaled over its top three candidates at temperature 1, two of them sit at 49.6% each. Two different, perfectly sensible continuations of the same sentence, separated by nothing. Run that prompt twice and you get two answers, not because anything changed, but because a coin was flipped.
Then it compounds. Once a different word has been drawn, everything after it is conditioned on a different history — the third sentence of the second run is not a variation of the third sentence of the first, it is a continuation of a different text. Small forks near the start produce answers that read as entirely different approaches.
The temperature slider shows the other half. Temperature rescales the ranking before the draw: lower makes the leader dominate, higher flattens everything out. In the recorded distribution, the third candidate is a 0.8% outsider at temperature 1 and a 6.0% real possibility at temperature 2. The model did not change its mind. The dice did.
Vendors say this openly. OpenAI’s guide to the seed parameter opens with it:
The Chat Completions and Completions APIs are non-deterministic by default (which means model outputs may differ from request to request)
Even fixing the seed is a best effort, not a promise — the same page warns
that “Determinism is not guaranteed, and you should refer to the system_fingerprint response
parameter to monitor changes in the backend”, and that responses can still differ when everything
visible matches.
So the honest summary is that a prompt is not a function. Sending it twice is running an experiment twice, and experiments have spread.
What to do about it
Save the output, not the prompt. If a particular answer was good, keep the answer. Re-running the prompt that produced it is not a way of getting it back.
Ask for several versions in one go. “Give me three subject lines” makes the variability work for you and keeps them all in front of you at once, rather than discovering variant two after you have lost variant one.
Pin what must not vary. Specify the structure, the length, the field names, the order. What you constrain in the prompt stops being subject to the draw; what you leave open is redrawn every time.
Use disagreement as a signal. Ask the same factual question three times in fresh chats. Stable answers were well supported by the training data; answers that wobble were not. This is one of the cheapest checks available, and it costs nothing but a minute.
Do not read the variation as a change of mind. A second, contradictory answer is not the model correcting itself or being evasive. It is a second draw from a distribution that was never narrow.
Common questions
- 1 Is the variation a bug?
- No, it is the design. Drawing from a distribution is what produces fluent, varied language rather than the same stock sentence every time. The cost of that design is exactly the behaviour you noticed.
- 2 Can I turn it off?
- Not from a chat interface, and not completely anywhere. Lowering the temperature concentrates the distribution and makes repeats more likely. OpenAI still cautions that determinism is not guaranteed and that responses can differ even when the request parameters and the backend fingerprint match.
- 3 Which of the two answers is the right one?
- Usually neither is more correct than the other — they are two acceptable continuations that happened to be near-equally ranked. If the two differ on a fact rather than on wording, that is a signal the fact was not well supported in the first place.
Related
The idea behind it
Same cause, different symptom