Why attention divides by the square root of d_k
ProofIntermediate⏱ 30 minDeep Learningattentionscalingvariancesoftmax
Problem
Compute the mean and variance of for independent random with i.i.d. entries of variance . Deduce the scaling, and quantify the effect on the softmax at with and without it.
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| Solved | Problem | Field | Type | Difficulty | Time |
|---|---|---|---|---|---|
| Derive the attention crossover length | LLM Ops | Proof | 15 min | ||
| The cross-entropy gradient is the prediction error | LLMs | Proof | 15 min | ||
| The Δ²/12 noise variance | Quantization | Proof | 15 min | ||
| When does attention dominate the MLP? | Deep Learning | Numerical | 30 min | ||
| Attention is permutation equivariant | Deep Learning | Proof | 30 min |