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 V. Grabovoy · DOI

Introduction

While Transformers have become the backbone of modern AI, our theoretical understanding of their "optimization landscape"—the mathematical terrain the model navigates during training—has remained incomplete. Previous research successfully mapped the curvature of self-attention mechanisms, but a standard Transformer block also contains Layer Normalization and Feed-Forward Networks (FFNs). These components are not just utility layers; they fundamentally change how gradients flow and how the model converges.

This paper fills this "curvature gap" by providing the first complete theoretical characterization of the Hessian (second-order derivatives) for a full Transformer block. By deriving these explicit expressions, the authors offer a rigorous mathematical foundation for why Transformer loss landscapes stabilize as datasets grow, providing a mechanistic explanation for neural scaling laws.

Methodology: Mapping the Full Transformer Block

The authors employ advanced matrix calculus and row-wise vectorization to derive the first-ever explicit second-order expressions for Layer Normalization and FFNs. By assembling these pieces into a block-wise decomposition, they can analyze how different sublayers interact within a complete Transformer layer.

Loss landscape convergence and Hessian-based Transformer analysis.

To study convergence, the authors utilize a second-order Taylor approximation of the loss function. This framework allows them to quantify how much the loss landscape "shifts" when moving from a dataset of size $k$ to $k+1$. Furthermore, they establish rigorous spectral norm bounds on the Hessian, which serve as a proxy for the "sharpness" or "flatness" of the optimization terrain.

Key Insights: Landscape Stabilization and Scaling Laws

A central finding of the work is the formal link between optimization geometry and empirical scaling laws. The paper proves that as the number of training samples ($k$) increases, the loss landscape becomes increasingly stable. Specifically, the difference in loss between consecutive dataset sizes decays at a rate of $1/k$.

The authors established the convergence inequality: $$|L_{k+1}(w) - L_k(w)| \leq \frac{2L}{k+1} + \frac{M\|w-w^*\|^2}{k+1}$$ This formula predicts that the loss landscape stabilizes linearly as more data is added. This $1/k$ decay suggests that "compute-optimal" training is not merely an empirical observation but a direct consequence of how curvature propagates through the Transformer architecture.

Empirical Results and Hessian Structure

To validate their theoretical proofs, the authors conducted experiments using MNIST for high-resolution visualization and CIFAR-100 to train Vision Transformer (ViT) models.

One of the most striking findings is the heterogeneity of the Hessian. Heatmaps of the exact Hessian (calculated via the curvlinops package) confirmed that the "Values-Values" and "Keys-Keys" blocks in the attention mechanism exhibit significantly higher magnitudes than other parameters.

Hessian heatmaps showing the logarithmic absolute entries for the full block and self-attention components.

This suggests the model's loss is most sensitive to changes in these specific weights. Additionally, the authors show that Layer Normalization acts as a stabilizer, contributing to curvature primarily through per-row variance and preventing the Hessian from exploding.

Limitations and Future Directions

While this work provides a foundational step, several areas remain for future exploration:

  • Multi-Head Attention: The current derivation focuses on single-head attention. Extending this to multi-head setups adds significant complexity.
  • Pre-Norm Architectures: The analysis is tailored to "post-norm" Transformers. Given the industry shift toward "pre-norm" designs, a comparative analysis would be valuable.
  • Deep Stacks: This work focuses on a single Transformer block. Understanding how these Hessian structures compound across 100+ layers is a critical next step.

The results provide a robust theoretical anchor for the field, moving from empirical observations of scaling to a mechanistic understanding of Transformer optimization.

Summary updated

BibTeX
@misc{petrov2025closing,
  author = {Egor Petrov and Nikita Kiselev and Vladislav Meshkov and Andrey V. 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