Logits are the raw, unnormalized scores from a neural network's final layer, before softmax turns them into probabilities.
For language models, the output layer produces one logit per vocabulary token. Higher logits mean the model is more confident that token should come next. The name comes from statistics: the log-odds of an event. In networks, logits are the pre-activation values that softmax exponentiates and normalizes. The conversion is p(token_i) = exp(logit_i) / sum(exp(all_logits)).
Relative gaps between logits matter more than absolute values, because softmax renormalizes.
Changing logits is a direct control knob. Classifier-free guidance in diffusion models scales logits. Constitutional AI edits logits to discourage harmful outputs. Logit bias in API calls raises or lowers specific token probabilities. Temperature divides logits before softmax: higher temperature flattens the distribution and adds randomness; lower temperature sharpens it toward the top tokens.
Logits sit behind advanced prompting, interpretability work, and generation control that goes past simple sampling knobs.
Because softmax is invariant to adding a constant to all logits, only differences count. Temperature T divides each logit by T. As T goes to 0, the distribution collapses to the argmax token. Logit bias adds a constant to chosen ids before softmax, which is how APIs ban or boost words without retraining. Constitutional AI and classifier-free guidance both operate on this pre-softmax vector.
Logits are raw scores before softmax. Temperature and top-p sampling both act on those scores.
Logit Visualization
Adjust logits and see how they transform into probabilities through softmax