摘要
What is the computational model behind a Transformer? Where recurrent neural networks have direct parallels in finite state machines, allowing clear discussion and thought around architecture variants or trained models, Transformers have no such familiar parallel. In this paper we aim to change that, proposing a computational model for the transformer-encoder in the form of a programming language. We map the basic components of a transformer-encoder -- attention and feed-forward computation -- into simple primitives, around which we form a programming language: the Restricted Access Sequence Processing Language (RASP). We show how RASP can be used to program solutions to tasks that could conceivably be learned by a Transformer, and how a Transformer can be trained to mimic a RASP solution. In particular, we provide RASP programs for histograms, sorting, and Dyck-languages. We further use our model to relate their difficulty in terms of the number of required layers and attention heads: analyzing a RASP program implies a maximum number of heads and layers necessary to encode a task in a transformer. Finally, we see how insights gained from our abstraction might be used to explain phenomena seen in recent works.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 105 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Big Bird: Transformers for Longer Sequences 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- 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
- Chain of Thought Empowers Transformers to Solve Inherently Serial Problems 引用了 Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective
- On the Ability and Limitations of Transformers to Recognize Formal Languages 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- 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 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- 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 引用了 On the Ability and Limitations of Transformers to Recognize Formal Languages
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
引用它的顶会 Paper105
- 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 次引用
- The Impact of Positional Encoding on Length Generalization in TransformersAmirhossein Kazemnejad, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das 等NeurIPS 2023 · 444 次引用
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm SelectionYu Bai, Fan Chen, Huan Wang, Caiming Xiong 等NeurIPS 2023 · 356 次引用
- Chain of Thought Empowers Transformers to Solve Inherently Serial ProblemsZhiyuan Liu, Hong Liu, Denny Zhou, Tengyu MaICLR 2024 · 259 次引用
它引用的 Paper8
- Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie 等NeurIPS 2020 · 3,159 次引用
- Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi 等ICLR 2020 · 481 次引用
- How Can Self-Attention Networks Recognize Dyck-n Languages?Javid Ebrahimi, Dhruv Gelda, Wei ZhangEMNLP Findings 2020 · 13 次引用
- On the Ability and Limitations of Transformers to Recognize Formal LanguagesSatwik Bhattamishra, Kabir Ahuja, Navin GoyalEMNLP 2020 · 7 次引用
- Improving Transformer Models by Reordering their SublayersOfir Press, Noah A. Smith, Omer LevyACL 2020 · 6 次引用
相关 Paper
- What Algorithms can Transformers Learn? A Study in Length GeneralizationHattie Zhou, Arwen Bradley, Etai Littwin, Noam Razin 等ICLR 2024 · 189 次引用
- Discovering Interpretable Algorithms by Decompiling Transformers to RASPXinting Huang, Aleksandra Bakalova, Satwik Bhattamishra, William Merrill 等ICML 2026 · 3 次引用
- Learning Transformer ProgramsDan Friedman, Alexander Wettig, Danqi ChenNeurIPS 2023 · 59 次引用
- Length Generalization Bounds for TransformersAndy Yang, Pascal Bergsträßer, Georg Zetzsche, David Chiang 等ICML 2026
- Adaptive Transformer Programs: Bridging the Gap Between Performance and Interpretability in TransformersQuoc-Vinh Lai-Dang, Taemin Kang, Seungah SonICLR 2025
