Temperature 0 Is Not Deterministic, and Your Unit Tests Are Lying
You set temperature=0. You set seed=42. You lit a candle. And the model still gave you a different answer on retry, and now your CI is red and your faith is gone.
Bad news: nothing is broken. Temperature 0 was never a determinism guarantee. It's a sampling setting. It says "pick the highest-probability token at each step." It says nothing about whether the probability distribution itself is stable. And the distribution is not stable. Here's the hit list.
1. Floating point doesn't associate
(a + b) + c ≠ a + (b + c) in float32, ever, and the GPU decides the order those adds happen based on kernel implementation, tile sizes, and how the reduction is split across threads. Change the batch shape and you change the reduction order. Change the reduction order and your logits drift in the seventh decimal place. Invisible to you. Career-defining for a token sitting at 0.4999 vs 0.5001.
2. Your request has roommates
Continuous batching means your prompt shares a forward pass with whoever else hit the API that millisecond. Batch composition changes padding, changes kernel launch shapes, changes which fused kernel gets picked. The model isn't answering your question in isolation; it's answering it as a guest at someone else's dinner party, and the seating chart reshuffles every request.
3. MoE routing is batch-dependent
On a mixture-of-experts model, the router makes top-k decisions that can land on ties, and expert capacity limits mean one token's routing shifts based on the other tokens in the batch. Your token took the left expert last time and the right expert this time, and the two experts disagree by exactly one token somewhere in paragraph three.
4. The seed doesn't do what you think
The seed controls the sampler. At temperature 0 you're not sampling — you're taking an argmax. The variance you're seeing lives upstream, in the logits, produced by hardware math you don't control. Sending seed=42 to an inference API is like mailing a die a polite note asking it to please land on six.
5. Everything else, too
Speculative decoding, tensor parallelism across ranks, A100-vs-H100 kernels, driver updates, and the provider silently swapping you to a more-quantized variant at 3 a.m. Every layer between your prompt and the silicon is free to reassociate your math.
"So how do I get reproducibility?"
Strictly: same hardware, same library versions, same batch size, same batch position, same everything. This is achievable in a lab, and in nothing that has an uptime SLA in its marketing deck.
Practically: stop writing tests that assert exact string equality on model output. You're not testing the model, you're testing the batch scheduler's mood. Assert on the things you actually care about — valid JSON, schema conformance, semantic similarity to a reference, eval scores above a threshold. Pin the model version. Pin nothing else, because you can't.
Determinism is a property of your entire stack, not a parameter you pass. Temperature 0 doesn't remove randomness from the world. It just makes you confidently wrong about why the answer changed.