TL;DR: This paper bridges the gap between the theoretical "infinite width" limit of neural networks and modern attention mechanisms. The authors prove that while single-head attention behaves unpredictably in the infinite limit, multi-head attention architectures converge to Gaussian Processes (GPs) as the number of heads approaches infinity. This breakthrough allows researchers to derive exact Neural Network Gaussian Process (NNGP) and Neural Tangent Kernels (NTK) for Transformers.
The Challenge of Infinite Attention
In recent years, researchers have discovered that as neural networks become infinitely wide, they simplify into a well-understood mathematical object: a Gaussian Process. This equivalence allows us to study the "ideal" version of an architecture analytically, without worrying about specific random initializations or the noise introduced by Stochastic Gradient Descent (SGD).
However, attention layers—the core components of Transformers—have historically resisted this theoretical treatment. Standard proof techniques fail because the spatial dimension (the number of tokens) remains fixed while the embedding dimension grows. This causes the attention weights to remain "stochastic" (random) even in the infinite limit, preventing the output from settling into a simple Gaussian distribution. Previous attempts to fix this relied on a scaling factor that forced attention to act like a basic average-pooling layer, stripping away its representational power.
Theoretical Insights and Methods
To overcome this, the authors analyze the asymptotic behavior of attention under different scaling regimes, leading to several key insights:
Multi-Head Convergence and the "Stochastic Matrix" Problem
In a single-head wide network, the attention matrix doesn't settle into a fixed value; it remains a random variable. This is why single-head attention isn't "Gaussian" in the limit. The authors prove that if you increase the number of heads to infinity (rather than just the embedding dimension), the law of large numbers kicks in. The randomness averages out, and the layer output successfully converges to a Gaussian distribution.
Expressivity vs. Theory
The authors show that the previously proposed $d^{-1}$ scaling is theoretically convenient but practically weak—it cannot even represent a simple convolution. By contrast, their $d^{-1/2}$ scaling (the standard scaling used in practical Transformers) is more expressive and can successfully recover convolutional kernels.
Kernel Derivation and Softmax Alternatives
With the multi-head convergence proven, they derive the NNGP and NTK formulations for these "infinite" attention layers. Because the standard Softmax integral is analytically intractable (impossible to solve exactly for a kernel), they propose using Identity or ReLU functions as proxies for the attention mechanism.
Structured Positional Encodings
Without positional information, an infinite attention layer degrades into a simple "bag of words" model. To fix this, the authors introduce a method to inject spatial information (like the distance between pixels or words) directly into the kernel covariance matrix. This "Structured Positional Encoding" mimics how finite Transformers use positional embeddings to understand sequence order.
Key Results and Benchmarks
The researchers extended the neural-tangents library to handle variable-length sequences and evaluated their kernels on two primary benchmarks:
- CIFAR-10 (Image Classification): Their "Residual" attention kernel achieved 80.72% accuracy (NNGP). This represents a moderate improvement over the previous state-of-the-art for Gaussian Processes without trainable kernels or data augmentation, proving its viability against CNN baselines.
- IMDb (Text Sentiment): On this variable-length text dataset, the "Struct" kernel achieved 86.09%, outperforming simple global average pooling (84.98%). This demonstrates that the attention mechanism provides a useful inductive bias even in the infinite limit.
- Layer Normalization: Empirical tests showed that following attention with Layer Normalization significantly boosts performance for both finite and infinite networks.
Limitations and Future Work
While a significant theoretical step forward, the approach has limitations:
- The Softmax Gap: Because the Softmax kernel is analytically intractable, the authors primarily used the Identity function for their infinite-width experiments. While effective, it doesn't perfectly capture the "competition" between tokens that Softmax naturally creates.
- Computational Cost: Like all kernel methods, the memory cost scales quadratically with the number of data points. This makes it difficult to scale to massive datasets without further approximations.
- Performance vs. Finite Models: These kernels set new records for GP models, but they still lag behind the performance of heavily optimized, finite-width Transformers (like BERT or ViT) trained with SGD.
The authors suggest that exploring the "feature learning" regime—where the kernel is allowed to change during training—is a vital next step to close the gap between infinite-width theory and practical Transformer performance.
Summary updated