The AI Reader.
The Mechanics

Whoever else is in the batch settles a near-tied logit

At temperature zero the sampler is off, and a GPU still sums the model's math in an order that depends on which other requests share the batch.

Why this matters

Every serious use of a language model outside a chat window depends on sending the same request twice and trusting the answer. A test suite checks that a prompt still behaves the same way after a code change. A support team reproduces what a model told a customer. A reinforcement-learning pipeline needs its own rollouts to match its own logged probabilities. All of them reach for the same two settings, a temperature of zero and a fixed seed, and all of them can be surprised when the output still drifts. This lesson finds where that drift actually comes from: a choice a GPU kernel makes about which order to add numbers in, a choice that depends on whoever else's traffic is running through the same chip at that moment. By the end you can name the exact step where two identical requests come apart. You can tell a complete answer to "is temperature zero deterministic?" from one that stops a layer too early, and see why closing the gap for good is a cost a provider chooses to pay, not a bug someone forgot to fix.

Background optional reading
01
Two answers to one prompt diverge at a single draw: how a sampler draws one token from the distribution the model computed, and what temperature does to that draw before it reaches zero.
02
How a model generates one token at a time: why each token becomes part of the prompt for the next one, so an early divergence carries forward.

Turning off the sampler leaves the tokens moving

Two answers to one prompt diverge at a single draw: a sampler picks one token from the probability distribution the model computed, and a different draw picks a different token. Temperature set to zero is supposed to remove the draw entirely. The softmax collapses onto its single largest logit, that token gets a probability of 1, and the sampler has nothing left to choose between. The rule that is left, take whichever token holds the highest score, is called argmax, and it has no dice in it at all.

Send the identical prompt to a hosted model a thousand times at temperature zero, and the identical-argmax rule says the identical completion should come back a thousand times. Thinking Machines Lab ran exactly that experiment in 2025 and got 80 different completions, not one.1 Argmax did not misbehave. It is a pure function: the same list of numbers in produces the same top entry out, every time. If the winning token changed between runs, the list of numbers changed. Something between the model's fixed weights and the number it hands the sampler is not fixed at all.

Follow that back one step. A token's logit is the last number in a chain of matrix multiplications and normalizations run on the weights and the prompt. Underneath, every one of those operations is a sum: thousands of numbers added together to produce one. If that sum comes out slightly different, the logit comes out slightly different. If two tokens were already close, whichever one now holds the marginally larger number wins the argmax instead of the other. The place to look is not the model. It is the arithmetic.

The order of a sum changes its answer

Ordinary addition does not care what order it happens in: 1 plus 2 plus 3 is 6 whichever pair goes first. The format every number in a neural network is stored in, floating point, does care. Add 0.1, 0.2, and 0.7 as (0.1 + 0.2) + 0.7 on a computer, and it returns exactly 1.0. Add the same three numbers as 0.1 + (0.2 + 0.7), and it returns 0.9999999999999999, one step short of 1.0. Same three numbers, same final operation. Only the order of summation changed, and the two answers land as two different bit patterns in memory: one ending in all zeros, the other ending in all ones.

This is what non-associative means: (a + b) + c does not always equal a + (b + c) once every intermediate result has to be rounded to fit a fixed number of bits. A floating-point number is exactly that, a fixed number of bits.2 A study measuring how far this error travels through a deep network found the sensitivity extreme, since the small differences compound across the millions of additions inside every layer.3 One reordered sum, buried inside a single matrix multiplication, is a lever on the final logit.

The kernel's reduction order is not fixed

A single entry in a neural network's output is the sum of thousands of products, one row of weights times one column of input, added together. A GPU does that sum, called a reduction, in parallel: it splits the thousands of terms across many threads and combines their partial sums back into one number. Which partial sums sit next to each other, and in what order they get combined, is a choice made by the kernel, the compiled routine doing the multiplication. That choice depends on the work there is to split. Thinking Machines Lab documents the same normalization kernel switching strategy as batch size moves. At a large batch, "increasing our batch size doesn't affect our reduction strategy; if a batch size of 200 provides sufficient parallelism to our kernel then a batch size of 2000 will definitely provide sufficient parallelism."1 Shrink the batch and the same kernel switches strategy, because "if we have a small batch size, our data-parallel strategy may no longer have sufficient parallelism to saturate our cores."1 A kernel tuned to run one request alone splits the work one way. The same kernel handling that request alongside thirty-nine others splits it another way, because the fast tiling for a large batch is not the fast tiling for a small one.

Researchers compared a matrix multiplication run by itself against the identical multiplication run inside a batch. The two invoked different kernels outright, and the resulting error was correlated and directional rather than scattered evenly: for one common number format, close to half the variance in the discrepancy lined up in a structured pattern.4 The batch changed which exact computation ran. Floating-point non-associativity and batch-dependent kernel behavior are not in dispute. Both are documented by the frameworks themselves and reproduced independently: this part of the chain is settled engineering.

Who shares your batch decides the order

