[Paper Review] Infinite attention: NNGP and NTK for deep attention networks
This paper establishes that multi-head attention networks converge to Gaussian processes (NNGP) and exhibit neural tangent kernel (NTK) behavior in the infinite-width limit, resolving theoretical challenges posed by attention's non-Gaussian output in single-head settings. It introduces modified attention mechanisms and positional encoding strategies that improve performance for both finite and infinite-width models, achieving state-of-the-art results on CIFAR-10 using GP inference without data augmentation.
There is a growing amount of literature on the relationship between wide neural networks (NNs) and Gaussian processes (GPs), identifying an equivalence between the two for a variety of NN architectures. This equivalence enables, for instance, accurate approximation of the behaviour of wide Bayesian NNs without MCMC or variational approximations, or characterisation of the distribution of randomly initialised wide NNs optimised by gradient descent without ever running an optimiser. We provide a rigorous extension of these results to NNs involving attention layers, showing that unlike single-head attention, which induces non-Gaussian behaviour, multi-head attention architectures behave as GPs as the number of heads tends to infinity. We further discuss the effects of positional encodings and layer normalisation, and propose modifications of the attention mechanism which lead to improved results for both finite and infinitely wide NNs. We evaluate attention kernels empirically, leading to a moderate improvement upon the previous state-of-the-art on CIFAR-10 for GPs without trainable kernels and advanced data preprocessing. Finally, we introduce new features to the Neural Tangents library (Novak et al., 2020) allowing applications of NNGP/NTK models, with and without attention, to variable-length sequences, with an example on the IMDb reviews dataset.
Motivation & Objective
- To rigorously characterize the infinite-width limit of deep neural networks with multi-head attention mechanisms.
- To resolve theoretical challenges in extending Gaussian process and neural tangent kernel frameworks to attention layers, which do not satisfy standard exchangeability or conditioning assumptions.
- To propose modified attention mechanisms and positional encoding strategies that enhance performance in both finite and infinite-width networks.
- To empirically evaluate the proposed attention kernels and demonstrate improved performance on benchmark datasets like CIFAR-10 using GP inference.
- To extend the Neural Tangents library with support for variable-length sequences, enabling NNGP/NTK applications to sequential data such as text.
Proposed method
- Derives the NNGP and NTK kernels for multi-head attention networks under both $d^{-1/2}$ and $d^{-1}$ scaling, showing convergence to Gaussian processes in the infinite-width limit.
- Introduces a modified attention mechanism with $d^{-1}$ scaling and interpolation-based covariance updates to preserve expressivity while enabling theoretical analysis.
- Proposes structured positional encodings that improve generalization and performance in the infinite-width regime, even when combined with NNGP/NTK inference.
- Adapts the theoretical framework to handle residual connections and layer normalization, showing their effects on kernel convergence and model behavior.
- Introduces a new kernel update rule that incorporates gradient contributions from learnable positional embeddings, modifying the NTK via a hybrid interpolation mechanism.
- Releases code extensions to the Neural Tangents library to support variable-length sequences, enabling end-to-end NNGP/NTK inference on datasets like IMDb.
Experimental results
Research questions
- RQ1Does multi-head attention in wide neural networks converge to a Gaussian process in the infinite-width limit, and if so, under what conditions?
- RQ2Why do standard NNGP and NTK derivation techniques fail for single-head attention, and how can they be adapted for multi-head architectures?
- RQ3How do positional encodings and layer normalization affect the kernel behavior and generalization performance in infinite-width attention networks?
- RQ4Can modified attention mechanisms with $d^{-1}$ scaling preserve model expressivity while enabling rigorous NNGP/NTK analysis?
- RQ5What performance gains can be achieved by applying the derived NNGP and NTK kernels to real-world benchmarks like CIFAR-10 without data augmentation?
Key findings
- Multi-head attention networks converge to Gaussian processes in the infinite-width limit, while single-head attention does not, due to statistical dependence induced by shared attention weights.
- The paper provides a rigorous derivation of NNGP and NTK kernels for multi-head attention, valid under both $d^{-1/2}$ and $d^{-1}$ scaling, extending theoretical frameworks to attention mechanisms.
- Modified attention mechanisms with $d^{-1}$ scaling and interpolation-based covariance updates preserve model expressivity and enable stable kernel convergence, avoiding the pooling-like behavior seen in prior approaches.
- Positional encodings significantly improve empirical performance in the infinite-width limit, even when the model is not trained, demonstrating their role in enhancing generalization.
- The proposed method achieves a moderate improvement over the previous state-of-the-art on CIFAR-10 using GP inference without data augmentation or advanced preprocessing.
- The authors release code extensions to the Neural Tangents library that support variable-length sequences, enabling NNGP/NTK inference on sequential data such as text, with a demonstrated example on the IMDb dataset.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.