Softmax Function
ML Engineer path · lesson 37 of 80See how softmax converts raw scores (logits) into probabilities step-by-step. Learn why it's THE activation for multi-class classification.
Softmax Function Visualizer
Watch how raw scores (logits) transform into probabilities step-by-step
Animation
Input Logits
Temperature
T < 1: Sharper | T = 1: Standard | T > 1: Softer
Ground Truth
Initial State
Ready to compute softmax!
softmax(z) = e^zi / Σe^zj
Current State
Softmax Formula
p_i = e^(z_i/T) / Σ_j e^(z_j/T)
Converts logits to probabilities. All values in (0,1), sum to 1.0.
Temperature Effect
T < 1: Sharper | T = 1: Standard | T > 1: Softer
Controls distribution confidence level.
Cross-Entropy Loss
L = -log(p_true)
Lower loss = higher confidence in correct class.
Mathematical Details
Softmax Formula
Where z_i are logits, T is temperature, C is number of classes.
Cross-Entropy Loss
Loss for true class: 0.6540
Current Calculation (True Class: Cat)
Exponentials: 1.000, 0.368, 0.150, 0.223, 0.183
Sum (Σe^z): 1.923
Probability: 1.000 / 1.923 = 0.5200
Loss: -log(0.5200) = 0.6540
Turn logits into probabilities
Order a numerically stable softmax.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
- 1Drop a step here
- 2Drop a step here
- 3Drop a step here
- 4Drop a step here
- 5Drop a step here
Test your knowledge
The softmax function converts a vector of logits into…
Learn these first
Interview Questions
References & Further Reading
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required