TECHNOLOGY

Temperature changes a probability distribution before sampling

In this article
THE QUICK TAKE

Temperature changes relative sampling probabilities for existing scores; it does not retrain the model or supply missing evidence.

Temperature is a numerical operation on a next-token distribution. Describing it only as creativity hides what actually changes: the relative weight of candidate tokens after the model has computed scores. A small distribution makes this mechanism visible without relying on a subjective judgment about the generated answer.

Divide logits before softmax

For positive temperature, divide candidate logits by that temperature before softmax normalization. This preserves their ordering while changing their separation. Raising temperature compresses score differences; lowering it expands them. The resulting probabilities still sum to one. This is a decoding transformation applied to an already computed vector, so it does not change the model weights, the prompt tokens or the evidence available at that step. A separate token filter may subsequently remove candidates, depending on the generation pipeline.

Probability ratios reveal the operation

For two candidate logits, the ratio of their softmax probabilities is the exponential of their score difference divided by temperature. Consider scores with a fixed positive gap. Increasing temperature reduces the ratio toward equal weighting; decreasing temperature makes the favored candidate more dominant. The relationship is about ratios, not simply adding a fixed probability to every unusual word. Normalization couples all candidates, so a probability changes in relation to the complete surviving distribution, including tokens outside the most visible shortlist.

Entropy concerns the conditional distribution

For a fixed finite score vector, increasing positive temperature flattens the softmax distribution and generally increases its entropy toward a uniform distribution. This is local conditional uncertainty at the current position. A full sampled sequence changes later contexts, so a local entropy comparison cannot predict every property of finished text. Diverse continuations may include mistakes as well as useful alternatives. Increasing entropy supplies no new factual source and cannot guarantee that a rare candidate is more insightful than a common one.

Keep the implementation boundary explicit

A zero-temperature setting is often implemented as a greedy special case rather than literal division by zero. Check the documented generation behavior. For a reproducible illustration, save one logit vector and compare transformed distributions before drawing samples. Then hold filtering rules and random seed policy explicit when studying complete outputs. A different answer can result from randomness even with identical probabilities. This distinction prevents model changes, probability transformations and random draws from being combined into one vague explanation about creativity.

Primary research and implementation references

Reproducible inference stacks: preserving a GPU pilot’s result; A GPU inference benchmark you can trust.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles