All for One: LLMs Solve Mental Math at the Last Token With Information Transferred From Other Tokens
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) demonstrate proficiency across numerous computational tasks, yet their inner workings remain unclear. In theory, the combination of causal self-attention and multilayer perceptron layers allows every token to access and compute information based on all preceding tokens. In practice, to what extent are such operations present? In this paper, on mental math tasks (i.e., direct math calculation via next-token prediction without explicit reasoning), we investigate this question in three steps: inhibiting input-specific token computations in the initial layers, restricting the routes of information transfer across token positions in the next few layers, and forcing all computation to happen at the last token in the remaining layers. With two proposed techniques, Context-Aware Mean Ablation (CAMA) and Attention-Based Peeking (ABP), we identify an All-for-One subgraph (AF1) with high accuracy on a wide variety of mental math tasks, where meaningful computation occurs very late (in terms of layer depth) and only at the last token, which receives information of other tokens in few specific middle layers. Experiments on a variety of models and arithmetic expressions show that this subgraph is sufficient and necessary for high model performance, transfers across different models, and works on a variety of input styles. Ablations on different CAMA and ABP alternatives reveal their unique advantages over other methods, which may be of independent interest.
Key facts. Cited by 5 papers in the map (data through 13 Oct 2026). Builds on 26 of its 35 references that are in the map. First posted on arXiv 11 Sep 2025.
Builds on
26 of 35 references.
References · 26
- 2017Attention Is All You Needcited by 60,106
- 2022Locating and Editing Factual Associations in GPTcited by 2,650
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,137
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,994
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,145
- 2019BERT Rediscovers the Classical NLP Pipelinecited by 1,049
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 831
- 2023Dissecting Recall of Factual Associations in Auto-Regressive Language Modelscited by 517
- 2024Mechanistic Interpretability for AI Safety -- A Reviewcited by 420
- 2023In-Context Learning Creates Task Vectorscited by 305
- 2023Linearity of Relation Decoding in Transformer Language Modelscited by 195
- 2023Localizing Model Behavior with Path Patchingcited by 188
14 more
- 2024Do Large Language Models Latently Perform Multi-Hop Reasoning?cited by 169
- 2024Arithmetic Without Algorithms: Language Models Solve Math With a Bag of Heuristicscited by 96
- 2024Grokked Transformers are Implicit Reasoners: A Mechanistic Journey to the Edge of Generalizationcited by 78
- 2024Hopping Too Late: Exploring the Limitations of Large Language Models on Multi-Hop Queriescited by 78
- 2024Spectral Filters, Dark Signals, and Attention Sinkscited by 55
- 2024How to think step-by-step: A mechanistic understanding of chain-of-thought reasoningcited by 53
- 2025Do Language Models Use Their Depth Efficiently?cited by 49
- 2024Identifying Semantic Induction Heads to Understand In-Context Learningcited by 47
- 2024Understanding and Patching Compositional Reasoning in LLMscited by 46
- 2024Interpreting and Improving Large Language Models in Arithmetic Calculationcited by 44
- 2024Summing Up the Facts: Additive Mechanisms Behind Factual Recall in LLMscited by 40
- 2023Memory Injections: Correcting Multi-Hop Reasoning Failures during Inference in Transformer-Based Language Modelscited by 21
- 2024An Investigation of Neuron Activation as a Unified Lens to Explain Chain-of-Thought Eliciting Arithmetic Reasoning of LLMscited by 20
- 2023Arithmetic with Language Models: from Memorization to Computationcited by 12
Built on by
Citing papers per year: 2025: 1; 2026: 4.
5 papers.
- 2026Do Language Models Track Entities Across State Changes?cited by 5
- 2025Memory Retrieval and Consolidation in Large Language Models through Function Tokenscited by 4
- 2026Data-driven Circuit Discovery for Interpretability of Language Modelscited by 2
- 2026Are Arithmetic Heuristic Neurons Form-Invariant? A Mechanistic Analysis of Symbols, Text, and Code in LLMscited by 1
- 2026Post-Routing Arithmetic in Llama-3: Last-Token Result Writing and Rotation-Structured Digit Directionscited by 0
- 2026Are Arithmetic Heuristic Neurons Form-Invariant? A Mechanistic Analysis of Symbols, Text, and Code in LLMs18 Jul 2026
- 2026Do Language Models Track Entities Across State Changes?28 May 2026
- 2026Data-driven Circuit Discovery for Interpretability of Language Models9 May 2026
- 2026Post-Routing Arithmetic in Llama-3: Last-Token Result Writing and Rotation-Structured Digit Directions22 Feb 2026
- 2025Memory Retrieval and Consolidation in Large Language Models through Function Tokens9 Oct 2025