Skip to content
nonconvexcard

The softmax Jacobian as a variance, and saturation

ProofIntermediate⏱ 30 minDeep Learningsoftmaxjacobiansaturationgradient

Problem

Prove v⊤(diag⁡(a)−aa⊤)v=Var⁡j∼a(vj)v^\top(\diag(a)-aa^\top)v = \Var_{j\sim a}(v_j) and deduce that the softmax Jacobian's operator norm is at most max⁡jaj(1−aj)≤1/4\max_ja_j(1-a_j)\le1/4, vanishing as aa becomes one-hot. Relate to temperature and to attention saturation.

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

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
When does attention dominate the MLP?Deep LearningNumericalBeginner30 min
Attention is permutation equivariantDeep LearningProofIntermediate30 min
Gradient magnitude through a deep chainDeep LearningProofIntermediate30 min
Implement multi-head attention from scratch runDeep LearningCodingIntermediate3 hours