Thinking Like Transformers
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 184 papers in the map (data through 14 Oct 2026). Builds on 29 of its 43 references that are in the map. First posted on arXiv 13 Jun 2021.
Builds on
29 of 43 references.
References · 29
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2020Big Bird: Transformers for Longer Sequencescited by 1,684
- 2019Generating Long Sequences with Sparse Transformerscited by 1,546
- 2015Effective Approaches to Attention-based Neural Machine Translationcited by 1,026
- 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 1,003
- 2020Efficient Transformers: A Surveycited by 790
- 2018Universal Transformerscited by 647
- 2020Efficient Content-Based Sparse Attention with Routing Transformerscited by 471
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 406
17 more
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
- 2020Transformers as Soft Reasoners over Languagecited by 270
- 2019Analyzing the Structure of Attention in a Transformer Language Modelcited by 243
- 2017Interpretable Convolutional Neural Networkscited by 162
- 2018On the Practical Computational Power of Finite Precision RNNs for Language Recognitioncited by 117
- 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105
- 2015Inferring Algorithmic Patterns with Stack-Augmented Recurrent Netscited by 76
- 2017Extracting Automata from Recurrent Neural Networks Using Queries and Counterexamplescited by 66
- 2020A Formal Hierarchy of RNN Architecturescited by 62
- 2020RNNs can generate bounded hierarchical languages with optimal memorycited by 59
- 2019Sequential Neural Networks as Automatacited by 54
- 2019Improving Transformer Models by Reordering their Sublayerscited by 52
- 2020How Can Self-Attention Networks Recognize Dyck-n Languages?cited by 51
- 2020ETC: Encoding Long and Structured Inputs in Transformerscited by 34
- 2018Evaluating the Ability of LSTMs to Learn Context-Free Grammarscited by 16
- 2018Connecting Weighted Automata and Recurrent Neural Networks through Spectral Learningcited by 15
- 2018Explaining Black Boxes on Sequential Data using Weighted Automatacited by 11
Built on by
Citing papers per year: 2021: 2; 2022: 7; 2023: 27; 2024: 69; 2025: 44; 2026: 35.
184 papers.
Sort:
By area:
- 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 724
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2024GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Modelscited by 550
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
- 2023Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspectivecited by 294
- 2022Transformers Learn Shortcuts to Automatacited by 268
- 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problemscited by 260
- 2023Looped Transformers as Programmable Computerscited by 237
- 2022Neural Networks and the Chomsky Hierarchycited by 217
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
- 2023A Toy Model of Universality: Reverse Engineering How Networks Learn Group Operationscited by 144
- 2021Saturated Transformers are Constant-Depth Threshold Circuitscited by 139
38 more
- 2023What Formal Languages Can Transformers Express? A Surveycited by 124
- 2024A Practical Review of Mechanistic Interpretability for Transformer-Based Language Modelscited by 118
- 2023Mechanistically analyzing the effects of fine-tuning on procedurally defined taskscited by 115
- 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 113
- 2023Tracr: Compiled Transformers as a Laboratory for Interpretabilitycited by 104
- 2024Transformers need glasses! Information over-squashing in language taskscited by 91
- 2024A Primer on the Inner Workings of Transformer-based Language Modelscited by 85
- 2024Why are Sensitive Functions Hard for Transformers?cited by 74
- 2022A Logic for Expressing Log-Precision Transformerscited by 67
- 2023Tighter Bounds on the Expressivity of Transformer Encoderscited by 66
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMscited by 64
- 2021The Neural Data Router: Adaptive Control Flow in Transformers Improves Systematic Generalizationcited by 62
- 2024Finding Transformer Circuits with Edge Pruningcited by 60
- 2023The Expressive Power of Transformers with Chain of Thoughtcited by 50
- 2023Masked Hard-Attention Transformers Recognize Exactly the Star-Free Languagescited by 49
- 2025Weight-sparse transformers have interpretable circuitscited by 44
- 2023When Do Prompting and Prefix-Tuning Work? A Theory of Capabilities and Limitationscited by 43
- 2023Learning Transformer Programscited by 41
- 2023What can a Single Attention Layer Learn? A Study Through the Random Features Lenscited by 40
- 2024Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chainscited by 40
- 2024Memory3: Language Modeling with Explicit Memorycited by 40
- 2024Differentiation and Specialization of Attention Heads via the Refined Local Learning Coefficientcited by 40
- 2024Counting Like Transformers: Compiling Temporal Counting Logic Into Softmax Transformerscited by 39
- 2023Logical Languages Accepted by Transformer Encoders with Hard Attentioncited by 38
- 2025Between Circuits and Chomsky: Pre-pretraining on Formal Languages Imparts Linguistic Biasescited by 37
- 2024How Far Can Transformers Reason? The Globality Barrier and Inductive Scratchpadcited by 36
- 2024Transformers Can Represent n-gram Language Modelscited by 32
- 2023Transformers are uninterpretable with myopic methods: a case study with bounded Dyck grammarscited by 30
- 2024A phase transition between positional and semantic learning in a solvable model of dot-product attentioncited by 30
- 2024Separations in the Representational Capabilities of Transformers and Recurrent Architecturescited by 29
- 2024Hypothesis Testing the Circuit Hypothesis in LLMscited by 29
- 2024Transformers on Markov Data: Constant Depth Sufficescited by 27
- 2023Interpretability Illusions in the Generalization of Simplified Modelscited by 25
- 2024Language Models Need Inductive Biases to Count Inductivelycited by 25
- 2024Universal Length Generalization with Turing Programscited by 25
- 2024InterpBench: Semi-Synthetic Transformers for Evaluating Mechanistic Interpretability Techniquescited by 25
- 2024Mechanistic?cited by 25
- 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 23
50 most cited of 184 All 184 (JSON)
- 2026Counting with Attention and LayerNorm: Norm Scaling and Representation Geometry12 Oct 2026
- 2026AI Models Can Provably Hide Arbitrary Capabilities9 Oct 2026
- 2026Length Generalization for Transformers via Compression8 Sep 2026
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers31 Aug 2026
- 2026Can Graph Learning Learn Circuits?9 Aug 2026
- 2026A Compositional Theory of Causally Masked Transformers29 Jul 2026
- 2026Planning with Transformers: Chain of Computation and Structured Context Windows20 Jul 2026
- 2026Invariant Learning Dynamics of Transformers in Inductive Reasoning Tasks13 Jul 2026
- 2026From Expressivity to Sample Complexity: Narrow Teachers for Transformers via C-RASP13 Jul 2026
- 2026Program-as-Weights: A Programming Paradigm for Fuzzy Functions2 Jul 2026
- 2026Bayesian Wind Tunnels for Model Selection1 Jul 2026
- 2026Can Language Model Agents be Helpful Circuit Explainers in Mechanistic Interpretability?23 Jun 2026
38 more
- 2026Comparing Transformers and Hybrid Models at the Token Level18 Jun 2026
- 2026Explaining Attention with Program Synthesis17 Jun 2026
- 2026Positional versus Symbolic Attention Heads: Learning Dynamics, RoPE Geometry, and Length Generalization29 May 2026
- 2026Polymorphism Is Rotation: Operational Mechanistic Interpretability from a Two-Layer Transformer to Pythia-70m23 May 2026
- 2026Grokking as Structural Inference: Transformers Need Bayesian Lottery Tickets15 May 2026
- 2026When LLMs Stop Following Steps: A Diagnostic Study of Procedural Execution in Language Models1 May 2026
- 2026Symmetry Reveals Layerwise Dynamics: How Transformers Perform In-Context Classification13 Apr 2026
- 2026Loom: A Scalable Analytical Neural Computer Architecture9 Apr 2026
- 2026Internalized Reasoning for Long-Context Visual Document Understanding31 Mar 2026
- 2026Transformers in the Dark: Navigating Unknown Search Spaces via Bandit Feedback25 Mar 2026
- 2026On the Ability of Transformers to Verify Plans20 Mar 2026
- 2026Algorithmic Task Capture, Computational Complexity, and Inductive Bias of Infinite Transformers11 Mar 2026
- 2026Synthesis and Verification of Transformer Programs (Technical Report)18 Feb 2026
- 2026Length Generalization Bounds for Transformers13 Feb 2026
- 2026AI-rithmetic11 Feb 2026
- 2026Do Multilingual LLMs have specialized language heads?9 Feb 2026
- 2026Hierarchical Latent Structures in Data Generation Process Unify Mechanistic Phenomena across Scale4 Feb 2026
- 2026Semantic Content Determines Algorithmic Performance29 Jan 2026
- 2026Understanding LLM Failures: A Multi-Tape Turing Machine Analysis of Systematic Errors in Language Model Reasoning27 Jan 2026
- 2026A model of errors in transformers20 Jan 2026
- 2026Universal computation is intrinsic to language model decoding12 Jan 2026
- 2026Weights to Code: Extracting Interpretable Algorithms from the Discrete Transformer9 Jan 2026
- 2026Context-Free Recognition with Transformers5 Jan 2026
- 2025Dual-objective Language Models: Training Efficiency Without Overfitting16 Dec 2025
- 2025Circuits, Features, and Heuristics in Molecular Transformers10 Dec 2025
- 2025Exploring Depth Generalization in Large Language Models for Solving Recursive Logic Tasks2 Dec 2025
- 2025Rectifying LLM Thought from Lens of Optimization1 Dec 2025
- 2025Softmax Transformers are Turing-Complete25 Nov 2025
- 2025Weight-sparse transformers have interpretable circuits17 Nov 2025
- 2025Language Generation and Identification From Partial Enumeration: Tight Density Bounds and Topological Characterizations7 Nov 2025
- 2025Quantitative Bounds for Length Generalization in Transformers30 Oct 2025
- 2025Out-of-distribution Tests Reveal Compositionality in Chess Transformers23 Oct 2025
- 2025Unlocking Out-of-Distribution Generalization in Transformers via Recursive Latent Space Reasoning15 Oct 2025
- 2025Post-Norm can Resharpen Attention9 Oct 2025
- 2025Performance-Efficiency Tradeoffs in Transformers: An Approximation Theory Perspective4 Oct 2025
- 2025The Transformer Cookbook1 Oct 2025
- 2025Bridging Kolmogorov Complexity and Deep Learning: Asymptotically Optimal Description Length Objectives for Transformers26 Sep 2025
- 2025From Prediction to Understanding: Will AI Foundation Models Transform Brain Science?21 Sep 2025
50 newest of 184 All 184 (JSON)
- 2024GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Modelscited by 550
- 2023Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspectivecited by 294
- 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problemscited by 260
- 2022A Logic for Expressing Log-Precision Transformerscited by 67
- 2023The Expressive Power of Transformers with Chain of Thoughtcited by 50
- 2025Implicit Language Models are RNNs: Balancing Parallelization and Expressivitycited by 22
- 2024Can Transformers Reason Logically? A Study in SAT Solvingcited by 16
- 2023Mastering Symbolic Operations: Augmenting Language Models with Compiled Neural Networkscited by 12
- 2025Lost in Transmission: When and Why LLMs Fail to Reason Globallycited by 9
- 2025Softmax Transformers are Turing-Completecited by 9
- 2024On the Empirical Complexity of Reasoning and Planning in LLMscited by 6
- 2025Unlocking Out-of-Distribution Generalization in Transformers via Recursive Latent Space Reasoningcited by 6
12 most cited of 16 All 16 (JSON)
- 2026Invariant Learning Dynamics of Transformers in Inductive Reasoning Tasks13 Jul 2026
- 2026Understanding LLM Failures: A Multi-Tape Turing Machine Analysis of Systematic Errors in Language Model Reasoning27 Jan 2026
- 2025Rectifying LLM Thought from Lens of Optimization1 Dec 2025
- 2025Softmax Transformers are Turing-Complete25 Nov 2025
- 2025Unlocking Out-of-Distribution Generalization in Transformers via Recursive Latent Space Reasoning15 Oct 2025
- 2025Deciphering Trajectory-Aided LLM Reasoning: An Optimization Perspective26 May 2025
- 2025Lost in Transmission: When and Why LLMs Fail to Reason Globally13 May 2025
- 2025Implicit Language Models are RNNs: Balancing Parallelization and Expressivity10 Feb 2025
- 2024Can Transformers Reason Logically? A Study in SAT Solving9 Oct 2024
- 2024GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models7 Oct 2024
- 2024On the Empirical Complexity of Reasoning and Planning in LLMs17 Apr 2024
- 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problems20 Feb 2024
12 newest of 16 All 16 (JSON)
- 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 724
- 2023A Toy Model of Universality: Reverse Engineering How Networks Learn Group Operationscited by 144
- 2024A Practical Review of Mechanistic Interpretability for Transformer-Based Language Modelscited by 118
- 2025Weight-sparse transformers have interpretable circuitscited by 44
- 2023Learning Transformer Programscited by 41
- 2024Hypothesis Testing the Circuit Hypothesis in LLMscited by 29
- 2024InterpBench: Semi-Synthetic Transformers for Evaluating Mechanistic Interpretability Techniquescited by 25
- 2024Mechanistic?cited by 25
- 2024Transformer Circuit Faithfulness Metrics are not Robustcited by 22
- 2024Sparse Autoencoders Enable Scalable and Reliable Circuit Identification in Language Modelscited by 15
- 2025Decomposing Representation Space into Interpretable Subspaces with Unsupervised Learningcited by 8
- 2024Validating Mechanistic Interpretations: An Axiomatic Approachcited by 4
12 most cited of 16 All 16 (JSON)
- 2026Can Graph Learning Learn Circuits?9 Aug 2026
- 2026Polymorphism Is Rotation: Operational Mechanistic Interpretability from a Two-Layer Transformer to Pythia-70m23 May 2026
- 2026Hierarchical Latent Structures in Data Generation Process Unify Mechanistic Phenomena across Scale4 Feb 2026
- 2025Circuits, Features, and Heuristics in Molecular Transformers10 Dec 2025
- 2025Weight-sparse transformers have interpretable circuits17 Nov 2025
- 2025Decomposing Representation Space into Interpretable Subspaces with Unsupervised Learning3 Aug 2025
- 2024Hypothesis Testing the Circuit Hypothesis in LLMs16 Oct 2024
- 2024Mechanistic?7 Oct 2024
- 2024InterpBench: Semi-Synthetic Transformers for Evaluating Mechanistic Interpretability Techniques19 Jul 2024
- 2024Validating Mechanistic Interpretations: An Axiomatic Approach18 Jul 2024
- 2024Transformer Circuit Faithfulness Metrics are not Robust11 Jul 2024
- 2024A Practical Review of Mechanistic Interpretability for Transformer-Based Language Models2 Jul 2024
12 newest of 16 All 16 (JSON)
- 2024Memory3: Language Modeling with Explicit Memorycited by 40
- 2024Memory3: Language Modeling with Explicit Memory1 Jul 2024
- 2025From Next Token Prediction to (STRIPS) World Modelscited by 2
- 2025From Next Token Prediction to (STRIPS) World Models16 Sep 2025
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 327
- 2022Transformers Learn Shortcuts to Automatacited by 268
- 2023Looped Transformers as Programmable Computerscited by 237
- 2022Neural Networks and the Chomsky Hierarchycited by 217
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 199
- 2021Saturated Transformers are Constant-Depth Threshold Circuitscited by 139
- 2023What Formal Languages Can Transformers Express? A Surveycited by 124
- 2023Mechanistically analyzing the effects of fine-tuning on procedurally defined taskscited by 115
- 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 113
- 2023Tracr: Compiled Transformers as a Laboratory for Interpretabilitycited by 104
- 2024Transformers need glasses! Information over-squashing in language taskscited by 91
12 most cited of 147 All 147 (JSON)
- 2026Counting with Attention and LayerNorm: Norm Scaling and Representation Geometry12 Oct 2026
- 2026AI Models Can Provably Hide Arbitrary Capabilities9 Oct 2026
- 2026Length Generalization for Transformers via Compression8 Sep 2026
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers31 Aug 2026
- 2026A Compositional Theory of Causally Masked Transformers29 Jul 2026
- 2026Planning with Transformers: Chain of Computation and Structured Context Windows20 Jul 2026
- 2026From Expressivity to Sample Complexity: Narrow Teachers for Transformers via C-RASP13 Jul 2026
- 2026Program-as-Weights: A Programming Paradigm for Fuzzy Functions2 Jul 2026
- 2026Bayesian Wind Tunnels for Model Selection1 Jul 2026
- 2026Comparing Transformers and Hybrid Models at the Token Level18 Jun 2026
- 2026Explaining Attention with Program Synthesis17 Jun 2026
- 2026Positional versus Symbolic Attention Heads: Learning Dynamics, RoPE Geometry, and Length Generalization29 May 2026
12 newest of 147 All 147 (JSON)