NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Closing the Curvature Gap: Full Transformer Hessians and Their Implications for Scaling Laws

Egor Petrov, Nikita Kiselev, Vladislav Meshkov, Andrey Grabovoy · Submission to ICLR 2026 · Desk rejected

TL;DR

While prior theoretical analyses of Transformer loss geometry only solved the curvature for attention layers, this paper derives the first explicit Hessian (second-order derivatives) for the entire Transformer block—incorporating LayerNorm and Feed-Forward Networks (FFNs). Using these expressions, the authors establish spectral norm bounds on network curvature and prove that the loss landscape stabilizes at an $O(1/k)$ rate as dataset size $k$ grows.

What Problem Does This Paper Address?

Understanding the loss landscape geometry—specifically via the Hessian (the matrix of second partial derivatives)—is essential for diagnosing optimization bottlenecks, vanishing gradients, learning rate selection, and scaling laws.

However, existing second-order analyses of Transformers suffered from a major blind spot: they only characterized self-attention in isolation. Non-linear, pervasive components like Layer Normalization (LayerNorm) and Feed-Forward Networks (FFNs) were left out because their matrix calculus is notoriously intricate. Without them, theoretical curvature models failed to capture how the full block behaves during training and how increasing dataset size geometrically stabilizes the loss surface.

Methods

The authors tackle the calculus of the complete Transformer block using row-wise vectorization ($\text{vec}_r$) and Kronecker matrix calculus:

  • Explicit LayerNorm & FFN Curvature: The paper derives closed-form Jacobians and Hessians for LayerNorm (accounting for mean and row-variance normalization) and ReLU-based FFNs (noting that the second derivative of ReLU vanishes almost everywhere).
  • Full Block-Level Assembly: Using a Gauss-Newton-style decomposition, the authors separate the full block Hessian into outer-product (Gauss-Newton) and functional Hessian terms across all weight interactions ($W_Q, W_K, W_V, W_1, W_2$).
  • Spectral Norm Bounds: They establish explicit upper bounds on the spectral norm ($\|\mathbf{H}\|_2$) of both self-attention layers and complete Transformer blocks in terms of sequence length $L$, feature dimensions ($d_V, d_K, d_{ff}$), and parameter norms.
  • Landscape Convergence Framework: Applying a second-order Taylor expansion around an optimal parameter point $w^*$, the authors bound the absolute loss discrepancy between consecutive sample sizes $|L_{k+1}(w) - L_k(w)|$, demonstrating that the empirical loss surface stabilizes at a rate bounded by $\frac{2L + M\|w - w^*\|_2^2}{k + 1}$.

Datasets

The authors validate their theoretical predictions using standard computer vision benchmarks:

  • MNIST: Used to train a single-block Vision Transformer (ViT) to compute and visualize exact, entry-by-entry Hessian matrices (using the curvlinops library).
  • CIFAR-100: Used to train an 8-block, wider ViT to test loss landscape convergence across dataset sizes ranging from $10^3$ to $10^6$ samples.
  • No new benchmarks were introduced.

Key Insights and Ideas

  • Extreme Curvature Heterogeneity: The Hessian of a Transformer block is deeply non-uniform. Value ($W_V$) and Key ($W_K$) parameters exhibit the highest magnitudes and dominate the curvature spectrum due to softmax interactions, whereas FFN blocks exhibit relatively mild curvature because piecewise-linear activations have zero second-order derivatives almost everywhere.
  • LayerNorm's Role in Curvature: LayerNorm contributes curvature primarily through the inverse of the per-row feature variances ($\sigma_{\min}^{-3}$ and $\sigma_{\min}^{-5}$), meaning feature collapse or low variance sharply amplifies local curvature.
  • Theoretical Basis for Landscape Stabilization: The discrepancy between successive empirical loss surfaces shrinks as $O(1/k)$. This formalizes why training landscapes smooth out and become predictable under large-scale data regimes, offering a geometric perspective on empirical neural scaling laws.

Key Results

  • Hessian Entry Visualization: On MNIST, empirical Hessian logs revealed orders-of-magnitude differences across blocks, with the Value-Value sub-block exhibiting the highest curvature (spanning log-scale differences up to $10^6$ relative to smaller blocks).
  • Norm Bounds Validation: Parameter and Hessian norm tracking across 1,000 training steps confirmed that Key and Value matrix Hessians grew significantly faster than those of LayerNorm and FFN layers.
  • $k^{-1}$ Empirical Scaling: On CIFAR-100, tracking $|L_{k+1}(w) - L_k(w)|$ from $k = 10^3$ to $10^6$ samples demonstrated a clean linear slope on a log-log plot matching the theoretical $k^{-1}$ decay trend.

Limitations and Future Work

  • Local Minimizer Assumption: The convergence proof relies on Assumption 1 (that consecutive empirical objectives $L_k$ and $L_{k+1}$ share an identical local minimum $w^*$). While the authors show gradient norms decrease empirically at large $k$, this assumption rarely holds strictly in non-convex optimization.
  • Architectural Scope: The closed-form analytical derivations are structured around a single-head, post-LN Transformer block using Mean Squared Error (MSE) loss; multi-head attention, positional embeddings, and attention masking are omitted from the formal proofs for algebraic brevity.
  • Future Directions: Extending the block-level derivations to deep, multi-layer stacked Transformers and analyzing how curvature propagates across dozens of cascaded residual blocks.

Summary updated

BibTeX
@misc{petrov2025closing,
  author = {Egor Petrov and Nikita Kiselev and Vladislav Meshkov and Andrey Grabovoy},
  title = {{Closing the Curvature Gap: Full Transformer Hessians and Their Implications for Scaling Laws}},
  year = {2025},
  eprint = {2510.16927},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.16927},
}
Figure