Infinite-Width Limit of a Single Attention Layer: Analysis via Tensor Programs
Mana Sakai, Ryo Karakida, Masaaki Imaizumi
TL;DR
This work establishes the infinite-width behavior of a single attention layer under realistic $1/\sqrt{n}$-scaling with finite heads, showing a non-Gaussian, hierarchical Gaussian limit driven by a random similarity score. Using the Tensor Programs framework, it derives limiting distributions for both Netsor-program variables and the dot-product scores, revealing that attention outputs are Gaussian conditional on the random scores, which themselves converge to Gaussians. The results reconcile finite-head attention with a precise non-Gaussian limit, and numerical experiments validate the theory at finite widths, including robustness to varying sequence lengths and activation functions. This analysis provides a foundational step toward a unified infinite-width theory of deep Transformer architectures, with potential implications for signal propagation, training dynamics, and feature learning in attention-based models.
Abstract
In modern theoretical analyses of neural networks, the infinite-width limit is often invoked to justify Gaussian approximations of neuron preactivations (e.g., via neural network Gaussian processes or Tensor Programs). However, these Gaussian-based asymptotic theories have so far been unable to capture the behavior of attention layers, except under special regimes such as infinitely many heads or tailored scaling schemes. In this paper, leveraging the Tensor Programs framework, we rigorously identify the infinite-width limit distribution of variables within a single attention layer under realistic architectural dimensionality and standard $1/\sqrt{n}$-scaling with $n$ dimensionality. We derive the exact form of this limit law without resorting to infinite-head approximations or tailored scalings, demonstrating that it departs fundamentally from Gaussianity. This limiting distribution exhibits non-Gaussianity from a hierarchical structure, being Gaussian conditional on the random similarity scores. Numerical experiments validate our theoretical predictions, confirming the effectiveness of our theory at finite width and accurate description of finite-head attentions. Beyond characterizing a standalone attention layer, our findings lay the groundwork for developing a unified theory of deep Transformer architectures in the infinite-width regime.
