Emergent Stack Representations in Modeling Counter Languages Using Transformers
Not on the map. Why?
Abstract (arXiv)
Transformer architectures are the backbone of most modern language models, but understanding the inner workings of these models still largely remains an open problem. One way that research in the past has tackled this problem is by isolating the learning capabilities of these architectures by training them over well-understood classes of formal languages. We extend this literature by analyzing models trained over counter languages, which can be modeled using counter variables. We train transformer models on 4 counter languages, and equivalently formulate these languages using stacks, whose depths can be understood as the counter values. We then probe their internal representations for stack depths at each input token to show that these models when trained as next token predictors learn stack-like representations. This brings us closer to understanding the algorithmic details of how transformers learn languages and helps in circuit discovery.
Key facts. Cited by 2 papers in the map (data through 13 Oct 2026). Builds on 25 of its 30 references that are in the map. First posted on arXiv 3 Feb 2025.
Builds on
25 of 30 references.
References · 25
- 2021Probing Classifiers: Promises, Shortcomings, and Advancescited by 850
- 2019Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Prunedcited by 849
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 831
- 2020A Primer in BERTology: What we know about how BERT workscited by 809
- 2019Designing and Interpreting Probes with Control Taskscited by 620
- 2022Emergent World Representations: Exploring a Sequence Model Trained on a Synthetic Taskcited by 421
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 406
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 287
- 2019Visualizing and Measuring the Geometry of BERTcited by 215
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 198
- 2021Thinking Like Transformerscited by 182
- 2021Implicit Representations of Meaning in Neural Language Modelscited by 179
13 more
- 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
- 2023What Formal Languages Can Transformers Express? A Surveycited by 121
- 2021Can Language Models Encode Perceptual Structure Without Grounding? A Case Study in Colorcited by 118
- 2024A Practical Review of Mechanistic Interpretability for Transformer-Based Language Modelscited by 116
- 2024Evaluating the World Model Implicit in a Generative Modelcited by 109
- 2023Tracr: Compiled Transformers as a Laboratory for Interpretabilitycited by 102
- 2015Inferring Algorithmic Patterns with Stack-Augmented Recurrent Netscited by 76
- 2024Why are Sensitive Functions Hard for Transformers?cited by 74
- 2020Transition-based Parsing with Stack-Transformerscited by 37
- 2019Memory-Augmented Recurrent Neural Networks Can Learn Generalized Dyck Languagescited by 31
- 2020A Survey of Neural Networks and Formal Languagescited by 17
- 2023Stack Attention: Improving the Ability of Transformers to Model Hierarchical Patternscited by 17
- 2024Transformer-Based Models Are Not Yet Perfect At Learning to Emulate Structural Recursioncited by 14
Built on by
Citing papers per year: 2026: 2.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2025StackTrans: From Large Language Model to Large Pushdown Automata Model
- 2022Transformers Learn Shortcuts to Automata
- 2024Circuit Compositions: Exploring Modular Structures in Transformer-Based Language Models
- 2024Let's Think Dot by Dot: Hidden Computation in Transformer Language Models
- 2026Invariant Learning Dynamics of Transformers in Inductive Reasoning Tasks
- 2026CircuitProbe: Predicting Reasoning Circuits in Transformers via Stability Zone Detection
- 2026Can Language Model Agents be Helpful Circuit Explainers in Mechanistic Interpretability?
- 2023Towards Interpretable Sequence Continuation: Analyzing Shared Circuits in Large Language Models