All for One: LLMs Solve Mental Math at the Last Token With Information Transferred From Other Tokens
Siddarth Mamidanna, Daking Rai, Ziyu Yao, Yilun Zhou
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 5 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Internal Chain-of-Thought: Empirical Evidence for Layer-wise Subtask Scheduling in LLMs 引用了 Locating and Editing Factual Associations in GPT
- Internal Chain-of-Thought: Empirical Evidence for Layer-wise Subtask Scheduling in LLMs 引用了 Linearity of Relation Decoding in Transformer Language Models
- Linearity of Relation Decoding in Transformer Language Models 引用了 Locating and Editing Factual Associations in GPT
- Interpretability at Scale: Identifying Causal Mechanisms in Alpaca 引用了 Locating and Editing Factual Associations in GPT
- Do Language Models Track Entities Across State Changes? 引用了 Locating and Editing Factual Associations in GPT
- A Implies B: Circuit Analysis in LLMs for Propositional Logical Reasoning 引用了 Locating and Editing Factual Associations in GPT
- A Implies B: Circuit Analysis in LLMs for Propositional Logical Reasoning 引用了 Interpretability at Scale: Identifying Causal Mechanisms in Alpaca
引用它的顶会 Paper5
- A Implies B: Circuit Analysis in LLMs for Propositional Logical ReasoningGuanzhe Hong, Nishanth Dikkala, Enming Luo, Cyrus Rashtchian 等NeurIPS 2025 · 17 次引用
- Internal Chain-of-Thought: Empirical Evidence for Layer-wise Subtask Scheduling in LLMsZhipeng Yang, Junzhuo Li, Siyu Xia, Xuming HuEMNLP 2025
- SSA: Improving Performance With a Better Scoring FunctionOmar Naim, Swarnadeep Bhar, Jérôme Bolte, Nicholas AsherACL 2026
- Reasoning-preserved Efficient Distillation of Large Language Models via Activation-aware InitializationJunlin He, Yihong Tang, Tong Nie, Guilong Li 等ICML 2026
- Do Language Models Track Entities Across State Changes?Zilu Tang, Qiao Zhao, Gabriel Franco, Derry Wijaya 等ICML 2026
它引用的 Paper18
- Locating and Editing Factual Associations in GPTKevin Meng, David Bau, Alex Andonian, Yonatan BelinkovNeurIPS 2022 · 3,415 次引用
- Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 次引用
- Efficient Streaming Language Models with Attention SinksGuangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han 等ICLR 2024 · 1,714 次引用
- Linearity of Relation Decoding in Transformer Language ModelsEvan Hernandez, Arnab Sen Sharma, Tal Haklay, Kevin Meng 等ICLR 2024 · 163 次引用
- Interpretability at Scale: Identifying Causal Mechanisms in AlpacaZhengxuan Wu, Atticus Geiger, Thomas Icard, Christopher Potts 等NeurIPS 2023 · 146 次引用
相关 Paper
- Memory or Reasoning? Explore How LLMs Compute Mixed Arithmetic ExpressionsChengzhi Li, Heyan Huang, Ping Jian, Zhen Yang 等ACL Findings 2025
- A Mechanistic Interpretation of Arithmetic Reasoning in Language Models using Causal Mediation AnalysisAlessandro Stolfo, Yonatan Belinkov, Mrinmaya SachanEMNLP 2023 · 11 次引用
- How do autoregressive transformers solve full addition?Wang Peixu, Chen Yu, Yu Ming, Cheng XiangEMNLP 2025
- CAMA: Enhancing Mathematical Reasoning in Large Language Models with Causal KnowledgeLei Zan, Keli Zhang, Ruichu Cai, Lujia PanAAAI 2026
- Addition in Four Movements: Mapping Layer-wise Information Trajectories in LLMsYao YanEMNLP Findings 2025
