Modular Arithmetic: Language Models Solve Math Digit by Digit
Authors:
Preprint
Abstract
While recent work has begun to uncover the internal strategies that Large Language Models (LLMs) employ for simple arithmetic tasks, a unified understanding of their underlying mechanisms is still lacking. We extend recent findings showing that LLMs represent numbers in a digit-wise manner and present evidence for the existence of digit-position-specific circuits that LLMs use to perform simple arithmetic tasks, i.e. modular subgroups of MLP neurons that operate independently on different digit positions (units, tens, hundreds). Notably, such circuits exist independently of model size and of tokenization strategy, i.e. both for models that encode longer numbers digit-by-digit and as one token. Using Feature Importance and Causal Interventions, we identify and validate the digit-position-specific circuits, revealing a compositional and interpretable structure underlying the solving of arithmetic problems in LLMs. Our interventions selectively alter the model's prediction at targeted digit positions, demonstrating the causal role of digit-position circuits in solving arithmetic tasks.Keywords
All Related Versions
This publication has 6 references indexed in Scilit:
- The Lookahead Limitation: Why Multi-Operand Addition is Hard for LLMs2025
- pyvene: A Library for Understanding and Improving PyTorch Models via Interventions2024
- A Mechanistic Interpretation of Arithmetic Reasoning in Language Models using Causal Mediation Analysis2023
- Locating and Editing Factual Associations in GPT2022
- Feature selection using Fisher score and multilabel neighborhood rough sets for multilabel classificationInformation Sciences, 2021
- Zoom In: An Introduction to CircuitsDistill, 2020