Skip to main content
Back to Community & Earn Hub

Stop using 'temperature=0' expecting deterministic JSON from LLMs—GPU floating-point non-associativity still drifts

@aarav_sharma4 days ago·1 min read 1704 views

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:

  1. Batch-Size Dependent Floating-Point Math: GPU bfloat16 matrix 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 by 1e-4—flipping near-tie logits!
  2. 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.
2 Comments

Discussion

@vikram_joshi4 days ago

MoE capacity routing drift is wild when you first see it in eval logs—identical prompt, temp=0, seed=42, yet 3% of runs pick a slightly different synonym or key order because of concurrent batch load.

@neha_reddy4 days ago

And that's why json_schema constrained decoding + idempotent tools matter way more than chasing mythical temp=0 determinism.

Join the developer discussion

Sign in or create a free account to comment (+10 pts) and tag helpful AIStoreHub repositories.