Training Infinitely Deep and Wide Transformers

Raphaël Barboni, Maarten V. de Hoop, Takashi Furuya, Gabriel PeyréarXiv 2026

TL;DR

This paper establishes a rigorous mathematical framework for analyzing transformers of infinite depth and width using a dual "mean-field" approach. By modeling token evolution as a neural partial differential equation (PDE) rather than an ordinary differential equation (ODE), the authors prove that gradient-based training converges to a global minimum under a newly defined Neural Tangent Kernel (NTK) injectivity condition.

What Problem Does This Paper Address?

Despite the massive empirical success of transformers, our theoretical understanding of their training dynamics—especially for very deep and wide architectures—remains limited.

Previous theoretical work successfully modeled deep Residual Networks (ResNets) as continuous dynamical systems called Neural ODEs. In a Neural ODE, data points (tokens) travel through layers independently. However, this framework breaks down for transformers because the self-attention mechanism inherently couples tokens together.

To address this, the authors tackle the challenge of modeling training dynamics when both the depth (number of layers) and width (number of attention heads) approach infinity. They aim to answer a fundamental question: Under what conditions can we guarantee that gradient descent will successfully optimize an infinitely deep and wide transformer to its global minimum?

Methods

The authors construct a unified mathematical framework using several advanced techniques:

  • Dual Mean-Field Limit: The model operates in a continuous regime where network parameters are represented as a probability distribution over the parameter space (infinite width), and layers form a continuous spectrum from 0 to 1 (infinite depth). Crucially, they also treat the input tokens as a continuous distribution ("mean field over tokens").
  • From Neural ODEs to Neural PDEs: Because attention couples the trajectories of different tokens, the forward pass of a transformer is modeled as a Neural PDE (a continuity equation) rather than a standard Neural ODE.
  • Conditional Optimal Transport (COT): To define gradient descent on parameter distributions across continuous layers without allowing parameters at different depths to mix, the authors utilize a Conditional Wasserstein metric space.
  • Adjoint Sensitivity Analysis: They derive an explicit formula for the gradient of the training risk using backward-in-time ODEs, mimicking continuous backpropagation.
  • NTK Injectivity Characterization: To guarantee convergence, the authors analyze the Neural Tangent Kernel (NTK) of the attention mechanism. They prove that the injectivity (or positive definiteness) of this kernel is mathematically equivalent to the linear independence of log-sum-exp (cumulant generating) functions of the token distributions modulo affine functions.

Datasets

This is a purely theoretical paper, so no standard empirical datasets (like ImageNet or GLUE) were used for training or evaluation. Instead, the authors mathematically analyze generic, abstract token distributions to validate their theory, including:

  • Discrete i.i.d. token distributions
  • Uniform distributions on cubes
  • Symmetric multivariate Laplace distributions
  • Two-component Gaussian mixtures

Key Insights and Ideas

  • The Attention Coupling Effect: The defining feature of a transformer is that tokens do not evolve independently. This shifts the mathematical language needed to describe them from standard vector calculus (ODEs) to function spaces and measure theory (PDEs).
  • Log-Sum-Exp as a Convergence Gatekeeper: The most surprising technical insight is that the trainability of a transformer hinges on the geometric diversity of the input tokens. Specifically, if the log-sum-exp functions of the token distributions are linearly independent, the attention mechanism's feature map remains injective, preventing the optimization landscape from getting stuck.
  • FixUp Initialization Benefits: The math supports the use of "FixUp" style initializations (where the value projection matrix $V$ is initialized to zero), showing it simplifies the initial alignment and ensures well-behaved training trajectories.

Key Results

  • Well-Posedness: The authors prove that the forward pass (token evolution) and the backward pass (gradient flow) are mathematically well-posed, meaning unique solutions are guaranteed to exist.
  • Global Convergence Guarantee: Under the assumption of NTK injectivity, the authors prove Theorem 4: if the initial training loss is sufficiently small (a local convergence regime), the gradient flow converges to a global minimum at a linear rate: $$\mathcal{L}(\rho_t) \le \mathcal{L}(\rho_0) \exp(-CN^{-1}\lambda_0 t)$$ where $\lambda_0$ represents the conditioning of the kernel at initialization, and $N$ is the dataset size.

  • Absence of Spurious Minima: This geometric guarantee effectively eliminates bad local minima from the optimization landscape near a good initialization.

Limitations and Future Work

  • Encoder-Only Restriction: The current framework only applies to non-causal, encoder-style attention. Modeling decoder architectures (like GPT) introduces causal masking, which breaks the mathematical symmetries used in these proofs and presents a major technical hurdle.
  • Fixed Head Dimension Scaling: In practice, scaling up transformers often involves increasing the embedding dimension alongside the number of heads. This model keeps the head dimension fixed while letting the number of heads go to infinity.
  • Local Convergence Only: The global convergence proof requires the initial loss to be "sufficiently small," meaning it does not yet explain training dynamics starting from completely random, high-loss initializations.

Summary updated

BibTeX
@misc{barboni2026training,
  author = {Raphaël Barboni and Maarten V. de Hoop and Takashi Furuya and Gabriel Peyré},
  title = {{Training Infinitely Deep and Wide Transformers}},
  year = {2026},
  eprint = {2605.17660},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.17660},
}
Figure