Understanding Addition and Subtraction in Transformers
Not on the map. Why?
Abstract (arXiv)
We use integer addition and subtraction as a controlled, exactly-solvable testbed for what can be said with confidence about the algorithm a low-loss transformer implements - logically and mechanically. We train small transformers (2-3 layers) from scratch, find the edge cases they fail (long carry and borrow cascades), and enrich the training data with them; most resulting models reach >99.999% accuracy on 5-15 digit problems in under an hour, solving cascades such as 555555555+444444448=+1000000003. Interpretability analysis of these accurate models - not an a-priori guess - surfaces the structure from which we derive novel, sound, exact left-to-right algorithms for both operations, matching the causal ordering transformers must use. We then put these algorithms back to the models: across 46 models varying in seed, depth, digit-length, and operation, the accurate ones share one circuit skeleton, and in representative models deeper causal analysis (activation and edge path-patching, with controls) confirms the multi-digit resolved-carry sub-task that earlier analyses left open - while ruling out several candidate mechanisms. The skeleton recurs across model sizes and operations, and mixed-model nodes are polysemantic across addition and subtraction whether initialized from an addition model or trained from scratch. We release the models, analysis, and a reproducible interpretability toolkit.
Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Builds on 9 of its 21 references that are in the map. First posted on arXiv 4 Feb 2024.
Builds on
9 of 21 references.
References · 9
- 2022Locating and Editing Factual Associations in GPTcited by 2,609
- 2023Sparse Autoencoders Find Highly Interpretable Features in Language Modelscited by 1,359
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
- 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 700
- 2023The Quantization Model of Neural Scalingcited by 137
- 2023Goat: Fine-tuned LLaMA Outperforms GPT-4 on Arithmetic Taskscited by 84
- 2023GPT Can Solve Mathematical Problems Without a Calculatorcited by 68
- 2023Memorization Capacity of Multi-Head Attention in Transformerscited by 39
- 2023Understanding Addition in Transformerscited by 34
Built on by
Citing papers per year: 2024: 3; 2025: 0; 2026: 3.
6 papers.
- 2024Mechanistic Interpretability for AI Safety -- A Reviewcited by 415
- 2024Unveiling Language Competence Neurons: A Psycholinguistic Approach to Model Interpretabilitycited by 8
- 2024Survival of the Fittest Representation: A Case Study with Modular Additioncited by 7
- 2026The Shape of Addition: Geometric Structures of Arithmetic in Large Language Modelscited by 0
- 2026Language Models Compare Quantities Using Number-specific and Unit-specific Heuristicscited by 0
- 2026Distance generalization in transformers: why bother with positional encoding?cited by 0
- 2026Distance generalization in transformers: why bother with positional encoding?10 Sep 2026
- 2026Language Models Compare Quantities Using Number-specific and Unit-specific Heuristics2 Jun 2026
- 2026The Shape of Addition: Geometric Structures of Arithmetic in Large Language Models29 May 2026
- 2024Unveiling Language Competence Neurons: A Psycholinguistic Approach to Model Interpretability24 Sep 2024
- 2024Survival of the Fittest Representation: A Case Study with Modular Addition27 May 2024
- 2024Mechanistic Interpretability for AI Safety -- A Review22 Apr 2024