[Paper Review] A Mechanistic Interpretation of Arithmetic Reasoning in Language Models using Causal Mediation Analysis
This paper uses causal mediation analysis to trace how Transformer-based language models process arithmetic reasoning, revealing that attention mechanisms transmit operand and operator information from mid-sequence early layers to the final token, where late MLP modules generate result-related representations. The study identifies a distinct, task-specific circuit for arithmetic that differs from those used in number retrieval or factual knowledge tasks.
Mathematical reasoning in large language models (LMs) has garnered significant attention in recent work, but there is a limited understanding of how these models process and store information related to arithmetic tasks within their architecture. In order to improve our understanding of this aspect of language models, we present a mechanistic interpretation of Transformer-based LMs on arithmetic questions using a causal mediation analysis framework. By intervening on the activations of specific model components and measuring the resulting changes in predicted probabilities, we identify the subset of parameters responsible for specific predictions. This provides insights into how information related to arithmetic is processed by LMs. Our experimental results indicate that LMs process the input by transmitting the information relevant to the query from mid-sequence early layers to the final token using the attention mechanism. Then, this information is processed by a set of MLP modules, which generate result-related information that is incorporated into the residual stream. To assess the specificity of the observed activation dynamics, we compare the effects of different model components on arithmetic queries with other tasks, including number retrieval from prompts and factual knowledge questions.
Motivation & Objective
- To understand the internal mechanisms by which large language models perform arithmetic reasoning.
- To identify the specific model components responsible for arithmetic predictions using causal intervention.
- To assess whether the activation dynamics observed in arithmetic reasoning are unique compared to other numerical or factual tasks.
- To provide mechanistic insights into how information flows through the model architecture during arithmetic inference.
- To support future work in model interpretability, pruning, and inference-time correction by identifying key computational circuits.
Proposed method
- Applied causal mediation analysis to model components (neurons, layers, attention heads, MLPs) by intervening on their activations.
- Used controlled interventions on specific subsets of model parameters and measured resulting changes in output probability distributions.
- Tracked information flow from input tokens through attention mechanisms to final token representations.
- Identified mediators (model components) that significantly influence prediction outcomes via intervention-based causal effects.
- Compared activation dynamics across four tasks: arithmetic (with Arabic numerals and word forms), number retrieval, and factual knowledge.
- Computed neuron overlap between tasks using top 400 neurons ranked by intervention effect, with statistical validation against random baselines.
Experimental results
Research questions
- RQ1Which model components are causally responsible for correct arithmetic predictions in large language models?
- RQ2How does information related to operands and operators flow through the model’s layers and attention mechanisms during arithmetic reasoning?
- RQ3Are the circuits used for arithmetic reasoning distinct from those used in number retrieval or factual knowledge tasks?
- RQ4Does the model rely on a specific subset of late MLP modules to generate result-related representations?
- RQ5How do the activation dynamics in arithmetic reasoning compare to those in other numerical or factual prediction tasks?
Key findings
- Information about operands and operators is transmitted from mid-sequence early layers to the final token via the self-attention mechanism.
- Late-layer MLP modules are responsible for generating result-related information that is incorporated into the residual stream.
- The top 400 neurons activated by arithmetic queries using Arabic numerals and word forms show a 50% overlap, indicating shared circuitry.
- The overlap between neurons active for arithmetic and number retrieval is only 22–23%, suggesting distinct circuits despite both involving numerical prediction.
- Neuron overlap between arithmetic and factual knowledge tasks is 9–10%, statistically indistinguishable from random, confirming circuit specificity.
- The observed activation dynamics are specific to arithmetic reasoning and not generalizable to other numerical or factual tasks.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.