Before you can read the parent note, you need to see every symbol it throws at you. This page builds each one from nothing — plain words, then a picture, then why the topic can't live without it. Read top to bottom: each idea rests on the one above it.
The picture. Think of d=2: then x=(x1,x2) is a single dot on a flat sheet of paper, at horizontal position x1 and vertical position x2. For d=3 it's a dot in a room. For bigger d we can't draw it, but it's still "one point in a d-dimensional space."
Why the topic needs it. Everything downstream — the scores, the probabilities — is a function of this one point. No input, nothing to classify.
The picture.wk is an arrow starting at the origin, pointing in the direction that class k considers "very much like me." A point x lying far along that arrow's direction scores high for class k.
Why the topic needs it. These arrows are the only thing the model learns. Training = adjusting the wk arrows so each points toward its class's examples.
The picture. Lay both arrows down. The dot product measures how much of x "shadows onto" the direction of w (its projection), scaled by how long w is. Same direction → large positive shadow. Right angle → zero. Opposite → negative.
The picture. Picture K contestants, each holding up a scorecard with a number on it. Some numbers are negative (like −4), some big (like 12). These are the zk. They're not yet fair, comparable slices of a pie — just raw enthusiasm.
Why the topic needs it. The logits are the bridge: the learned arrows produce them, and softmax will convert them into honest probabilities. The word "logit" will appear everywhere in the parent note.
The picture. A conveyor belt: it visits each item once, dropping it into a running total. The j is the belt's counter; it's a dummy — you could rename it m and nothing changes.
Why the topic needs it. The softmax denominator ∑j=1Kezj is "the total size of all boosted scores" — the whole pie we're about to divide.
The picture. A pie chart. Each contestant's boosted score ezk claims a wedge; dividing by the total is just measuring each wedge as a fraction of the full circle. All wedges together = one whole pie = 100%.
Why it works. Adding the same constant c to every logit multiplies every ezk by ec, which cancels in the ratio — softmax is shift-invariant. Choosing c=−m pins the largest term at 1. The parent note calls this the Log-Sum-Exp Trick.
The picture.K light switches, all OFF except the one for the true class, which is ON.
Why the topic needs it. It lets the loss (next section) automatically "pick out" only the true class — every wrong-class term is multiplied by 0 and vanishes.
The picture. A mirror image of the exponential curve flipped across the diagonal line y=x. On the interval we care about, 0<a≤1: the curve sits at or below zero. It equals exactly 0 when a=1, and dives down toward −∞ as a approaches 0.
The one-hot shortcut. Because t is zero everywhere except the true slot, the whole sum collapses to a single term:
L=−logptrueWhy? Every wrong-class term is tk⋅(…)=0⋅(…)=0. So cross-entropy is literally "the negative log of the slice the true class received." Full treatment: Cross-Entropy Loss, derived from Maximum Likelihood Estimation.
The picture. Imagine L as a hilly landscape whose height depends on all the logits. ∂L/∂zm is the steepness you'd feel if you walked one step purely along the zm axis, freezing all others. Downhill in that direction lowers the loss.
Building the gradient, one step at a time. We want ∂L/∂zm where L=−∑ktklogpk.
Step A — slope of softmax itself.WHAT: first find how each probability pk moves when we wiggle logit zm. WHY: the loss is built from the pk, so by the chain rule we must know their slopes first. Result (a standard exercise you can accept for now):
∂zm∂pk=pk(δkm−pm)
Read it: if k=m the term δkm=1 makes it pm(1−pm)>0 (raising a logit raises its own probability); if k=m it is −pkpm<0 (raising one logit steals probability from the others). That sign pattern is exactly the "pie must still sum to 1" behaviour.
Step B — slope of logpk.WHAT: the loss uses logpk, not pk. WHY: we need the derivative of the log so we can chain it onto Step A. The derivative of loga is 1/a, so
∂zm∂logpk=pk1∂zm∂pk=pk1pk(δkm−pm)=δkm−pm.WHAT IT LOOKS LIKE: the 1/pk and the pk cancel — the messy division disappears. This cancellation is the whole reason softmax and log are paired.
Step C — assemble the loss slope.WHAT: put Step B into L=−∑ktklogpk. WHY: that is the quantity we actually want to descend.
∂zm∂L=−∑ktk(δkm−pm)=−(=tmk∑tkδkm−pm=1k∑tk)=pm−tm.WHY each collapse:∑ktkδkm=tm because δkm keeps only the k=m term; and ∑ktk=1 because a one-hot vector has exactly one 1. What remains is astonishingly clean:
∂zm∂L=pm−tm
Step D — from logits to weights.WHAT: we ultimately steer the weights wm, not the logits. WHY: since zm=wm⊤x, wiggling wm changes zm at a rate of x, so we multiply:
∂wm∂L=(pm−tm)x
The picture in words: "predicted minus true, times input." If the true class's slice is too small, pm−tm is negative there, and the update pushes wm to raise that class's logit next time.
Read it as flow: the input and per-class weights make logits; exp plus the sum (made safe by subtracting the max) make probabilities; probabilities plus the natural log and the one-hot truth make the loss; and the loss's partial derivative — helped by the Kronecker delta — is the clean (p−t)x that training uses.
Test yourself — hide the right side and answer aloud.
What does x∈Rd mean in plain words?
One example, described by a list of d real-number features; a single point in d-dimensional space.
What is K?
The number of classes / categories we sort examples into.
Feature slot vs. example index — how are they written?
Subscript x1 = feature slot; superscript-in-parens x(i) = which example.
What does wk⊤x compute, and why that operation?
The dot product — one number measuring how aligned the example is with class k's weight arrow (its projection); it's the natural "direction agreement" score.
What is a logit zk?
A raw, possibly-negative, unbounded score for class k; not yet a probability.
Why exponentiate the logits?
ez is always positive, always increasing, never zero, and smooth — exactly the properties needed to make valid, learnable probabilities.
Is e−5 positive or negative?
Positive (≈0.0067); the minus is in the exponent, not the result.
What does ∑j=1Kezj represent?
The total of all boosted scores — the whole pie we divide by.
Why divide each ezk by that sum?
To normalize so the K probabilities add up to exactly 1.
Why subtract maxkzk before exponentiating?
Shift-invariance makes the probabilities identical, but it caps the largest exponent at e0=1 so nothing overflows to infinity.
What does P(y=k∣x) read as?
The probability that the class is k, given the input x.
What is log in ML, its domain, and its sign on (0,1]?
The natural log (inverse of ez); domain is positive numbers only; on 0<p≤1 it lies in (−∞,0], equal to 0 exactly at p=1.
What is the one-hot vector t?
A length-K list, all zeros except a single 1 at the true class's slot.
Write the cross-entropy loss and its one-hot shortcut.
L=−∑ktklogpk=−logptrue.
What does the symbol ∂L/∂zm mean?
The partial derivative: how fast L changes when only zm is nudged, holding all other logits fixed — the slope of L in the zm direction.
Why does ∂logpk/∂zm simplify to δkm−pm?
The 1/pk from the log's derivative cancels the pk inside ∂pk/∂zm=pk(δkm−pm).
What is the softmax + cross-entropy gradient wrt logit m?
pm−tm ("predicted minus true").
What is δkm?
1 when k=m, else 0 — the Kronecker delta, used in the softmax derivative.