Every testing discipline you learned rests on a quiet assumption: the same input produces the same output. Write a test, see it pass, and you know the behavior is fixed: it will pass again tomorrow and on the build server. The whole practice of software assurance rests on that assumption, and AI systems violate it by design. Ask a model the same question twice and you may get two different answers. The variation comes from how these systems work and no patch removes it, and it quietly invalidates the way we decide whether something is safe to ship.
Why AI output is a distribution, not a value
A language model does not compute an answer; it samples one. At each step it produces a probability distribution over possible next tokens and draws from it. A temperature setting above zero deliberately introduces randomness for variety and quality. So a model's behavior on a given input is a distribution of possible outputs, and no single output describes it. Even with temperature pinned to zero, exact reproducibility is not guaranteed in practice: floating-point non-associativity on GPUs, changing batch sizes and mixture-of-experts routing can all nudge the result. Determinism is the exception.
What this does to a passing test
In deterministic software, a passing test works as a proof: for this input, the output is correct until the code changes. In an AI system, a passing test is a sample. You asked once and got a safe answer once. That says nothing certain about the next thousand runs, because you observed one draw from a distribution you never fully see. The unsafe output might have a probability of one in five hundred: rare enough to pass every manual check, common enough to surface daily at production scale.
The security implication is practical. An attacker needs the unsafe output to be reachable, and it does not have to be guaranteed. If a jailbreak works one time in fifty, they will retry, and automation makes fifty attempts trivial. Your defensive test, run three times and passing, saw only the common case. Non-determinism is asymmetric: it works against the defender, who needs the bad output to be absent, and for the attacker, who needs it only to be possible.
Testing a distribution instead of a value
The adaptation is to stop asking yes/no questions and start measuring rates. Run each safety-critical case many times and treat the result as a statistic: how often does the guardrail hold, how often does the agent refuse the planted instruction, and what are the failure rate and its confidence interval? Where you can, pin the settings you control (fix the seed, set temperature to zero, freeze the model version) to shrink variance, and accept that pinning inputs cannot make an adversarial setting deterministic. Weight your effort by consequence: a wrong word is noise, a wrong wire transfer is not.
Designing for a probabilistic world
- Measure rates, not verdicts. Replace pass/fail with a failure rate and a confidence interval; a control you cannot quantify is one you cannot trust.
- Reduce controllable variance. Pin seeds, temperature and model versions in test so you measure the system and not the noise, and remember production may differ.
- Put hard limits outside the model. If a rare bad output is unacceptable, enforce the boundary in code the model cannot sample its way past.
- Re-test on every change. A new model version reshapes the distribution; yesterday's measured failure rate does not carry over, so the numbers have to be re-earned.
Non-determinism is intrinsic and often desirable, so it cannot be engineered away. It rewrites the meaning of every test you run, turning proofs into samples and passing runs into anecdotes. Teams that carry deterministic testing habits into AI ship systems they believe are verified and have only spot-checked. The replacement discipline is statistical: measure the failure rate, decide what you can tolerate, and put the intolerable outcomes behind limits the model cannot cross. You cannot measure a failure rate for a system you do not know you are running.