Skip to content
nonconvexcard

The softmax Jacobian is a covariance

ProofIntermediate⏱ 30 minFoundationssoftmaxjacobianvariancepsd

Problem

Let p=softmax⁡(z)p = \operatorname{softmax}(z) for z∈RKz \in \R^K. Prove that

∂p∂z=diag⁡(p)−pp⊤,\frac{\partial p}{\partial z} = \operatorname{diag}(p) - pp^\top,

that this matrix is positive semidefinite with (diag⁡(p)−pp⊤)1=0(\operatorname{diag}(p)-pp^\top)\mathbf 1 = 0, and that for any vv,

v⊤(diag⁡(p)−pp⊤)v=Var⁡i∼p(vi).v^\top\big(\operatorname{diag}(p)-pp^\top\big)v = \operatorname{Var}_{i\sim p}(v_i).

Deduce the rank of the Jacobian when pp has full support.

Write a complete argument. Every inequality you use should be one you could state precisely.

Hints

Hints — 0 of 3 revealed

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
The cross-entropy gradient is the prediction errorLLMsProofBeginner15 min
The Δ²/12 noise varianceQuantizationProofBeginner15 min
Tightness of the descent lemmaFoundationsProofBeginner15 min
All directional derivatives exist, yet the function is not differentiableFoundationsProofIntermediate30 min
Gradient magnitude through a deep chainDeep LearningProofIntermediate30 min