Understanding Transformer Optimization via Gradient Heterogeneity
Akiyoshi Tomihari, Issei Sato
cs.LG, cs.AI, cs.NE
Submitted: 2026-08-17
Updated: 2026-08-19
Comments: TMLR 2026
License: http://creativecommons.org/licenses/by/4.0/
The gist: Transformers are difficult to optimize with stochastic gradient descent (SGD) and largely rely on adaptive optimizers such as Adam.
Terminology
Abstract
Transformers are difficult to optimize with stochastic gradient descent (SGD) and largely rely on adaptive optimizers such as Adam. Despite extensive efforts, the mechanisms behind Adam's advantage over SGD in Transformer optimization are still not fully understood. In this study, we analyze the optimization of Transformer models in the fine-tuning setting through the lens of gradient heterogeneity, defined as the variation in gradient norms across parameter blocks. We provide a theoretical analysis showing that gradient heterogeneity, together with Hessian heterogeneity, degrades the convergence of gradient-based methods such as SGD, while sign-based methods are substantially less sensitive to this effect. Adam and SignSGD both perform coordinate-wise updates and are less sensitive to the scale of individual gradient coordinates than SGD. This motivates our use of SignSGD as an analytically tractable proxy for Adam-like behavior. Our analysis uses the fact that SGD and SignSGD follow steepest descent directions under different norms, and derives upper bounds on the iteration complexity with implications for learning-rate scaling for SignSGD. We further investigate the origin of gradient heterogeneity in Transformer architectures and show that it is strongly influenced by the placement of layer normalization, with Post-LN architectures exhibiting particularly pronounced heterogeneity. Experimental results from fine-tuning Transformers in both NLP and vision domains validate our theoretical analysis.
Sources
- On Empirical Comparisons of Optimizers for Deep Learning
- The Geometry of Sign Gradient Descent
- What Does BERT Look At? An Analysis of BERT's Attention
- Longformer: The Long-Document Transformer
- Old Optimizer, New Norm: An Anthology
- Cherry on Top: Parameter Heterogeneity and Quantization in Large Language Models
- The Llama 3 Herd of Models
- DeepSeek-V3 Technical Report
- RoBERTa: A Robustly Optimized BERT Pretraining Approach
- Understanding Adam Requires Better Rotation Dependent Assumptions
- Mistral 7B
- Fine-Grained Visual Classification of Aircraft
- B2T Connection: Serving Stability and Performance in Deep Transformers
- Block-diagonal Hessian-free Optimization for Training Neural Networks
- On the representation of finite convex geometries with convex sets
Related papers
- Polynomial-Augmented Neural Networks (PANNs) with Weak Orthogonality Constraints for Enhanced Function and PDE Approximation
- AIRL-S: Unifying Reinforcement Learning and Search-Based Test-Time Scaling via Adversarial Inverse Reinforcement Learning
- Transformers as Bayesian In-Context Experimenters: Smoothness-Adaptive Efficient ATE Estimation
- Convergence issues in Relational Concept Analysis based on AOC-posets
- Beliefs Beyond Posteriors: The Predictive Cost of ELBO Binding
- Understanding Diffusion Models via Ratio-Based Function Approximation with SignReLU Networks