LLMs

Temperature

Temperature rescales logits before sampling to control distribution sharpness.

tokens, most likely firstprobabilityT = 0.5T = 2
Temperature rescales logits before sampling to control distribution sharpness. Values shown in the worked visual are illustrative unless the labels state otherwise.

How it works

Lower temperature concentrates probability on high-logit tokens, while higher temperature spreads probability more broadly. A value of zero is commonly implemented as greedy selection rather than literal division.

A concrete example

Illustrative: logits [2, 1] yield probabilities about [0.73, 0.27] at temperature 1 and [0.88, 0.12] at 0.5.

Do not confuse it with Top-p

temperature reshapes all logits; top-p truncates to a cumulative probability mass.

Study the full lesson