A production server does not run one request at a time. To keep an expensive GPU busy, it gathers whatever requests arrived in the last few milliseconds into a batch and runs them through the model together. How many other requests land in your batch is a property of the moment your prompt arrived, not of the prompt itself. Thinking Machines Lab states the consequence directly: "the primary reason nearly all LLM inference endpoints are nondeterministic is that the load, and thus batch-size, nondeterministically varies."1 An independent account of the same effect describes a single prompt landing in a batch by itself at some moments, and sharing a batch with dozens of others at other moments. No pattern was visible from outside the server.5 Send the identical prompt twice, and each copy can hit a different batch size, triggering a different reduction schedule on the same sum.

Some models route each token to one of several specialist sub-networks, called experts, and batch composition opens a second channel here. Each expert accepts only a limited number of tokens per batch, so which expert a token reaches depends on who else is competing for the same slots. The routing is deterministic at the batch level, one analysis notes. But the token you sent can land on a different expert depending on who else showed up with it, changing the outcome from where the caller sits.6

Every step, the arithmetic, the kernel, the routing, is a deterministic function of its inputs. What is not fixed is one of those inputs: which other requests are in the batch with you. Trace the effect down to where it actually lands. Two tokens with logits close enough that the reordering's own numerical noise, a few bits in the last decimal place, is larger than the gap between them: that near-tie is where the chain ends. A different reduction order nudges the trailing token's score just above the leading one, and argmax returns the new winner instead of the old one. Because each new token becomes part of the prompt for the next, one flipped tie at the first position can leave the rest of the answer with nothing in common with the run before it.

Fixing the order costs throughput

Thinking Machines Lab's fix follows directly from the diagnosis: write kernels whose reduction order does not depend on batch composition. Their batch-invariant versions of the three key operations, normalization, matrix multiplication, and attention, use a fixed tiling and a consistent reduction strategy no matter how many requests share the batch.1 Rerun the earlier experiment, a thousand identical requests at temperature zero, with the batch-invariant kernels switched on, and the completions come back bit for bit identical.1 The fix removes the variable that was causing the symptom.

That fix has a price. Forcing a fixed tiling regardless of batch size gives up the freedom to pick the fastest tiling for each batch size. Thinking Machines Lab measured its first batch-invariant kernels running with roughly 61.5 percent more overhead than the ordinary kernels they replaced.1 Later engineering, folding batch-invariant kernels into the inference engine SGLang, brought that down. The SGLang team's own benchmarks report an average slowdown of 34.35 percent, ranging from 25 to 45 percent across workloads, still a real tax on every request the server handles.7 Whether a hosted provider pays that tax by default is not settled engineering. It is a live, practical decision, and different systems are answering it differently right now.

This is why a seed parameter on a hosted API is not the guarantee it sounds like. OpenAI's own documentation says that even when the seed and the reported system configuration match between two calls, "there is a small chance that responses differ," because the seed fixes the sampler, not the kernels computing the numbers the sampler reads.8 vLLM ships batch-invariant kernels as an option an operator has to turn on, not the default the engine starts with. Even then it guarantees reproducibility only on the same hardware and the same version of the software.9 A request at temperature zero removes exactly one source of variation: the draw. The batch a stranger's traffic put you in that millisecond is a second source, and the temperature parameter was never built to reach it.

The takeaway

Two identical requests can produce two different completions at temperature zero because argmax is deterministic only given identical logits, and the logits are not guaranteed to be identical. They are the output of sums a GPU carries out in an order chosen by the kernel handling that batch, and floating-point addition returns a different bit pattern depending on order. Which kernel runs depends on how many other requests share the batch with yours at that millisecond, a fact set by server load, invisible from where the request was sent. Trace it all the way down and it lands on a near-tie: two tokens whose logits differ by less than the reordering's own numerical noise, decided one way this run and the other way the next. That is the layer most explanations never reach, the one past "it's the sampling" and past "temperature zero fixes it." Floating-point non-associativity and batch-dependent kernels are settled, demonstrated facts. Whether a provider builds kernels with a fixed reduction order and eats the throughput cost of running them is not settled. It is a decision, made differently by different systems, and it is the actual reason a seed and a temperature of zero are a best effort rather than a promise.

Go deeper optional reading
01
Thinking Machines Lab, Defeating Nondeterminism in LLM Inference: the full experiment and the batch-invariant kernel library it introduced.
02
PyTorch, Reproducibility: the framework's own list of nondeterminism sources and the settings that force deterministic algorithms, at a real speed cost.

Sources

  1. Thinking Machines Lab · Defeating Nondeterminism in LLM Inference (2025)
  2. PyTorch · Reproducibility
  3. Shanmugavelu, Taillefumier, et al. · Impacts of floating-point non-associativity on reproducibility for HPC and deep learning applications (2024)
  4. He, et al. · On the Structure of Floating-Point Noise in Batch-Invariant GPU Matrix Multiplication (2025)
  5. Walekar · Why LLMs Give Different Answers Even With Temperature = 0 (And How to Fix It)
  6. Schmalbach · Does Temperature 0 Guarantee Deterministic LLM Outputs?
  7. The SGLang Team · Towards Deterministic Inference in SGLang and Reproducible RL Training (2025)
  8. OpenAI · Reproducible Outputs with the Seed Parameter
  9. vLLM · Reproducibility