2.2.12 · D5Linear & Logistic Regression
Question bank — Multinomial - softmax regression
Before we start, a short glossary so every symbol below is already earned:
The single figure below fixes two pictures in your head — the softmax "pie" and the sigmoid S-curve — so the traps below have something visual to lean on.

Look at the left panel: three logits become three positive bars (amber), and softmax just re-slices them into a pie summing to (cyan). Shifting all three logits up shifts all bars equally — the slices never change. The right panel is the sigmoid : notice it is exactly the softmax plotted against the logit difference .
True or false — justify
Adding the same constant to every logit changes the predicted probabilities.
False. Every gets multiplied by , which cancels in the ratio; softmax is shift-invariant, so only differences of logits matter.
Multiplying every logit by a constant leaves the probabilities unchanged.
False. Scaling is not shifting — it stretches the differences , sharpening the distribution toward the top class (this is the "temperature" effect).
For , softmax is a genuinely different model from binary logistic regression.
False. , exactly the sigmoid (, the S-curve above) of the logit difference, so it is the same model — see Logistic Regression.
Each of the weight vectors is individually identifiable from data.
False. Because of shift-invariance you can add any constant vector to all of them without changing predictions; only vectors' worth of parameters are identifiable.
If two classes have equal logits, they receive equal softmax probabilities.
True. Equal gives equal , so their normalized shares are identical — softmax is symmetric in classes with equal scores.
The softmax output can equal exactly for some class.
False. for every finite , so every probability is strictly positive; a class only approaches as its logit goes to .
The cross-entropy loss reads the predicted probability of the wrong classes directly from its formula.
False. With a one-hot label every wrong-class term has , so uses only the true class's probability; the wrong classes influence only indirectly, through the shared normalizer inside .
The gradient component can only be negative for the true class.
True. For a wrong class , so (never negative); only the true class has , making whenever the true probability is below .
At the perfect prediction , the gradient with respect to every logit is zero.
True. for all , so no weight moves — the loss is at its minimum for that example.
Spot the error
"To avoid overflow, subtract before exponentiating."
Error. You subtract the max, not the min; subtracting the max makes the largest exponent and all others , which is what prevents overflow (see Log-Sum-Exp Trick).
"Cross-entropy loss needs me to compute for all classes."
Error. All terms with vanish, so only survives; computing the rest is wasted work.
"Since probabilities are positive, I can safely take without worry."
Error. Naively computed can underflow to exactly , making ; you must compute in log-space.
"The gradient is , so we step ."
Error (sign). The loss gradient is ; the update subtracts that, giving . Flipping the sign does gradient ascent and diverges.
"Softmax with classes has free scalar outputs, so it needs degrees of freedom."
Error. The sum-to-one constraint removes one degree, leaving genuinely free outputs — the same count binary logistic regression uses ( for ).
"For numerical stability I subtract and renormalize by a hand-picked constant to be safe."
Error. Subtracting the max is exact (shift-invariance guarantees identical answers); an extra hand-picked constant is either redundant or, if multiplicative, corrupts the probabilities.
Why questions
Why does exponentiation, rather than "shift up and clip to positive", get used to make logits positive?
Because is smooth, strictly increasing, and never zero, giving well-defined gradients everywhere and preserving the logit ordering; clipping introduces kinks and dead zones with zero gradient.
Why does dividing by (and nothing else) guarantee the outputs sum to ?
Because summing the outputs gives identically — the numerator sum equals the denominator by construction.
Why is the softmax+cross-entropy gradient so clean at ?
The from differentiating cancels the in , and collapses the rest — the exp/normalizer mess disappears exactly (see the pocket derivation above).
Why do we derive the loss from Maximum Likelihood instead of just guessing a loss?
Maximum Likelihood Estimation says pick weights that make the observed labels most probable; taking of that product turns it into a sum we can minimize, which is precisely Cross-Entropy Loss.
Why can we set without losing any expressive power?
Shift-invariance means only logit differences matter, so we can measure all scores relative to class ; this is exactly what binary logistic regression does with its single weight vector.
Why does a bigger error on a wrong-but-confident prediction push the input harder into the weights?
The gradient is , so the error is largest exactly when the prediction is most wrong, and it multiplies — big mistakes move the weights more, correct ones () not at all.
Edge cases
What does softmax output when all logits are equal (including all zero)?
A perfectly uniform distribution for every class — no logit stands out, so the pie is split evenly.
What happens to as one logit while others stay fixed?
and all others ; softmax becomes a hard "argmax" in this limit (which is why it's a soft max).
What is the cross-entropy loss when the model is perfectly right ()?
; a perfectly confident correct prediction contributes zero loss.
What is the loss when the model gives the true class probability ?
; confidently wrong is punished without bound, which is why log-space stability matters.
Is softmax defined for (a single class)?
Yes but trivially: always, so a one-class problem carries no information and no learnable signal.
If two logits are both enormous and nearly equal (say and ), what breaks naively and what fixes it?
Direct overflows to ; subtracting the max first (logsumexp) gives and , recovering a correct near-even split — used by every Neural Network Output Layer.
If the training label is not one-hot but a soft distribution (e.g. ), does cross-entropy still work?
Yes; the general form handles any target distribution — one-hot is just the special crisp case where one .
Connections
- Logistic Regression — the special case that these traps repeatedly reference.
- Cross-Entropy Loss — the loss whose "only the true term survives" trap lives here.
- Maximum Likelihood Estimation — the justification behind several "why" answers.
- Gradient Descent — the sign-flip trap targets its update rule.
- Log-Sum-Exp Trick — the max-vs-min and overflow edge cases.
- Neural Network Output Layer — where these stability edge cases bite in practice.
- One-Hot Encoding — the label form assumed in the loss traps.