3.1.6 · D5Neural Network Fundamentals

Question bank — Softmax for output layers

1,952 words9 min readBack to topic

This is a conceptual drill for softmax. No heavy arithmetic — every item hunts a misconception or a boundary case. Read the prompt, answer out loud in a sentence, then reveal. If your reasoning differs from the answer's reasoning (even if the verdict matches), you have a gap worth closing.

Two facts are invoked so often below that we prove them once here, so the drill items can lean on them:


True or false — justify

Softmax outputs are guaranteed to lie strictly between 0 and 1, never exactly 0 or 1.
True in exact arithmetic. Each output is , and for every finite , so the numerator is positive and strictly smaller than the sum. (In finite-precision floating point a very negative can underflow to exactly — but that is a hardware rounding artifact, not the true value.)
If one logit is much larger than all others, softmax outputs an exact 1 for it.
False in exact math — it approaches 1 but never equals it. In floating point it rounds to 1.0, but that is numerical rounding, not the true value.
Adding 5 to every logit makes the winning class more confident.
False. By Fact A (shift-invariance) the common factor cancels top and bottom, so every is the identical number it was before — adding a constant to all logits changes nothing.
Multiplying every logit by 2 makes the winning class more confident.
True. Scaling logits is not the same as shifting: it does not cancel out. Multiplying by 2 is equivalent to setting temperature , which sharpens the distribution toward the argmax.
Softmax and argmax give the same winner (the same top class).
True. Softmax is monotonic, so the largest logit always maps to the largest probability — same winner. They differ only in that softmax is soft and differentiable, argmax is a hard non-differentiable pick.
A softmax probability of 0.99 means the model is 99% likely to be correct.
False. It is a relative score among the offered classes, not a calibrated truth. Neural nets are routinely overconfident; a wrong prediction can still read 0.99.
Softmax with classes ( = number of classes) is exactly a sigmoid.
True in effect. Two-class softmax depends only on the logit difference , and — the sigmoid of the gap.
You can feed already-normalized probabilities into softmax to "clean them up."
False. Applying softmax to values that already sum to 1 pushes them toward the uniform vector (e.g. ), destroying the confidence you had — softmax is meant for raw logits, applied exactly once.
Softmax is a linear function of its inputs.
False. The exponential and the division make it nonlinear — that nonlinearity is precisely what amplifies gaps and produces a "soft winner."
If two logits are equal, their softmax probabilities are equal.
True. Equal inputs give equal , hence equal shares — softmax is symmetric and respects ties exactly.

Spot the error

"To avoid negative probabilities, we normalize by writing ."
The error: raw logits can be negative (giving negative "probabilities") and their sum can be zero (division blows up). Exponentiating first, , fixes both because it is always positive.
"Softmax subtracts the max only to change the answer to something safer."
The error: subtracting changes nothing in the output — it is exactly Fact A (shift-invariance) with . It only prevents floating-point overflow of ; the probabilities are identical.
"For an image that is both a beach and sunny, softmax over {beach, sunny, indoor} handles it."
The error: softmax forces classes to compete (they sum to 1), so it cannot say "both." Multi-label problems need independent sigmoids (one probability per class, not sharing a pie) instead.
"The gradient only works because cross-entropy is a special complicated case."
The error: it's the opposite — as shown in Fact B, the in cross-entropy cancels the in softmax, making the gradient simpler, not more special. That cancellation is exactly why the pair is used together.
"We divide by the sum of the logits to normalize."
The error: we divide by the sum of the exponentiated logits, . Dividing by the sum of raw logits reintroduces the sign and zero-sum problems.
"Since softmax outputs sum to 1, doubling one output and halving another keeps it valid."
The error: softmax outputs a specific distribution determined by the logits; you cannot hand-edit two values and expect it to correspond to any logit vector. "Sums to 1" is necessary, not sufficient.
"Applying softmax twice is harmless because it's idempotent like a normalize step."
The error: softmax is not idempotent. Each extra pass moves the vector closer to uniform (numerically: a sharp becomes a duller ), discarding confidence information.

Why questions

Why exponentiate instead of, say, squaring the logits to force positivity?
Squaring loses sign/order information (), breaking monotonicity, and its gradient stalls at zero. stays positive, strictly increasing, differentiable everywhere, and arises from the maximum-entropy assumption .
Why is softmax called a "soft" argmax rather than just argmax?
Argmax outputs a hard 0/1 pick with zero gradient almost everywhere, so it cannot be trained. Softmax gives a smooth, differentiable approximation that still favors the top class but passes usable gradients back through Backpropagation.
Why does the true class get a negative gradient under softmax + cross-entropy?
For the true class (one-hot target) and , so ; a negative gradient means "increase this logit," pushing the model to raise the correct class's score — exactly the desired learning direction (see Fact B for where comes from).
Why can't we drop the exponential and use ReLU-then-normalize instead?
ReLU zeroes out all negative logits, so several classes could collapse to probability 0 and the gradient dies there. The exponential keeps every class alive with a nonzero, differentiable share.
Why does temperature appear as division of logits, , and not division of probabilities?
Dividing logits and then exponentiating scales the gaps in log-space, smoothly sharpening () or softening () the whole distribution while keeping it valid (see figure). Dividing probabilities directly would break the sum-to-1 guarantee.
Temperature reshapes the same logits — look at figure s01 (bars sharpen as falls, flatten as rises).
The logits are fixed; only changes. Small concentrates mass on the top class; large spreads it toward uniform — confidence is a dial, not a fixed property of the logits.
Figure — Softmax for output layers

Edge cases

What does softmax output when all logits are equal (e.g. )?
The uniform distribution ( = number of classes). With no information favoring any class, softmax returns maximum entropy — total ignorance spread evenly.
What happens to softmax as one logit while others stay finite?
That class's probability approaches 1 and all others approach 0 — softmax degenerates toward a hard argmax in the limit, but never exactly reaches 0 or 1 for finite inputs.
What happens to softmax as one logit while others stay finite?
By symmetry with the case, , so that class's probability and the surviving classes share the whole distribution. In exact math it approaches but never reaches 0; in floating point, a sufficiently negative logit underflows to exactly .
What happens as temperature ?
Every , so softmax approaches the uniform distribution regardless of the logits — infinite temperature erases all confidence (rightmost trend in figure s01).
What happens as temperature ?
The gaps blow up, and softmax collapses onto the single largest logit (a one-hot vector) — zero temperature reproduces hard argmax (leftmost trend in figure s01).
With logits , why does the naive formula fail and the shifted one not?
Naively overflows to inf and the ratio becomes NaN. Subtracting the max gives shifted logits whose largest exponent is — same exact probabilities, no overflow.
What is softmax of a single-element vector (K=1)?
Always , since for any — with only one class there is nothing to be uncertain about.
If two classes tie for the largest logit, what does softmax do that argmax cannot?
Softmax splits the probability evenly between the tied classes (e.g. over them), giving a well-defined, differentiable answer, whereas argmax must break the tie arbitrarily.

Connections

  • Cross-Entropy Loss — the log that cancels softmax's exp, giving the clean gradient.
  • Sigmoid Activation — the two-class / multi-label alternative when classes shouldn't compete.
  • Logits and Log-Odds — the raw inputs softmax is meant to consume.
  • Maximum Entropy Distributions — why the exponential form is the least-biased choice.
  • Temperature Scaling — dividing logits by to sharpen or soften the output.
  • Backpropagation — where the gradient travels backward.