ACL Findings2023
On the Expressivity Role of LayerNorm in Transformers' Attention
Shaked Brody, Uri Alon, Eran Yahav
摘要
Layer Normalization (LayerNorm) is an inherent component in all Transformer-based models. In this paper, we show that LayerNorm is crucial to the expressivity of the multi-head attention layer that follows it. This is in contrast to the common belief that LayerNorm's only role is to normalize the activations during the forward pass, and their gradients during the backward pass.
We consider a geometric interpretation of LayerNorm and show that it consists of two components: (a) projection of the input vectors to a d -1 space that is orthogonal to the [1, 1, ..., 1] vector, and (b) scaling of all vectors to the same norm of √ d. We show that each of these components is important for the attention layer that follows it in Transformers: (a) projection allows the attention mechanism to create an attention query that attends to all keys equally, offloading the need to learn this operation by the attention; and (b) scaling allows each key to potentially receive the highest attention, and prevents keys from being "un-select-able". We show empirically that Transformers do indeed benefit from these properties of LayeNorm in general language modeling and even in computing simple functions such as "majority". Our code is available at https://github.com/tech-srl/ layer_norm_expressivity_role.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 10 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Impact of Layer Norm on Memorization and Generalization in Transformers 引用了 On the Role of Attention Masks and LayerNorm in Transformers
- Impact of Layer Norm on Memorization and Generalization in Transformers 引用了 On Layer Normalization in the Transformer Architecture
- On the Role of Attention Masks and LayerNorm in Transformers 引用了 On Layer Normalization in the Transformer Architecture
引用它的顶会 Paper10
- On the Role of Attention Masks and LayerNorm in TransformersXinyi Wu, Amir Ajorlou, Yifei Wang, Stefanie Jegelka 等NeurIPS 2024 · 54 次引用
- Prompting a Pretrained Transformer Can Be a Universal ApproximatorAleksandar Petrov, Philip Torr, Adel BibiICML 2024 · 19 次引用
- Rethinking Decoders for Transformer-based Semantic Segmentation: A Compression PerspectiveQishuai Wen, Chun-Guang LiNeurIPS 2024 · 8 次引用
- Impact of Layer Norm on Memorization and Generalization in TransformersRishi Singhal, Jung-Eun KimNeurIPS 2025 · 4 次引用
- Stealth edits to large language modelsOliver J. Sutton, Qinghua Zhou, Wei Wang, Desmond J. Higham 等NeurIPS 2024 · 4 次引用
它引用的 Paper2
相关 Paper
- Incorporating Residual and Normalization Layers into Analysis of Masked Language ModelsGoro Kobayashi, Tatsuki Kuribayashi, Sho Yokoi, Kentaro InuiEMNLP 2021 · 28 次引用
- XAI for Transformers: Better Explanations through Conservative PropagationAmeen Ali, Thomas Schnake, Oliver Eberle, Grégoire Montavon 等ICML 2022 · 144 次引用
- VISIT: Visualizing and Interpreting the Semantic Information Flow of TransformersShahar Katz, Yonatan BelinkovEMNLP Findings 2023 · 12 次引用
- Small Transformers Don’t Need LayerNorm at Inference Time: Scaling LayerNorm Removal to GPT-2 XL and Implications for Mechanistic InterpretabilityLuca Baroni, Galvin Khara, Joachim Schaeffer, Marat Subkhankulov 等ICLR 2026 · 8 次引用
- Attention is Not Only a Weight: Analyzing Transformers with Vector NormsGoro Kobayashi, Tatsuki Kuribayashi, Sho Yokoi, Kentaro InuiEMNLP 2020 · 138 次引用
