From Logits to Response
Send a service-desk agent the same question twice and the two answers can differ in wording, in order, now and then in substance. The old fix was to set the temperature, the dial What an LLM Actually Is let you turn, to zero. On most current models the API rejects that setting or ignores it, and where it was accepted, the answers were never fully repeatable anyway. Both facts come from the same stage: the one where a token is drawn.
Thesis: For each step of a reply the model produces scores for every token in its vocabulary, and the provider's sampler turns them into probabilities, draws one, appends it and repeats until a stop. Temperature and top-p only reshape that draw, never what the model knows, and current models increasingly fix them at their defaults, so consistency has to come from what is in the call, the output schema and checks in code rather than from a dial. Reasoning tokens are more draws of the same kind, billed as output whether or not you can read them.
How the Model Reads the Window ended each pass on a score for every possible next token, and What a Prompt Cache Reuses showed what that reading costs. This chapter opens the two stages after it, sample and stop, which One Request, End to End gave to the provider.
Scores, Then Probabilities
At the end of each pass the model scores the last position against every entry in its vocabulary, one number per token, tens or hundreds of thousands of them. Those raw scores are logits. A function called softmax turns them into probabilities: it raises a constant (e, about 2.718) to the power of each score, which stretches the gaps between high and low scores, then divides by the total, so every token gets a share and the shares sum to one. High scores dominate; low ones keep a sliver.
Take the moment in Anatomy of a Turn where the agent names a ticket's owner, and suppose it phrased the answer differently. The window holds the search result, and the reply so far ends "The ticket is assigned to". The table shows five candidate next tokens with invented logits; a real vocabulary has every other token too, each with a sliver.
| Candidate next token | Logit (illustrative) | Probability at temperature 0.5 | at 1.0 | at 1.5 |
|---|---|---|---|---|
| Network | 3.0 | 79% | 56% | 44% |
| the | 2.2 | 16% | 25% | 26% |
| Service | 1.6 | 5% | 14% | 17% |
| nobody | 0.4 | under 1% | 4% | 8% |
| INC | −0.5 | under 1% | 2% | 4% |
Toy numbers, five tokens, softmax computed exactly; no real model's logits.
That distribution is the model's whole output for the step. Nothing has been chosen yet. Everything after this point is the provider's serving code.
The Draw
The obvious rule is to take the top token every time, called greedy decoding. In open-ended writing it reads badly over a long reply. Holtzman and colleagues showed in The Curious Case of Neural Text Degeneration (ICLR 2020) that "using likelihood as a decoding objective leads to text that is bland and strangely repetitive." So providers sample: they draw a token at random in proportion to its probability, and two knobs reshape the odds first.
Temperature divides every logit by a number before the softmax. Below 1 the gaps widen and the top token takes more of the mass, 79% at 0.5 in the table; above 1 they narrow and the tail gets more, 8% for "nobody" at 1.5. Near 0 it approaches greedy decoding.
Top-p, or nucleus sampling, from the same paper, keeps only the smallest set of top tokens whose probabilities add up to at least p, renormalises and draws from those: "sampling text from the dynamic nucleus of the probability distribution", which "allows for diversity while effectively truncating the less reliable tail". At temperature 1 and a top-p of 0.9, the table's first three tokens make about 94% and survive; "nobody" and "INC" are cut. Top-k is the blunter version: keep the k most probable tokens, whatever their mass.
The whole stage, for one token:
flowchart TD
M[Model pass<br/>reads the window] --> L[Logits<br/>one score per token]
L --> T[Temperature<br/>divides every logit]
T --> S[Softmax<br/>scores become probabilities]
S --> P[Top-p or top-k<br/>cuts the tail, renormalises]
P --> D[Draw one token]
D --> X{End-of-turn token,<br/>stop sequence or limit?}
X -->|no: append it, read again| M
X -->|yes| R[The reply and its stop reason]
style M fill:#5a5a8a
Figure: From logits to a token. The model's scores are divided by the temperature, turned into probabilities by softmax, cut by top-p or top-k, and one token is drawn; it is appended and the model reads again until an end-of-turn token, a stop sequence or a limit.
Then the drawn token is appended, the model reads again with it in place, and the next distribution is computed against a reply that now includes it. That is why two runs diverge. One draw of "the" instead of "Network" at word six sends the rest of the sentence down another path, and every later token is conditioned on the difference. Neither knob changes what the model knows. A fact missing from the window and the weights is missing at every temperature; the knobs only decide how often a less likely continuation wins.
The lab below holds the table's five logits fixed. Move temperature and top-p and watch the shares change, then draw: one draw shows how a single run can land on "the" or "nobody", and a hundred show the distribution the settings produce. With JavaScript off, the table shows the shares at a few settings.
| Temperature, top-p | Network | the | Service | nobody | INC |
|---|---|---|---|---|---|
| 1.0, 1.0 (the defaults) | 56% | 25% | 14% | 4% | 2% |
| 1.0, 0.9 | 59% | 26% | 15% | cut | cut |
| 1.0, 0.5 | 100% | cut | cut | cut | cut |
| 0.5, 0.9 | 83% | 17% | cut | cut | cut |
| 1.5, 0.9 | 46% | 27% | 18% | 8% | cut |
| 0 (greedy) | 100% | 0% | 0% | 0% | 0% |
The same toy logits; a cut token cannot be drawn, and the survivors' shares are renormalised to sum to 100%.
Why Temperature 0 Is Not Always Available
As What an LLM Actually Is noted, the dial is often no longer yours. The rule, as of November 2026: on the newest models of Anthropic, OpenAI and Google, you can no longer set temperature or top-p (on OpenAI's, whenever reasoning is switched on). Depending on the vendor and the API version, sending them either makes the API reject the call with an error or is silently ignored, and no other setting replaces the lost effect.
For builders: what each vendor does (read 2026-11-08)
- Anthropic. From API version
2026-10-21, a call that sendstemperature,top_portop_kis rejected with a 400 error, even at the default value; Claude 4.7 and later already accepted only the defaults. See the migration guide. - OpenAI. On GPT-6 with reasoning switched on, remove
temperature,top_pandtop_logprobs. See the GPT-6 guide. - Google. From Gemini 3.6 Flash and 3.5 Flash-Lite, the three parameters are deprecated and ignored, and future generations will reject them; Google suggests explicit rules in the system instruction instead. See what's new in Gemini 3.6.
The vendors state the rule more clearly than the reason. A likely part of it, my inference rather than any vendor's statement, is that reasoning models (models that write out working before answering, made with reinforcement learning as What Training Puts in the Weights describes) are trained while sampling at their default settings, so the default is the setting they were tuned for, and lowering the temperature takes them somewhere training never measured.
Temperature 0 also never delivered what people used it for. Horace He and Thinking Machines Lab, in Defeating Nondeterminism in LLM Inference (2025-09-10), note that "even when we adjust the temperature down to 0 … LLM APIs are still not deterministic in practice". They sampled one open model 1,000 times at temperature 0 on one prompt and got 80 unique completions. Their diagnosis is not randomness in the sampler but the server: the batch a call is computed in (servers run many users' calls together as one batch) varies with load, and the arithmetic is not invariant to batch size, so the logits themselves shift slightly from run to run, enough to flip a close draw.
The consequence for anyone who relied on the dial: the same call is not guaranteed to reproduce the same reply, and on current hosted models no setting you can send guarantees it. Repeatability has to come from elsewhere.
The Reply Ends on a Draw or a Limit
The end of the reply is drawn too. The end-of-turn marker is a token in the vocabulary like any other, and when the sampler draws it the serving code stops and reports end_turn. When the drawn tokens form a tool request, it stops with tool_use. Two common stops are not drawn: a stop sequence, a string you told the provider to stop at, appears in the text, or the reply reaches max_tokens and is cut. Anatomy of a Turn covers what the harness should do with each stop reason; the point here is that a finished answer and a cut-off one leave the same stage, and only the stop reason tells them apart.
Structured outputs work at this stage. A strict schema, a JSON schema the provider enforces while sampling, constrains the sampler so that it can only draw tokens that keep the output valid, which makes the shape certain, unless the reply is cut off or refused, and leaves the values to the distribution; The Tool Call Is a Round Trip shows what that does and does not guarantee for tool arguments.
Reasoning Tokens Are Draws Too
A reasoning model draws a stretch of thinking tokens before the answer, by the same process, and every thinking token is input to every token after it. The rule is the same at both large vendors (Anthropic, OpenAI): thinking tokens are billed as output, they count toward max_tokens, and they fill the window, whether or not you can read them. By default you get either nothing back or a summary written by another model, while you pay for the full thinking.
The setting these models do expose is effort: how much thinking to spend, which moves cost, latency and, the vendors say, quality. In a tool loop the thinking travels: Anthropic asks you to pass its thinking blocks back unchanged on the next call, carrying an encrypted copy of reasoning you cannot read. For an audit that is a new kind of record: output you paid for, that shaped the answer, that you hold only as a summary or a sealed block.
A Triage Agent Meets a Current Model
A service-desk team built a ticket classifier on an older model with temperature 0, so that re-running a ticket gave the same priority label, and treated re-running as their audit check. They migrate to a current model. Three things break, each at this stage.
The parameter. The call is now rejected with an error, under a newer API version even at the default value; on some providers it is silently ignored instead, which is worse, because nothing tells the team its setting stopped working. Removing it is the fix, and the labels on borderline tickets now vary between runs.
The audit. "Re-run it and see" was never sound, since temperature 0 was not deterministic either; now it visibly fails. The record of what the agent decided is the label it returned, logged with the call, not a second draw.
The cut-off. The team kept max_tokens at 50, enough for a label. Thinking tokens count toward that limit, so some replies stop at max_tokens before the label is written. A harness that read any reply as an answer would file those tickets with no priority.
The repairs come from outside the sampler: an enumerated output schema so the label is always one of five (compared case-insensitively, since Anthropic's structured-outputs page says it does not guarantee the capitalization of enum values), a validation step in code, max_tokens budgeted for thinking plus answer, the effort setting chosen for the task, and an evaluation over many runs per ticket, because a single draw says little about a distribution.
When the Dial Still Matters
Some older hosted models (on Anthropic, only on the older API version 2023-06-01) and open-weights models, whose weights are published so you can run them on your own servers, still expose temperature, top-p and top-k, and for creative generation, brainstorming or diverse test data a higher temperature is exactly the tool. On infrastructure you control, determinism is also within reach: the Thinking Machines post shows how batch-invariant arithmetic makes repeated runs identical, at some cost in speed. If your product depends on byte-for-byte repeatable output, that is an argument for serving a model yourself, not for a setting on a hosted API.
For agents on current hosted models, treat sampling as given. The controls that remain are the ones the earlier stages already handed you: what is in the window, what the schema allows, and what the harness checks.
What to Do Next
- Remove sampling parameters on current models. Check each vendor's migration notes before you upgrade a model or an SDK; a parameter that was tolerated can become an error.
- Store outputs; never regenerate as a record. The logged reply is part of the audit record. A second run is a second draw.
- Get consistency from structure. Enumerated outputs, strict schemas and validation in code pin down the shape where the dial no longer can.
- Budget
max_tokensfor thinking plus answer, watch formax_tokensstops, and log output tokens per call so thinking cost is visible. - Evaluate on distributions. Run each test case several times and report the spread, not one lucky or unlucky draw.
Next in the series: The Tool Call Is a Round Trip, on the reply that asks for something outside the window. Related reading: What Training Puts in the Weights for where reasoning models come from.