Interactive Lab ยท LLMs & Transformers
A neural net's final layer spits out raw scores that could be anything-3, 12, 0.5. How do those become clean probabilities that sum to 100%? One function: softmax. It exponentiates the scores, then normalizes, so the biggest score gets an exaggerated share. Drag the logits and watch the distribution form.
๐ฌ Watch the 45-second explainer, then turn the knobs yourself below โ
โถ The playground, drag each logit, then bend the temperature
Softmax is the last layer of every classifier and the heart of attention weights and LLM token sampling, logits become the probabilities behind every 'next word'. The shift-invariance you just proved is a real numerical-stability trick (subtract the max) present in every production implementation, and temperature scaling (see that lab) divides these exact logits.
The code that's actually running
Set two logits nearly equal (say cat = 3, dog = 2.9) and drag the rest way down. At T = 0.2 vs T = 3, how does the split between the top two change? Now hit โ+5 to every logitโpredict what happens to the bars before you look (hint: softmax is shift-invariant, only the differences between logits matter).
The takeaway
exp exaggerates the biggest logit; dividing by the sum makes the pieces add up.