Why temperature 0 still isn't deterministic, and how to fix it
- Source
- thinkingmachines.ai
- Publisher
- Thinking Machines
- Author
- Thinking Machines
- Date

Context
Setting to 0 tells a to always pick its single most likely next word, so the same prompt should give the same answer every time. In practice it often does not, whether through a hosted API or an open-source serving engine such as vLLM. The common explanation is that GPUs run calculations in parallel and finish them in an unpredictable order. The first post on Thinking Machines' Connectionism research blog, Defeating Nondeterminism in LLM Inference, argues that this explanation misses the real cause.
Computers store numbers with limited precision and round as they add, so adding the same numbers in a different order can give a slightly different total. The post shows that the calculations in a model's forward pass do not depend on which parallel thread finishes first: run the same calculation on the same inputs and you get the same bits back. What they do depend on is batch size, the number of user requests the server is processing together. Fast GPU code picks different ways of splitting up its additions for small and large batches, which changes the order and therefore the rounding. Batch size in turn depends on how busy the server is, which no single user controls. A tiny numerical difference can then tip the choice between two nearly equally likely words, and the answer drifts from there. The post adds that this is not specific to GPUs: servers on other hardware share the same source of variation.
The fix is to make each calculation that sums across many values (normalization, matrix multiplication and ) use the same order of additions whatever the batch size, at some cost in speed. In the post's test, a Qwen3 model answering "Tell me about Richard Feynman" 1,000 times at temperature 0 produced 80 different completions under the standard setup, all identical for the first 102 tokens before some said Feynman was born in "Queens, New York" and others "New York City." With the batch-invariant code, all 1,000 matched. A speed test serving 1,000 requests on one GPU took 26 seconds normally, 55 seconds with the unoptimized deterministic version and 42 seconds after improving the attention code. The kernels are published as a library with a vLLM example, though the post notes some of the attention changes were not yet in that release.
The lab also shows a training payoff. In reinforcement learning, a model's answers are generated by inference code and then scored by separate training code; if the two compute slightly different probabilities, training is quietly learning from a slightly different model than the one that produced the data. In the lab's experiment, a run without a correction for that mismatch saw its reward collapse, while a run where sampler and trainer produced bit-identical results trained smoothly with no divergence between them. Thinking Machines later pointed back to this post when explaining why exactly on-policy data matters in its on-policy distillation work.
- Sampling controls — Parameters that shape how deterministic or varied model generation becomes.
- Large language model — A model trained on large amounts of data to process and generate language.
- attention — The mechanism that lets a model weigh which earlier words matter for the word it's currently processing — the core operation of a transformer.
- distillation — Training a small, cheap model to imitate a big one's outputs, keeping much of the capability at a fraction of the cost.
- postInkling 2 Mini gets day-0 local inference across Mac and DGX Spark
articleInkling 2 Small is free on OpenCode: 1M context, agentic-coding tuned
articleTinker goes GA with Kimi K2 Thinking, vision input, OpenAI-compatible sampling
articleThinking Machines argues for staged access, using Inkling as the test case
articleDefeating Nondeterminism In Llm InferenceThinking Machines
videoStanford CS153 Frontier Systems | Teaching AI to Touch AtomsStanford Onlinearticle[AINews] Jev: a “System One Model” that only decides/classifies/routes/scores — >100x faster, >200x cheaper than small frontier LLMswww.latent.space