Stop using 'temperature=0' expecting deterministic JSON from LLMs—GPU floating-point non-associativity still drifts
One of the most persistent myths in AI engineering is: "Just set temperature=0 and seed=42, and the model will be 100% deterministic."
In production, it won't.
Even at temperature=0 (greedy argmax sampling), two identical API requests to the same frontier model can return different tokens because:
- Batch-Size Dependent Floating-Point Math: GPU
bfloat16matrix multiplications are not associative ((a + b) + c != a + (b + c)). Depending on whether 3 or 29 other users share your continuous batch at that millisecond, rounding differs by1e-4—flipping near-tie logits! - Sparse MoE Capacity Routing: In Mixture-of-Experts models, if a batch hits an expert's token capacity cap, overflow tokens route to a secondary expert, subtly altering hidden states.
What This Means for Agents
Never rely on temperature=0 for safety or replayability:
- Use Structured Outputs (
json_schema) for syntax guarantees. - Use idempotency keys on mutating tools.
- Use recorded cassettes (not live LLM calls) for deterministic CI tests.