Why Temperature 0 Isn't Deterministic
A one-line formula for how often an LLM's top token flips, and why identical completions fall apart after about a hundred tokens The post Why Temperature 0 Isn't Deterministic appeared first on Towards Data Science.

This article investigates why large language models (LLMs) produce non-deterministic outputs even at temperature 0, where the model should select the most probable token. It explores numerical precision issues, batch size effects, and derives a formula to predict token flip probabilities.
What happened
Researchers observed non-deterministic outputs from LLMs at temperature 0, leading to an investigation of numerical precision issues in floating-point arithmetic. They derived a formula to calculate token flip probabilities and validated it through simulations and real model experiments.
Why it matters
Understanding non-determinism in LLMs is critical for applications requiring consistent outputs, such as automated testing, legal documentation, or safety-critical systems. It highlights the importance of considering hardware and precision effects in model deployment.
- Temperature 0 outputs are not truly deterministic due to numerical precision limitations
- Token flips primarily occur at 'near-tie' logit gaps where small numerical errors matter
- Hardware and batch size variations significantly impact inference determinism
- A mathematical framework exists to predict and quantify output variability
- Deterministic inference requires specialized batch-invariant kernels with performance trade-offs
The bigger picture
Developers must account for hardware-induced variability in LLM outputs. The research informs trade-offs between determinism and performance, influencing model deployment strategies and evaluation metrics.
While temperature 0 theoretically guarantees deterministic outputs, practical implementation challenges like numerical precision and hardware variability create unexpected non-determinism. This research provides both theoretical insights and practical solutions for managing LLM output consistency.
Technical details
- Floating-point arithmetic non-associativity causing numerical errors in large-scale computations
- Batch-invariant kernels as a solution to deterministic inference
- Logit gap analysis (M = z₁ - z₂) and its relationship to token flip probability
- Formula: p ≈ f(0) · E|Δ| / 2 for flip probability per token
- bf16 vs. fp32 precision comparisons in model inference
FAQ
Why do LLMs produce different outputs at temperature 0?
Numerical precision errors in floating-point arithmetic and hardware variability (like batch size changes) introduce non-determinism despite the theoretical guarantee of temperature 0.
What causes token flips in deterministic settings?
Small numerical errors in logit calculations can flip the argmax when tokens have near-equal probabilities (small logit gaps), leading to different outputs.
How can developers mitigate this non-determinism?
Using batch-invariant kernels or accepting trade-offs in inference speed can achieve deterministic outputs, though this may reduce throughput.
What's the significance of the derived flip probability formula?
The formula quantifies how hardware precision and model-specific logit distributions affect output variability, enabling better prediction and management of LLM behavior.
Does this issue affect all LLMs equally?
The impact depends on the model's logit distribution patterns and the hardware's numerical precision, with some models more susceptible to variability than others.
This summary and analysis were generated with AI from the original article and may contain errors. Read the original for the full story.
Read the full story
Originally published by Towards Data Science on Oct 10, 2026.
Comments
Sign in to join the discussion.