On the Role of Attention Masks and LayerNorm in Transformers
Not on the map. Why?
Abstract (arXiv)
Self-attention is the key mechanism of transformers, which are the essential building blocks of modern foundation models. Recent studies have shown that pure self-attention suffers from an increasing degree of rank collapse as depth increases, limiting model expressivity and further utilization of model depth. The existing literature on rank collapse, however, has mostly overlooked other critical components in transformers that may alleviate the rank collapse issue. In this paper, we provide a general analysis of rank collapse under self-attention, taking into account the effects of attention masks and layer normalization (LayerNorm). In particular, we find that although pure masked attention still suffers from exponential collapse to a rank one subspace, sparse or local masked attention can provably slow down the collapse rate. In the case of self-attention with LayerNorm, we first show that for certain classes of value matrices, collapse to a rank one subspace still happens exponentially. However, through construction of nontrivial counterexamples, we then establish that with proper choice of value matrices, a general class of sequences may not converge to a rank one subspace, and the self-attention dynamics with LayerNorm can simultaneously possess a rich set of equilibria with any possible rank between one and full. Our result refutes the previous hypothesis that LayerNorm plays no role in the rank collapse of self-attention and suggests that self-attention with LayerNorm constitutes a much more expressive, versatile nonlinear dynamical system than what was originally thought.
Key facts. Cited by 48 papers in the map (data through 14 Oct 2026). Builds on 35 of its 41 references that are in the map. First posted on arXiv 29 May 2024.
Builds on
35 of 41 references.
References · 35
- 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
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
- 2016Layer Normalizationcited by 5,669
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,790
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
- 2020Big Bird: Transformers for Longer Sequencescited by 1,684
- 2019Generating Long Sequences with Sparse Transformerscited by 1,546
23 more
- 2020On Layer Normalization in the Transformer Architecturecited by 922
- 2019How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddingscited by 784
- 2020Efficient Content-Based Sparse Attention with Routing Transformerscited by 471
- 2021Attention is Not All You Need: Pure Attention Loses Rank Doubly Exponentially with Depthcited by 419
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 406
- 2019Representation Degeneration Problem in Training Natural Language Generation Modelscited by 255
- 2022Neighborhood Attention Transformercited by 239
- 2022Recurrent Memory Transformercited by 203
- 2023A mathematical perspective on Transformerscited by 164
- 2022Signal Propagation in Transformers: Theoretical Perspectives and the Role of Rank Collapsecited by 141
- 2023The emergence of clusters in self-attention dynamicscited by 140
- 2023Fast Attention Requires Bounded Entriescited by 102
- 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 102
- 2023Scaling Transformer to 1M tokens and beyond with RMTcited by 98
- 2020O(n) Connections are Expressive Enough: Universal Approximability of Sparse Transformerscited by 83
- 2022Revisiting Over-smoothing in BERT from the Perspective of Graphcited by 72
- 2024Anisotropy Is Inherent to Self-Attention in Transformerscited by 63
- 2023Demystifying Oversmoothing in Attention-Based Graph Neural Networkscited by 49
- 2023Deep Transformers without Shortcuts: Modifying Self-attention for Faithful Signal Propagationcited by 45
- 2023Slide-Transformer: Hierarchical Vision Transformer with Local Self-Attentioncited by 38
- 2023On the Expressivity Role of LayerNorm in Transformers' Attentioncited by 33
- 2024TransformerFAM: Feedback attention is working memorycited by 22
- 2023On the impact of activation and normalization in obtaining isometric embeddings at initializationcited by 13
Built on by
Citing papers per year: 2024: 9; 2025: 17; 2026: 22.
48 papers.
Sort:
By area:
- 2025Why do LLMs attend to the first token?cited by 127
- 2025On the Emergence of Position Bias in Transformerscited by 59
- 2025Attention Sinks and Compression Valleys in LLMs are Two Sides of the Same Coincited by 52
- 2024Dynamic metastability in the self-attention modelcited by 46
- 2025Hallucination Detection in LLMs Using Spectral Features of Attention Mapscited by 43
- 2024Measure-to-measure interpolation using Transformerscited by 29
- 2024Understanding and Mitigating Bottlenecks of State Space Models through the Lens of Recency and Over-smoothingcited by 18
- 2024The Asymptotic Behavior of Attention in Transformerscited by 16
- 2025Pay Attention to Attention Distribution: A New Local Lipschitz Bound for Transformerscited by 11
- 2025All You Need is One: Capsule Prompt Tuning with a Single Vectorcited by 8
- 2025Optimizing Rank for High-Fidelity Implicit Neural Representationscited by 8
- 2024Transformer Normalisation Layers and the Independence of Semantic Subspacescited by 6
36 more
- 2025Attention-Only Transformers via Unrolled Subspace Denoisingcited by 5
- 2025Rethinking Layer-wise Model Merging through Chain of Mergescited by 5
- 2025DoPE: Denoising Rotary Position Embeddingcited by 5
- 2024Lambda-Skip Connections: the architectural component that prevents Rank Collapsecited by 4
- 2026Revisiting [CLS] and Patch Token Interaction in Vision Transformerscited by 4
- 2026Attention Drift: What Autoregressive Speculative Decoding Models Learncited by 4
- 2024ReLU's Revival: On the Entropic Overload in Normalization-Free Large Language Modelscited by 3
- 2024AERO: Entropy-Guided Framework for Private LLM Inferencecited by 3
- 2026NerVE: Nonlinear Eigenspectrum Dynamics in LLM Feed-Forward Networkscited by 3
- 2025MODA: MOdular Duplex Attention for Multimodal Perception, Cognition, and Emotion Understandingcited by 2
- 2026Stochastic Parroting in Temporal Attention -- Regulating the Diagonal Sinkcited by 2
- 2026How Data Shapes RoPE Frequency Usage: From Positional Scale Matching to Length Generalizationcited by 2
- 2026Transforming Rank: How Architecture Navigates the Spectral Pathologies of Depthcited by 2
- 2024Provable optimal transport with transformers: The essence of depth and prompt engineeringcited by 1
- 2025TTrace: Lightweight Error Checking and Diagnosis for Distributed Trainingcited by 1
- 2025Understanding the Failure Modes of Transformers through the Lens of Graph Neural Networkscited by 1
- 2025Memory as Resonance: A Biomimetic Architecture for Infinite Context Memory on Ergodic Phonetic Manifoldscited by 1
- 2026Rank, Head-Channel Non-Identifiability, and Symmetry Breaking: A Precise Analysis of Representational Collapse in Transformerscited by 1
- 2026Sink vs. diagonal patterns as mechanisms for attention switch and oversmoothing preventioncited by 1
- 2025SSL-SLR: Self-Supervised Representation Learning for Sign Language Recognitioncited by 0
- 2025Reversal Invariance in Autoregressive Language Modelscited by 0
- 2025How Smoothing is N-simplicial Attention?cited by 0
- 2026On the Runway Cascade of Transformers for Language Modelingcited by 0
- 2026RefineFormer3D: Efficient 3D Medical Image Segmentation via Adaptive Multi-Scale Transformer with Cross Attention Fusioncited by 0
- 2026PeakFocus: Bridging Peak Localization and Intensity Regression via a Unified Multi-Scale Framework for Electricity Load Forecastingcited by 0
- 2026Analogies between Transformer Layers and Power Methodcited by 0
- 2026Anti Mode-Collapse in Mean-Field Transformer via Auxiliary Variablescited by 0
- 2026Activation-Based Active Learning for In-Context Learning: Challenges and Insightscited by 0
- 2026A Unifying View of Attention Sinks: From Mechanisms to Architectural Interventionscited by 0
- 2026From Self-Attention to Connection Laplacian: A Unified Operator View of Transformerscited by 0
- 2026The Devil is in the Spectrum: Mitigating Representation Collapse in LLMs via Topologically Regularized Side-Pathcited by 0
- 2026Self-Attention Dynamics with Rotary Position Embeddings: Twisted States and Explicit Consensus Rates on the Spherecited by 0
- 2026Why Post-Norm Transformers Collapse: Attention Amplification and Gradient Repair Failurecited by 0
- 2026Linear Algebra Foundations of Efficient Attention: A Phase Reversal in Rank Collapse Under SVD Compressioncited by 0
- 2026Training and Inference Dynamics of PLDR-LLMs: Row-Map Collapse, Renormalization, and Predictive Reductioncited by 0
- 2026Asymptotic Analysis of Discrete-Time Self-Attention Dynamics in Transformerscited by 0
- 2026Asymptotic Analysis of Discrete-Time Self-Attention Dynamics in Transformers9 Oct 2026
- 2026Training and Inference Dynamics of PLDR-LLMs: Row-Map Collapse, Renormalization, and Predictive Reduction28 Sep 2026
- 2026Linear Algebra Foundations of Efficient Attention: A Phase Reversal in Rank Collapse Under SVD Compression6 Sep 2026
- 2026Why Post-Norm Transformers Collapse: Attention Amplification and Gradient Repair Failure10 Aug 2026
- 2026Self-Attention Dynamics with Rotary Position Embeddings: Twisted States and Explicit Consensus Rates on the Sphere27 Jul 2026
- 2026Transforming Rank: How Architecture Navigates the Spectral Pathologies of Depth15 Jul 2026
- 2026From Self-Attention to Connection Laplacian: A Unified Operator View of Transformers12 Jul 2026
- 2026How Data Shapes RoPE Frequency Usage: From Positional Scale Matching to Length Generalization8 Jul 2026
- 2026A Unifying View of Attention Sinks: From Mechanisms to Architectural Interventions6 Jun 2026
- 2026Activation-Based Active Learning for In-Context Learning: Challenges and Insights3 Jun 2026
- 2026The Devil is in the Spectrum: Mitigating Representation Collapse in LLMs via Topologically Regularized Side-Path2 Jun 2026
- 2026Anti Mode-Collapse in Mean-Field Transformer via Auxiliary Variables28 May 2026
36 more
- 2026Analogies between Transformer Layers and Power Method25 May 2026
- 2026PeakFocus: Bridging Peak Localization and Intensity Regression via a Unified Multi-Scale Framework for Electricity Load Forecasting20 May 2026
- 2026Attention Drift: What Autoregressive Speculative Decoding Models Learn11 May 2026
- 2026Sink vs. diagonal patterns as mechanisms for attention switch and oversmoothing prevention8 May 2026
- 2026Rank, Head-Channel Non-Identifiability, and Symmetry Breaking: A Precise Analysis of Representational Collapse in Transformers26 Apr 2026
- 2026NerVE: Nonlinear Eigenspectrum Dynamics in LLM Feed-Forward Networks6 Mar 2026
- 2026RefineFormer3D: Efficient 3D Medical Image Segmentation via Adaptive Multi-Scale Transformer with Cross Attention Fusion18 Feb 2026
- 2026Stochastic Parroting in Temporal Attention -- Regulating the Diagonal Sink11 Feb 2026
- 2026Revisiting [CLS] and Patch Token Interaction in Vision Transformers9 Feb 2026
- 2026On the Runway Cascade of Transformers for Language Modeling20 Jan 2026
- 2025Memory as Resonance: A Biomimetic Architecture for Infinite Context Memory on Ergodic Phonetic Manifolds23 Dec 2025
- 2025How Smoothing is N-simplicial Attention?17 Dec 2025
- 2025Optimizing Rank for High-Fidelity Implicit Neural Representations16 Dec 2025
- 2025Understanding the Failure Modes of Transformers through the Lens of Graph Neural Networks9 Dec 2025
- 2025DoPE: Denoising Rotary Position Embedding12 Nov 2025
- 2025Reversal Invariance in Autoregressive Language Models1 Nov 2025
- 2025All You Need is One: Capsule Prompt Tuning with a Single Vector19 Oct 2025
- 2025Attention Sinks and Compression Valleys in LLMs are Two Sides of the Same Coin7 Oct 2025
- 2025SSL-SLR: Self-Supervised Representation Learning for Sign Language Recognition5 Sep 2025
- 2025Rethinking Layer-wise Model Merging through Chain of Merges29 Aug 2025
- 2025Pay Attention to Attention Distribution: A New Local Lipschitz Bound for Transformers10 Jul 2025
- 2025MODA: MOdular Duplex Attention for Multimodal Perception, Cognition, and Emotion Understanding7 Jul 2025
- 2025TTrace: Lightweight Error Checking and Diagnosis for Distributed Training10 Jun 2025
- 2025Attention-Only Transformers via Unrolled Subspace Denoising4 Jun 2025
- 2025Why do LLMs attend to the first token?3 Apr 2025
- 2025Hallucination Detection in LLMs Using Spectral Features of Attention Maps24 Feb 2025
- 2025On the Emergence of Position Bias in Transformers4 Feb 2025
- 2024Understanding and Mitigating Bottlenecks of State Space Models through the Lens of Recency and Over-smoothing31 Dec 2024
- 2024The Asymptotic Behavior of Attention in Transformers3 Dec 2024
- 2024Measure-to-measure interpolation using Transformers7 Nov 2024
- 2024Provable optimal transport with transformers: The essence of depth and prompt engineering25 Oct 2024
- 2024AERO: Entropy-Guided Framework for Private LLM Inference16 Oct 2024
- 2024Lambda-Skip Connections: the architectural component that prevents Rank Collapse14 Oct 2024
- 2024ReLU's Revival: On the Entropic Overload in Normalization-Free Large Language Models12 Oct 2024
- 2024Dynamic metastability in the self-attention model9 Oct 2024
- 2024Transformer Normalisation Layers and the Independence of Semantic Subspaces25 Jun 2024
- 2025Why do LLMs attend to the first token?cited by 127
- 2025On the Emergence of Position Bias in Transformerscited by 59
- 2025Attention Sinks and Compression Valleys in LLMs are Two Sides of the Same Coincited by 52
- 2024Dynamic metastability in the self-attention modelcited by 46
- 2025Hallucination Detection in LLMs Using Spectral Features of Attention Mapscited by 43
- 2024Measure-to-measure interpolation using Transformerscited by 29
- 2024The Asymptotic Behavior of Attention in Transformerscited by 16
- 2025Pay Attention to Attention Distribution: A New Local Lipschitz Bound for Transformerscited by 11
- 2025All You Need is One: Capsule Prompt Tuning with a Single Vectorcited by 8
- 2025Optimizing Rank for High-Fidelity Implicit Neural Representationscited by 8
- 2024Transformer Normalisation Layers and the Independence of Semantic Subspacescited by 6
- 2025Attention-Only Transformers via Unrolled Subspace Denoisingcited by 5
12 most cited of 45 All 45 (JSON)
- 2026Asymptotic Analysis of Discrete-Time Self-Attention Dynamics in Transformers9 Oct 2026
- 2026Training and Inference Dynamics of PLDR-LLMs: Row-Map Collapse, Renormalization, and Predictive Reduction28 Sep 2026
- 2026Linear Algebra Foundations of Efficient Attention: A Phase Reversal in Rank Collapse Under SVD Compression6 Sep 2026
- 2026Why Post-Norm Transformers Collapse: Attention Amplification and Gradient Repair Failure10 Aug 2026
- 2026Self-Attention Dynamics with Rotary Position Embeddings: Twisted States and Explicit Consensus Rates on the Sphere27 Jul 2026
- 2026Transforming Rank: How Architecture Navigates the Spectral Pathologies of Depth15 Jul 2026
- 2026From Self-Attention to Connection Laplacian: A Unified Operator View of Transformers12 Jul 2026
- 2026How Data Shapes RoPE Frequency Usage: From Positional Scale Matching to Length Generalization8 Jul 2026
- 2026A Unifying View of Attention Sinks: From Mechanisms to Architectural Interventions6 Jun 2026
- 2026Activation-Based Active Learning for In-Context Learning: Challenges and Insights3 Jun 2026
- 2026The Devil is in the Spectrum: Mitigating Representation Collapse in LLMs via Topologically Regularized Side-Path2 Jun 2026
- 2026Anti Mode-Collapse in Mean-Field Transformer via Auxiliary Variables28 May 2026
12 newest of 45 All 45 (JSON)