What are AI logits?
Logits are the raw, non-normalised scores that the final layer of a classification or language model produces for each class or token. In multi-class models the softmax function turns them into probabilities that add up to 1.
Unlike probabilities, logits are scores before normalisation; deep learning libraries interpret them as unnormalised log probabilities. The related statistical log-odds, the logarithm of an event's odds, is the inverse of the sigmoid function.
- Topic
- Machine learning, models and training
- Also known as
- Raw scores, unnormalised log probabilities, logit
- Origin
- The log-odds concept in statistics; in deep learning, the inputs to the softmax layer
How AI logits work
- The final linear layer outputs one logit per class or per token in the vocabulary.
- Softmax converts each logit into a probability by comparing it with the others.
- Logits are divided by a temperature: higher values soften the distribution; values below 1 concentrate it on likely options.
- Top-p sampling and sequence-blocking rules modify these scores during generation; cross-entropy loss is computed from logits in training.
In more detail
Calibration with temperature scaling
Temperature scaling, the simplest extension of Platt scaling, uses a single parameter T for all classes and divides the logit vector by it. T is chosen on a held-out validation set. Because T does not change the maximum of the softmax function, the predicted class stays the same and accuracy is unaffected; only the confidence scores improve.
Commonly confused terms
| Term | How it differs |
|---|---|
| Softmax | Softmax is the function that turns logits into probabilities that add up to 1; a logit is the raw score that goes into it. |
Why AI logits matter for on-premises AI
A 2017 study found that modern neural networks, unlike those of a decade earlier, are poorly calibrated; dividing logits by a single temperature parameter calibrated predictions surprisingly well without changing accuracy. The 2015 paper introducing knowledge distillation showed that training a small model to match a large model's logits is a special case of distillation. Raw softmax probabilities are therefore not reliable confidence scores.
An insurer calibrates its claims classifier's logits with temperature scaling on a validation set. Claims whose calibrated probability falls below a threshold go to expert review; the temperature and threshold are stored with the model version.
Common questions
Are logits the same as probabilities?
No. A logit is the non-normalised score before softmax or sigmoid; a probability is its normalised form. A raw logit value should not be read as a probability.
Where are logits used in language models?
At each generation step the model produces a logit for every token in its vocabulary. Temperature, top-p sampling and rules that ban certain sequences are applied to these scores before the next token is chosen.
Why are logits calibrated?
The probabilities of modern neural networks often do not reflect how often they are actually right. A post-processing step such as temperature scaling brings confidence scores closer to reality without changing the predicted class.
Related terms
Sources
- Distilling the Knowledge in a Neural Network, arXiv, 2015
- On Calibration of Modern Neural Networks, ICML, 2017
- The Curious Case of Neural Text Degeneration, ICLR, 2020
- Google for Developers, Machine Learning Glossary
In the glossary: Glossary, E to L