Temperature=0 Isn't Deterministic in LLM Outputs
A regression test revealed that temperature=0 in LLMs is not deterministic, leading to divergent outputs even with the same prompt and model. This is due to floating-point arithmetic and GPU kernel behavior.

A regression test found that sending the same prompt to an LLM endpoint with temperature=0 resulted in different outputs on different days, despite the same model and parameters. The outputs were identical for about 140 tokens before diverging significantly. The reason for this divergence was not a model swap, but rather the non-deterministic nature of temperature=0 due to floating-point arithmetic and GPU kernel behavior (Dev.to, 2025). [1]
Temperature=0 is supposed to be deterministic as it uses greedy decoding, which picks the argmax token at each step. However, computing the logits involves floating-point arithmetic, which is not associative. This means that different orders of summation can produce slightly different logit values, potentially flipping the top token (Dev.to, 2025). [1]
The summation order in GPU kernels depends on the batch size and the shape of the work, which can vary based on the number of concurrent requests. This variability leads to different logits being computed even for the same input, causing the greedy decoding to select different tokens (Dev.to, 2025). [1]
To achieve deterministic outputs in production, inference servers need to use batch-invariant kernels. If using a hosted API, it is recommended to assume low variance rather than zero variance for temperature=0 and cache responses for replayability (Dev.to, 2025). [1]
Advertisement
A regression test found that sending the same prompt to an LLM endpoint with temperature=0 resulted in different outputs on different days, despite the same model and parameters (Dev.to, 2025). Temperature=0 is supposed to be deterministic as it uses greedy decoding, which picks the argmax token at each step. However, the summation order in GPU kernels depends on the batch size and the shape of the work, which can vary based on the number of concurrent requests (Dev.to, 2025). [1]
Floating-point arithmetic is not associative, and the order in which sums are computed can lead to slightly different logits. When the top two tokens are close in probability, these slight differences can be enough to change the winning token (Dev.to, 2025). This is demonstrated by a simple numpy example where the order of addition changes the result due to the limited precision of float16 (Dev.to, 2025). [1]
The summation order on a GPU is influenced by the kernel's tiling strategy, which depends on the shape of the work, such as batch size, sequence length, and attention kernel choices (Dev.to, 2025). This variability in the kernel strategy means that the same request can be processed with different summation orders depending on the traffic at the time of inference (Dev.to, 2025). [1]
A toy simulation showed that changing the chunk size used in the summation process can lead to a significant number of logit changes, with 17 of 5,000 vectors showing a flipped top token (Dev.to, 2025). This variability can compound over the course of a generation, leading to a high probability of divergence in the output (Dev.to, 2025). [1]
Advertisement
A regression test found that sending the same prompt to an LLM endpoint with temperature=0 resulted in different outputs on different days, despite the same model and parameters (Dev.to, 2025). The test showed that the outputs matched word for word for about 140 tokens, then one said "however" where the other said "but", and from there they were two different essays. The provider had not swapped the model, but the actual reason was that temperature=0 is not deterministic. Floating-point arithmetic is not associative, and the order in which sums are computed can lead to slightly different logits. The summation order on a GPU is influenced by the kernel's tiling strategy, which depends on the shape of the work, such as batch size, sequence length, and attention kernel choices (Dev.to, 2025). [1]
In a toy simulation, changing the chunk size used in the summation process led to a significant number of logit changes. The simulation showed that 67% of logits changed when the chunk size was altered, and 17 of 5,000 vectors had their top token flipped (Dev.to, 2025). This variability is due to the fact that the logits are computed using floating-point arithmetic, and the order in which the sums are computed can impact the result. When the top two candidates are close, even a slight difference in logits can change the outcome. This is particularly problematic for temperature=0, where greedy decoding is used, as the logits are the only input to the decision-making process (Dev.to, 2025). [1]
The summation order on a GPU is influenced by the kernel's tiling strategy, which depends on the shape of the work, such as batch size, sequence length, and attention kernel choices (Dev.to, 2025). Libraries like cuBLAS pick different tile sizes and "split-K" strategies depending on matrix dimensions, because the fastest kernel for a batch of 1 isn't the fastest for a batch of 64. This means that the summation order for a request depends on the batch size, which is influenced by the number of concurrent requests. Inference servers with continuous batching (vLLM, TGI, SGLang, and similar APIs) pack whatever requests arrive together into one forward pass, and the batch size is a function of other people's traffic. This variability in batch size can lead to different summation orders and, consequently, different logit values (Dev.to, 2025). [1]
Sources
Prepared with AI assistance from the cited sources.
The Cali Reporter newsletter
The stories worth your time.
California, the country, and what comes next. Join our free newsletter for reporting that keeps you informed.
More in Technology
- Modern Web Guidance 1.0 and Browser Compatibility
Modern Web Guidance 1.0, announced by Chrome for Developers on November 10, introduces browser compatibility data to assist coding agents in building web features. The initiative emphasizes the importance of fallback…
- Apache mod_http2 Vulnerability Detection with Nmap
A new Nmap scripting module has been developed to detect the Apache mod_http2 vulnerability (CVE-2026-119618), addressing the challenges of identifying affected systems accurately.
- Securing Remote Vendor Access in Industrial Networks
Best practices for managing remote vendor access in operational technology (OT) networks emphasize controlled access points, multifactor authentication, and time-bound sessions to reduce cybersecurity risks.
