On the Ability and Limitations of Transformers to Recognize Formal Languages
Satwik Bhattamishra, Kabir Ahuja, Navin Goyal
摘要
Transformers have supplanted recurrent models in a large number of NLP tasks. However, the differences in their abilities to model different syntactic properties remain largely unknown. Past works suggest that LSTMs generalize very well on regular languages and have close connections with counter languages. In this work, we systematically study the ability of Transformers to model such languages as well as the role of its individual components in doing so. We first provide a construction of Transformers for a subclass of counter languages, including well-studied languages such as n-ary Boolean Expressions, Dyck-1, and its generalizations. In experiments, we find that Transformers do well on this subclass, and their learned mechanism strongly correlates with our construction. Perhaps surprisingly, in contrast to LSTMs, Transformers do well only on a subset of regular languages with degrading performance as we make languages more complex according to a well-known measure of complexity. Our analysis also provides insights on the role of self-attention mechanism in modeling certain behaviors and the influence of positional encoding schemes on the learning and generalization abilities of the model.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 109 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- What Algorithms can Transformers Learn? A Study in Length Generalization 引用了 Thinking Like Transformers
- What Algorithms can Transformers Learn? A Study in Length Generalization 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Thinking Like Transformers 引用了 A Formal Hierarchy of RNN Architectures
- Thinking Like Transformers 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 Thinking Like Transformers
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Learning to Encode Position for Transformer with Continuous Dynamical Model 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective 引用了 Thinking Like Transformers
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective 引用了 Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes 引用了 Thinking Like Transformers
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
引用它的顶会 Paper109
- What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 次引用
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical PerspectiveGuhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye 等NeurIPS 2023 · 470 次引用
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm SelectionYu Bai, Fan Chen, Huan Wang, Caiming Xiong 等NeurIPS 2023 · 356 次引用
- What Algorithms can Transformers Learn? A Study in Length GeneralizationHattie Zhou, Arwen Bradley, Etai Littwin, Noam Razin 等ICLR 2024 · 189 次引用
- Thinking Like TransformersGail Weiss, Yoav Goldberg, Eran YahavICML 2021 · 183 次引用
它引用的 Paper3
- Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi 等ICLR 2020 · 481 次引用
- Learning to Encode Position for Transformer with Continuous Dynamical ModelXuanqing Liu, Hsiang-Fu Yu, Inderjit S. Dhillon, Cho-Jui HsiehICML 2020 · 139 次引用
- A Formal Hierarchy of RNN ArchitecturesWilliam Merrill, Gail Weiss, Yoav Goldberg, Roy Schwartz 等ACL 2020 · 6 次引用
相关 Paper
- Simplicity Bias in Transformers and their Ability to Learn Sparse Boolean FunctionsSatwik Bhattamishra, Arkil Patel, Varun Kanade, Phil BlunsomACL 2023 · 7 次引用
- How Can Self-Attention Networks Recognize Dyck-n Languages?Javid Ebrahimi, Dhruv Gelda, Wei ZhangEMNLP Findings 2020 · 13 次引用
- Not all quantifiers are equal: Probing Transformer-based language models' understanding of generalised quantifiersTharindu Madusanka, Iqra Zahid, Hao Li, Ian Pratt-Hartmann 等EMNLP 2023 · 2 次引用
- Characterizing the Expressivity of Fixed-Precision Transformer Language ModelsJiaoda Li, Ryan CotterellNeurIPS 2025 · 18 次引用
- Separations in the Representational Capabilities of Transformers and Recurrent ArchitecturesSatwik Bhattamishra, Michael Hahn, Phil Blunsom, Varun KanadeNeurIPS 2024 · 36 次引用
