{"slug": "why-is-llm-output-different-at-temperature-0-and-can-you-stop-it", "title": "Why Is LLM Output Different at Temperature 0, and Can You Stop It?", "summary": "Thinking Machines Lab found that Qwen3-235B-A22B-Instruct-2507 produced 80 different completions across 1,000 runs at temperature 0 with 1,000 tokens per answer, with the most common answer appearing only 78 times, because GPU routines add floating-point numbers in a different order when batch size changes. OpenAI labels its Chat Completions seed parameter as beta and does not guarantee determinism, Google says Gemini 3.6 Flash and newer models ignore temperature, and Anthropic says zero never guaranteed identical outputs on earlier Claude models, while vLLM and SGLang offer deterministic modes for self-hosted models. In Thinking Machines' benchmark, deterministic vLLM took 42 seconds for a job the default setup finished in 26, so the lab advises using temperature zero to cut randomness but never selling it as a guarantee.", "body_md": "*Your test passed this morning and failed after lunch on an identical prompt, with temperature pinned to zero. Before you blame your code, or promise a customer the same answer twice, you need to know which parts you control and which the server decides for you.*\n\n- Thinking Machines Lab traced the main cause to common GPU routines that add numbers in a different order when the batch size changes.\n- OpenAI labels its Chat Completions seed parameter as beta and says determinism isn't guaranteed.\n- Google says Gemini 3.6 Flash and newer models ignore temperature, so setting it to zero in your code does nothing there.\n- Recent Claude Opus models reject a custom temperature, and Anthropic says zero never guaranteed identical outputs on earlier ones.\n- vLLM and SGLang both offer deterministic modes you can switch on when you host the model yourself.\n- In Thinking Machines' benchmark, deterministic vLLM needed 42 seconds for a job the default setup finished in 26.\n\nAsk an AI model to tell you about Richard Feynman, then ask it 999 more times without changing a character. Thinking Machines Lab ran that test on Qwen3-235B-A22B-Instruct-2507, with temperature at 0 and 1,000 tokens per answer, and got 80 different completions. The most common one showed up only 78 times. So why is LLM output different at temperature 0, the setting that's supposed to take the dice away?\n\nYour request usually shares a GPU with other people's requests, and the size of that group changes the arithmetic. Temperature controls how the model picks from its scores. It has no say over how those scores get calculated. Use zero to cut randomness, and never sell it as a guarantee.\n\nA language model writes one token at a time, a token being a word or a piece of one. At each step it gives a score to every token it knows. Above zero, it draws from those scores by weighted chance, so the runner-up sometimes wins. At zero it takes the top score every time, which engineers call greedy decoding. Identical scores going in will always produce the same token coming out.\n\nThe trouble sits one step earlier. GPUs hold those scores as floating point numbers, which keep a limited number of digits and round off the rest. That makes the order of addition matter. In Python, `(0.1 + 1e20) - 1e20` returns 0.0, while `0.1 + (1e20 - 1e20)` returns 0.1, because the small number gets swallowed when it meets the huge one first.\n\n[How to handle LLM API rate limits in production before retries burn your quota](https://startupfortune.com/how-to-handle-llm-api-rate-limits-in-production-before-retries-burn-your-quota/)\n\nA 400,000 tokens-per-minute cap, minus 20% held back as headroom, leaves 320,000 to plan against. Splitting that into lanes puts 96,000 on user-facing calls, and a background step costing 18,000 tokens supports only about twelve steps a minute. - [how to handle LLM API rate limits](https://startupfortune.com/how-to-handle-llm-api-rate-limits-in-production-before-retries-burn-your-quota/) - [prevent retries from burning API quota](https://startupfortune.com/how-to-handle-llm-api-rate-limits-in-production-before-retries-burn-your-quota/)\n\nInside a model the gaps are far smaller than that. They count only when two tokens are nearly tied, and then they pick the winner. In the Feynman run, every answer matched for the first 102 tokens. All of them wrote \"Feynman was born on May 11, 1918, in\" and then split: 992 continued with \"Queens, New York\" and 8 with \"New York City\". Either is a fair way to finish the sentence. From that token on, each branch was predicting from a different history, so later differences piled up.\n\n## Batch size nondeterminism in LLM inference, in plain English\n\nThe popular explanation blames concurrency. A GPU runs thousands of threads at once, they finish in unpredictable order, and so the sums come out differently. Horace He, who wrote the September 2025 Thinking Machines post with colleagues, put that to the test. Repeating one multiplication of two 2,048 by 2,048 matrices a thousand times gave bit-for-bit identical results.\n\nThe post also points out that a typical forward pass, the calculation that produces each token, usually doesn't contain a single atomic add, the sort of operation where finishing order really does change a result.\n\nBatching is where LLM nondeterminism at temperature 0 mostly comes from. Inference servers group incoming requests and process them together because that's much cheaper per request. Your group might be you alone at 3am, or you and dozens of strangers at midday. The kernels, which are the low-level routines doing the math, choose different ways to split the work depending on the size of what they're handed. A different split means a different order of addition. The property you'd want is called batch invariance, meaning your result stays the same however many neighbours you have.\n\nThinking Machines shows it breaking in PyTorch. Multiply a single row by a matrix with `torch.mm` on a GPU, then multiply a batch of 2,048 rows by the same matrix and pull out the first one. The input and the matrix haven't changed, yet the two results don't match.\n\nThe post names three kinds of kernel behind this in model serving. Matrix multiplication switches strategy as shapes and load change. RMSNorm, a rescaling step repeated throughout the network, can reduce its numbers differently when the batch is small. Attention, the part that looks back over your context, can handle cached text separately from new tokens, or divide the work by a count that depends on how many requests are in flight.\n\nThe authors put it bluntly: \"the primary reason nearly all LLM inference endpoints are nondeterministic is that the load (and thus batch-size) nondeterministically varies!\" Hand the server the same batch in the same arrangement and the math repeats. You don't get to choose the batch, though, or even see it. Other customers' traffic is a hidden input to your request, so a prompt can look rock steady while you test it late at night and start drifting once the service gets busy.\n\n[Set Your LLM Fallback Model Routing Strategy Before the Outage, Not During It](https://startupfortune.com/set-your-llm-fallback-model-routing-strategy-before-the-outage-not-during-it/)\n\nLLM fallback model routing strategy comes down to four numbers: trigger thresholds, parity pass marks, a spend cap at 2x your hourly baseline, and a monthly drill. Here's the rule, including which errors should never trigger failover. - [how to test LLM fallback model routing](https://startupfortune.com/set-your-llm-fallback-model-routing-strategy-before-the-outage-not-during-it/) - [LLM fallback strategy for production outages](https://startupfortune.com/set-your-llm-fallback-model-routing-strategy-before-the-outage-not-during-it/)\n\n## Does setting a seed make LLM output reproducible?\n\nNot by itself. A seed fixes the random number generator used for sampling. At temperature 0 there's no random draw left to fix, and the seed never touches the order in which a kernel adds numbers. Above zero it can hand you the same dice rolls, but they land on scores that may still move with the batch.\n\nvLLM, one of the most widely used open source inference servers, makes the point nicely. Its V1 engine already sets the seed to 0 by default. The project's documentation still says it \"does not guarantee the reproducibility of the results by default, for the sake of performance.\"\n\n## What hosted APIs let you control\n\nLess than you might expect, and some of the newest models give you fewer dials than older ones did.\n\nOpenAI's Chat Completions API still accepts `seed`. The official Python library marks it as a beta feature, says determinism isn't guaranteed and tells you to watch `system_fingerprint`, a value in the response that identifies the backend setup serving your model. An archived OpenAI cookbook recipe said that when the seed, request settings and fingerprint all match, outputs \"will mostly be identical\". Take \"mostly\" literally. The same library's request definition for the newer Responses API has no seed field at all. Temperature may be missing too: Microsoft's Azure documentation lists it among the settings that its reasoning models, with GPT-6 Astra named as an exception, don't support. Check your exact model before you assume the control exists.\n\nAnthropic says it plainly in its glossary: \"Even with temperature set to 0, the results will not be fully deterministic, and identical inputs might produce different outputs across API calls.\" Its recent models go further. From Claude Opus 4.7 onward, a non-default `temperature`, `top_p` or `top_k` on Opus returns a 400 error, and the migration guides for Opus 5.5 and Haiku 5.5 tell you to leave all three out and steer the model through your prompt. The Opus guide adds that temperature 0 \"never guaranteed identical outputs on prior models.\" If your code still sends zero out of habit, fix it before you upgrade.\n\nGoogle can catch you more quietly. For Gemini 3.6 Flash and newer, its documentation says those three settings are deprecated and ignored, with future model generations due to return an error. For now your config file can say temperature 0, the request can succeed and the setting does nothing. Google's suggested route to steadier answers is a system instruction with explicit rules. Its Vertex AI documentation describes `seed` as a best effort and states that \"Deterministic output isn't guaranteed.\"\n\nFrankly, don't promise word-for-word repeatability on top of any of these. If a user has to see the same answer twice, save the first one and serve it again. Key that cache on the model ID, full prompt, retrieved documents and every parameter, so any change produces a fresh answer.\n\n## How to make LLM output deterministic on your own GPUs\n\nHosting the model yourself puts the kernels within reach. In vLLM, the documentation gives one route for online serving, which is batch invariance. You switch it on with an environment variable, for example `VLLM_BATCH_INVARIANT=1 vllm serve meta-llama/Llama-3.1-8B-Instruct`. Offline jobs have a second option, `VLLM_ENABLE_V1_MULTIPROCESSING=0`, which makes scheduling deterministic. That helps you rerun an identical job, but it doesn't cut the link between one request and the others batched beside it.\n\nRead the small print before you rely on it. As of November 2026, vLLM still calls batch invariance beta. It lists NVIDIA GPUs with compute capability 8.0 or higher, AMD Instinct cards and Intel XPUs using the Triton attention backend. Validated models include Llama 3.1 and 3.2, several Qwen3 versions, DeepSeek-V3 and R1, and both gpt-oss sizes. Tensor parallelism, which spreads one model across several GPUs, has gaps for some tensor sizes. Reproducibility also holds only on the same hardware and the same vLLM version, so every upgrade gives you a new baseline.\n\nSGLang uses a launch flag, `--enable-deterministic-inference`, with the FlashInfer, FlashAttention 3 or Triton attention backends. It sets the sampling seed to 42 unless you pass your own `sampling_seed` inside a request's `sampling_params`. This covers temperatures above zero as well: LMSYS, the group behind a September 2025 write-up of the feature, said the same input and seed always yield the same sample. In its 50-trial tests, deterministic mode produced one unique output while normal mode produced as many as 18. Support has changed since that post, so check the current docs for your model and run the bundled `sglang.test.test_deterministic` check, which should report a single unique sample.\n\nYou'll pay for it in speed. Thinking Machines timed 1,000 short generations from Qwen3-8B on one GPU: default vLLM took 26 seconds, its first deterministic version took 55, and a better attention kernel brought that down to 42. LMSYS reported an average slowdown of 34.35% for SGLang with FlashInfer and FlashAttention 3. Both figures date from 2025, so benchmark your own traffic. You might run deterministic mode for evaluations and audits and leave it off for live chat, as long as you remember that the two setups can then give different answers.\n\nTeams doing reinforcement learning have an extra reason to care. When the server generating samples and the code training on them compute slightly different numbers, Thinking Machines argues, on-policy training quietly turns into off-policy training. With the two made bitwise identical, the measured gap between them stayed flat at zero.\n\n## Test the behaviour and log every run\n\nStop asserting exact strings against a live hosted model. Check the things you'd defend to a customer: the JSON matches your schema, the refund amount equals the figure in the order record, the cited document was really among those retrieved. Run each case several times and set a pass rate, because a single green run can be luck. Where your build pipeline has to repeat exactly, record real responses once and replay them with a tool such as VCR.py. Those tests then judge your code, while a separate scheduled job keeps an eye on the model.\n\nFor debugging, store the full request, the exact model ID, each parameter, the fingerprint if there is one and the raw response. You may never be able to generate the bad answer again, so that record is your evidence. Before you credit a prompt change with a fix, run the old prompt 20 times and see how much it varies on its own. A new version that lands inside the same spread hasn't proved anything yet.\n\nDeterministic mode has limits of its own. It repeats the output for an identical input, including a wrong output. Change one line of the prompt and the answer can still move a long way.\n\nSo write a promise you can keep. On a hosted API, you can offer to replay stored answers and to hold new ones to a published set of checks. On your own servers, you can offer identical output for identical input on a named model, server version, GPU type and parallel setup, and verify it again after every change to that list.\n\n**Also read:** [AI support agent cost per resolved ticket runs 2 to 4 times the sticker](https://startupfortune.com/ai-support-agent-cost-per-resolved-ticket-runs-2-to-4-times-the-sticker/) • [How to calculate inference cost per user before your free tier burns cash](https://startupfortune.com/how-to-calculate-inference-cost-per-user-before-your-free-tier-burns-cash/) • [How to Calculate Payback Period With Variable Inference Costs](https://startupfortune.com/how-to-calculate-payback-period-with-variable-inference-costs/)\n\n*This article is posted in [AI News](https://startupfortune.com/category/ai/), check it out for more related stories.*\n\n## Join the discussion\n\n[Open in the community →](https://startupfortune.com/community/)\n\nAlmost there. Sign in and your reply posts straight away.", "url": "https://wpnews.pro/news/why-is-llm-output-different-at-temperature-0-and-can-you-stop-it", "canonical_source": "https://startupfortune.com/why-is-llm-output-different-at-temperature-0-and-can-you-stop-it/", "published_at": "2026-11-25 16:11:59+00:00", "updated_at": "2026-11-25 16:42:49.044461+00:00", "lang": "en", "topics": ["large-language-models", "ai-infrastructure", "ai-research", "mlops"], "entities": ["Thinking Machines Lab", "Qwen3-235B-A22B-Instruct-2507", "OpenAI", "Google", "Gemini 3.6 Flash", "Anthropic", "Claude Opus", "vLLM"], "also_reported_by": [], "takeaway": "Temperature 0 does not guarantee identical LLM outputs: Qwen3-235B-A22B-Instruct-2507 gave 80 distinct completions over 1,000 runs because GPU floating-point summation order shifts with batch size, and deterministic vLLM cost 42 seconds versus 26 for the default setup.", "recommendation": {"advice": "Treat temperature 0 as reducing randomness, not guaranteeing it; if you need reproducibility, enable vLLM or SGLang deterministic mode and budget the measured overhead (42s vs 26s).", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/why-is-llm-output-different-at-temperature-0-and-can-you-stop-it", "markdown": "https://wpnews.pro/news/why-is-llm-output-different-at-temperature-0-and-can-you-stop-it.md", "text": "https://wpnews.pro/news/why-is-llm-output-different-at-temperature-0-and-can-you-stop-it.txt", "jsonld": "https://wpnews.pro/news/why-is-llm-output-different-at-temperature-0-and-can-you-stop-it.jsonld"}}