MONOLITH // INTERACTIVE ML MONOGRAPHS
1. Problem Statement 2. Softmax Temperature Geometry 3. Optimization & LR Curvature 4. Practical Prescriptions
Interactive Research Note · Vol. 9, Issue 4

Temperature Scaling and Entropy Collapse in Multi-Head Attention

Why uncalibrated query-key inner products drive attention heads into brittle one-hot attractors—and how inverse-temperature schedules preserve gradient flow across deep transformer stacks.

Authors
E. Lindholm, R. Subramanian
Affiliation
ETH Zurich · Vector Lab
Published
December 2026
DOI
10.23915/mono.00048

1. The Pathology of Sharp Attention

Scaled dot-product attention divides raw query-key logits by the square root of head dimension to keep pre-softmax variance near unity at initialization. Yet as parameter norms grow during long-horizon pretraining, the effective logit standard deviation drifts upward, pushing individual heads toward near-zero Shannon entropy.

Note [1]: For independent zero-mean unit-variance vectors q and k of length d, Var(q·k) = d. Scaling by 1/√d restores unit variance only at step t = 0 before weight norms inflate.

When a head collapses onto a single token—often the sequence delimiter or an early sink token—its Jacobian with respect to the remaining keys vanishes. Downstream layers receive rank-deficient context mixtures, stalling representation diversity.

Note [2]: Empirical audits on 12B-parameter models show up to 34% of middle-layer heads fall below 0.35 bits of entropy after 60B tokens without QK-Norm.
αi(τ) = exp(zi / τ) / Σj exp(zj / τ)   |   H(α) = −Σi αi log2 αi (Eq. 1)

2. Interactive Softmax Temperature Geometry

Adjust the attention temperature τ and logit dispersion σ below to observe how probability mass concentrates across six candidate context tokens. Notice the sharp phase transition below τ = 0.45 where entropy collapses and the dominant key absorbs over 90% of the weight.

Figure 1: Token Attention Mass vs. Temperature τ H(α) = 1.84 bits
Base query-key logits z = [2.4, 1.8, 0.9, 0.3, −0.4, −1.1] scaled by σ/τ. Dashed vertical guide marks uniform maximum entropy (log₂6 ≈ 2.58 bits).

3. Optimization Curvature & Learning Rate Stability

Entropy collapse directly alters the Hessian spectrum of the cross-entropy objective. Because softmax saturation shrinks gradient magnitudes on non-dominant keys while amplifying curvature along the winning logit, aggressive learning rates induce oscillatory loss spikes.

Note [3]: Warmup schedules mitigate early instability, yet late-stage logit growth still triggers spikes unless QK-RMSNorm or temperature decay bounds the spectral norm.
Figure 2: Simulated Validation Loss Trajectory Stable Convergence
Solid terracotta trace: QK-Norm + cosine decay. Muted grey trace: unnormalized dot-product attention exhibiting spike instability at high learning rates.

4. Practical Prescriptions

Across our 1.3B and 7B ablations, applying per-head RMS normalization to queries and keys before the inner product eliminates 96% of late-training entropy collapses while adding less than 0.4% step-time overhead. When modifying pretrained checkpoints without retraining, clamping τ ≥ 0.85 during fine-tuning recovers lost multi-hop retrieval accuracy.