Overcoming a Theoretical Limitation of Self-Attention
摘要
Although transformers are remarkably effective for many tasks, there are some surprisingly easy-looking regular languages that they struggle with. Hahn shows that for languages where acceptance depends on a single input symbol, a transformer’s classification decisions get closer and closer to random guessing (that is, a cross-entropy of 1) as input strings get longer and longer. We examine this limitation using two languages: PARITY, the language of bit strings with an odd number of 1s, and FIRST, the language of bit strings starting with a 1. We demonstrate three ways of overcoming the limitation implied by Hahn’s lemma. First, we settle an open question by constructing a transformer that recognizes PARITY with perfect accuracy, and similarly for FIRST. Second, we use layer normalization to bring the cross-entropy of both models arbitrarily close to zero. Third, when transformers need to focus on a single position, as for FIRST, we find that they can fail to generalize to longer strings; we offer a simple remedy to this problem that also improves length generalization in machine translation.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 62 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- What Algorithms can Transformers Learn? A Study in Length Generalization 引用了 Thinking Like Transformers
- What Algorithms can Transformers Learn? A Study in Length Generalization 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- Thinking Like Transformers 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- Thinking Like Transformers 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Effects of Parameter Norm Growth During Transformer Training: Inductive Bias from Gradient Descent 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- Effects of Parameter Norm Growth During Transformer Training: Inductive Bias from Gradient Descent 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- On the Ability and Limitations of Transformers to Recognize Formal Languages 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Exposing Attention Glitches with Flip-Flop Language Modeling 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
引用它的顶会 Paper62
- TransNeXt: Robust Foveal Visual Perception for Vision TransformersDai ShiCVPR 2024 · 313 次引用
- What Algorithms can Transformers Learn? A Study in Length GeneralizationHattie Zhou, Arwen Bradley, Etai Littwin, Noam Razin 等ICLR 2024 · 189 次引用
- Scaling Laws of RoPE-based ExtrapolationXiaoran Liu, Hang Yan, Chenxin An, Xipeng Qiu 等ICLR 2024 · 130 次引用
- The Transient Nature of Emergent In-Context Learning in TransformersAaditya K. Singh, Stephanie C. Y. Chan, Ted Moskovitz, Erin Grant 等NeurIPS 2023 · 92 次引用
- Exposing Attention Glitches with Flip-Flop Language ModelingBingbin Liu, Jordan T. Ash, Surbhi Goel, Akshay Krishnamurthy 等NeurIPS 2023 · 90 次引用
它引用的 Paper4
- Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi 等ICLR 2020 · 481 次引用
- Thinking Like TransformersGail Weiss, Yoav Goldberg, Eran YahavICML 2021 · 183 次引用
- On the Ability and Limitations of Transformers to Recognize Formal LanguagesSatwik Bhattamishra, Kabir Ahuja, Navin GoyalEMNLP 2020 · 7 次引用
- Effects of Parameter Norm Growth During Transformer Training: Inductive Bias from Gradient DescentWilliam Merrill, Vivek Ramanujan, Yoav Goldberg, Roy Schwartz 等EMNLP 2021 · 1 次引用
相关 Paper
- How Transformers Learn Regular Language Recognition: A Theoretical Study on Training Dynamics and Implicit BiasRuiquan Huang, Yingbin Liang, Jing YangICML 2025
- A Formal Framework for Understanding Length Generalization in TransformersXinting Huang, Andy Yang, Satwik Bhattamishra, Yash Raj Sarrof 等ICLR 2025
- Why are Sensitive Functions Hard for Transformers?Michael Hahn, Mark RofinACL 2024 · 3 次引用
- Transformer Working Memory Enables Regular Language Reasoning And Natural Language Length ExtrapolationTa-Chung Chi, Ting-Han Fan, Alexander Rudnicky, Peter J. RamadgeEMNLP Findings 2023 · 1 次引用
- Language Models Need Inductive Biases to Count InductivelyYingshan Chang, Yonatan BiskICLR 2025
