Towards Understanding the Word Sensitivity of Attention Layers: A Study via Random Features
Not on the map. Why?
Abstract (arXiv)
Understanding the reasons behind the exceptional success of transformers requires a better analysis of why attention layers are suitable for NLP tasks. In particular, such tasks require predictive models to capture contextual meaning which often depends on one or few words, even if the sentence is long. Our work studies this key property, dubbed word sensitivity (WS), in the prototypical setting of random features. We show that attention layers enjoy high WS, namely, there exists a vector in the space of embeddings that largely perturbs the random attention features map. The argument critically exploits the role of the softmax in the attention layer, highlighting its benefit compared to other activations (e.g., ReLU). In contrast, the WS of standard random features is of order 1/√n, n being the number of words in the textual sample, and thus it decays with the length of the context. We then translate these results on the word sensitivity into generalization bounds: due to their low WS, random features provably cannot learn to distinguish between two sentences that differ only in a single word; in contrast, due to their high WS, random attention features have higher generalization capabilities. We validate our theoretical results with experimental evidence over the BERT-Base word embeddings of the imdb review dataset.
Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 60 of its 71 references that are in the map. First posted on arXiv 5 Feb 2024.
Builds on
60 of 71 references.
References · 60
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2015Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classificationcited by 3,611
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,104
- 2018Neural Tangent Kernel: Convergence and Generalization in Neural Networkscited by 2,621
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,592
- 2018Spectral Normalization for Generative Adversarial Networkscited by 1,636
- 2019Wide Neural Networks of Any Depth Evolve as Linear Models Under Gradient Descentcited by 738
38 more
- 2017Spectrally-normalized margin bounds for neural networkscited by 686
- 2019Deep Double Descent: Where Bigger Models and More Data Hurtcited by 672
- 2019Benign Overfitting in Linear Regressioncited by 549
- 2018A Mean Field View of the Landscape of Two-Layers Neural Networkscited by 466
- 2018On the Global Convergence of Gradient Descent for Over-parameterized Models using Optimal Transportcited by 426
- 2019The generalization error of random features regression: Precise asymptotics and double descent curvecited by 413
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 406
- 2021Deep learning: a statistical viewpointcited by 240
- 2021Gradient-based Adversarial Attacks against Text Transformerscited by 234
- 2018Evaluating the Robustness of Neural Networks: An Extreme Value Theory Approachcited by 182
- 2020The Lipschitz Constant of Self-Attentioncited by 174
- 2022Neural Networks can Learn Representations with Gradient Descentcited by 161
- 2023Birth of a Transformer: A Memory Viewpointcited by 161
- 2019Linearized two-layers neural networks in high dimensioncited by 155
- 2021A Universal Law of Robustness via Isoperimetrycited by 151
- 2020When Do Neural Networks Outperform Kernel Methods?cited by 150
- 2022High-dimensional Asymptotics of Feature Learning: How One Gradient Step Improves the Representationcited by 150
- 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
- 2021Fit without fear: remarkable mathematical phenomena of deep learning through the prism of interpolationcited by 132
- 2023Unlimiformer: Long-Range Transformers with Unlimited Length Inputcited by 128
- 2017Universal Function Approximation by Deep Neural Nets with Bounded Width and ReLU Activationscited by 104
- 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 102
- 2017Structured Attention Networkscited by 95
- 2018Which Neural Net Architectures Give Rise To Exploding and Vanishing Gradients?cited by 94
- 2022Vision Transformers provably learn spatial structurecited by 93
- 2020Tight Bounds on the Smallest Eigenvalue of the Neural Tangent Kernel for Deep ReLU Networkscited by 87
- 2017A Random Matrix Approach to Neural Networkscited by 80
- 2020Do Wider Neural Networks Really Help Adversarial Robustness?cited by 79
- 2023A Theoretical Understanding of Shallow Vision Transformers: Learning, Generalization, and Sample Complexitycited by 77
- 2023Mimetic Initialization of Self-Attention Layerscited by 54
- 2023On the Role of Attention in Prompt-tuningcited by 50
- 2023A Theory of Non-Linear Feature Learning with One Gradient Step in Two-Layer Neural Networkscited by 49
- 2020Random Matrix Theory Proves that Deep Learning Representations of GAN-data Behave as Gaussian Mixturescited by 47
- 2023What can a Single Attention Layer Learn? A Study Through the Random Features Lenscited by 40
- 2022Almost-Orthogonal Layers for Efficient General-Purpose Lipschitz Networkscited by 39
- 2022Memorization and Optimization in Deep Neural Networks with Minimum Over-parameterizationcited by 36
- 2023Deterministic equivalent and error universality of deep random features learningcited by 35
- 2023Scaling Laws for Associative Memoriescited by 35
50 most cited of 60 All 60 (JSON)
Built on by
Citing papers per year: 2024: 3; 2025: 2.
5 papers.
- 2024IsoBench: Benchmarking Multimodal Foundation Models on Isomorphic Representationscited by 38
- 2024Mechanics of Next Token Prediction with Self-Attentioncited by 34
- 2024Transformers Learn Low Sensitivity Functions: Investigations and Implicationscited by 14
- 2025Dynamics of Spontaneous Topic Changes in Next Token Prediction with Self-Attentioncited by 2
- 2025Attention with Trained Embeddings Provably Selects Important Tokenscited by 1
- 2025Attention with Trained Embeddings Provably Selects Important Tokens22 May 2025
- 2025Dynamics of Spontaneous Topic Changes in Next Token Prediction with Self-Attention10 Jan 2025
- 2024IsoBench: Benchmarking Multimodal Foundation Models on Isomorphic Representations1 Apr 2024
- 2024Mechanics of Next Token Prediction with Self-Attention12 Mar 2024
- 2024Transformers Learn Low Sensitivity Functions: Investigations and Implications11 Mar 2024