// what it actually does
At each step the model emits logits — raw scores over the whole vocabulary. Temperature T divides every logit by T before the softmax turns them into probabilities. That's the entire mechanism. It adds no facts and no creativity; it only changes how peaky or flat the next-token distribution is.
Peaky vs flat
Same prompt, same logits, two temperatures. Watch the next-token distribution for "The capital of France is ___":
That's why low temperature wins for facts, code, extraction, and classification — you want the single most-likely, repeatable token at every step. Crank it up and you sample worse answers. If your model returns JSON but sometimes drifts off-schema, you probably left temperature high.
The rule + top_p
Low for anything that has a right answer; higher for ideation, brainstorming, and varied copy. And tune temperature or top_p — not both. They're different levers: temperature reshapes the whole distribution, top_p (nucleus sampling) truncates its tail, keeping the smallest set of top tokens whose probability sums to top_p. Move both and the effect gets impossible to reason about. OpenAI says this outright; Anthropic flags top_p as advanced-use-only.
Sources: Anthropic — Messages API (temperature, top_p, determinism) · OpenAI dev community — temperature & top_p cheat sheet · MachineLearningMastery — logits, softmax, sampling · Softmax temperature explained
One concept a week. Free.
The deeper, copy-paste version of each ToolCall short — in your inbox.
// total: 0.00 · spam: void · unsubscribe: one click
