What is softmax?

Softmax turns a neural network's raw scores (logits) into a probability distribution whose values lie between 0 and 1 and sum to 1. Each score is exponentiated and divided by the sum of all exponentials, so larger scores get larger probabilities.

Unlike the sigmoid, which turns one score into an independent probability, softmax normalises several classes' scores together, so one class gaining probability means others lose it. A 1989 study replaced the usual logistic output non-linearities with this normalised exponential.

Topic
Machine learning, models and training
Also known as
Normalised exponential, softargmax
Origin
1989, probabilistic interpretation of neural network outputs at NIPS

How softmax works

  1. The model produces a raw score (logit) per class or token.
  2. Scores can be divided by a temperature, normally 1.
  3. Scores are exponentiated and divided by their sum.
  4. In training it is paired with a cross-entropy loss, making the derivative before the output the predicted probability minus a one-hot target.

In more detail

Softening the distribution with temperature

Logits can be divided by a temperature value before softmax. The temperature is normally 1; a higher value produces a softer distribution spread more evenly across classes. In knowledge distillation these soft targets from a large model are passed to a small one.

Commonly confused terms

TermHow it differs
LogitA logit is the unbounded raw score fed into softmax. Softmax is the function that turns these scores into probabilities summing to 1; the order of scores is kept but the scale becomes probability.

Why softmax matters for on-premises AI

Softmax produces class probabilities in classification networks and next-token probabilities in language models. In the 2017 study introducing the Transformer, attention weights also come from softmax over query and key dot products, which are scaled because at large dimensions they push softmax into regions with extremely small gradients. A knowledge distillation study raises the temperature for softer distributions and trains a small model on them.

ON-PREMISES EXAMPLE

An insurer's document classification model gives softmax probabilities for policy, claim notice, invoice and other classes. Documents whose top probability falls below a threshold go to human review; the team tunes the threshold to the validation set's error rate.

Common questions

When is softmax preferred over sigmoid?

Softmax is used when classes are mutually exclusive, meaning each example belongs to one class. When an example can carry several labels at once, a separate sigmoid is used for each label.

Does softmax output show model confidence accurately?

Not always. Softmax gives a distribution summing to 1, but these probabilities may not match the model's actual accuracy. Decision thresholds are therefore tuned on validation data, with model calibration applied where needed.

Sources

In the glossary: Glossary, R to Z

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.