Softmax turns a classifier’s unbounded per-class scores into a probability vector: every value lies between 0 and 1, the values sum to 1, and each position estimates the probability of its class. The largest probability identifies the predicted class, while the full vector expresses relative confidence. section 9.1.5 section 9.4
Unlike a hard argmax-one-hot choice, softmax changes smoothly as scores change. Two nearly identical score vectors can fall on opposite sides of an argmax decision boundary and yield completely different one-hot outputs; their softmax outputs remain close. This differentiability makes the probability conversion suitable for training. section 9.1.5
Reading class confidence
For cat, dog, airplane, and automobile scores such as [9.99, 10, 0.01, -10], softmax assigns nearly equal probability to cat and dog, with dog slightly higher, and near-zero probability to the other classes. The predicted class is dog, but the near tie signals low confidence between dog and cat. section 9.1.5
In multiclass training, softmax commonly feeds cross-entropy loss. A prediction assigning a dog probability of 0.502 for a dog image has high loss, whereas one assigning 0.997 has low loss. PyTorch combines these operations in cross-entropy loss for better numerical behavior, so training receives raw scores rather than separately computed softmax probabilities. section 9.1.6 section 9.2.3
Figure 9.2 Two-class argmaxonehot and softmax (function of score vector [s0, s1]) on the (s0, s1) plane. The decision boundary is the 45o line s0 = s1.
|
(a) Step function: z = 1 if s0 > = s1, else z = 0 |
|
(b) Softmax: differential approximation of the step function |
|
(c) Step function: z = 1 if s1 > = s0, else z = 0 |
Compare the abrupt two-class argmax decision boundary with softmax’s smooth probability surfaces. section 9.1.5
At prediction time, a model can apply softmax to its scores and then take argmax. This pattern appears in a three-class height-and-weight classifier, LeNet’s 10-class digit output, and Faster R-CNN’s class estimates for proposed image regions. section 9.2.3 section 11.1 section 11.4




















