Modular Arithmetic: Language Models Solve Math Digit by Digit — part 3/3
Cleaned-text code points [31810, 44622). Bibliography omitted here; source.md includes it.
As a result, the two models learn to solve fundamentally different arithmetic tasks. Multi-digit models must solve the entire arithmetic expression in a single forward pass, as they need the full answer immediately. Single-digit models, on the other hand, only need to generate the next digit, deferring the rest of the arithmetic task to future forward passes.
Therefore, when we expect single-digit tokenization models to contain different processing paths compared to multi-digit tokenization models, it is because these models have to learn completely different tasks during pretraining to become sufficient at solving arithmetics.
#### Localizing Digit-Specific Neurons.
After the injection of operand information (Layer 28; Figures 19 and 18 in Appendix C ) we observe the following pattern for both addition and subtraction (Figures 9 and 11 ):
The hundreds circuit is large in size (spanning 70-90% of all MLP neurons per layer on average) and present all the way to the final layer. The tens circuit is available and large in size in layers 28 to 31, but then drastically diminishes in size. A unit circuit is non-existent, as evident by the absence of any neurons in the circuit, meaning that no neuron is sensitive to the subtask in the unit position.
Based on the intuition given above and previous work that finds LLMs internally generate one result digit more than needed for their current generation to account for carry bits, but no further digits Baeumel et al. (2025) , we conclude the following: Single-digit tokenization models also have digit-position-specific arithmetic circuits, which consist of one dominant circuit responsible for predicting the digit needed for the output generation, and one smaller and shorter circuit which may be responsible for determining whether a carry-bit influences the generation.
#### Intervention.
Although somewhat trivial, we intervene on the hundreds digit circuit to observe the probability of the hundreds base digit b and hundreds source digit s . Table 5 shows that the intervention is highly effective in changing the model’s prediction, which is expected given that the hundreds digit circuit spans the majority of MLP neurons, making the intervention highly invasive.
## Appendix C Layers Involved in Arithmetic
Following Stolfo et al. (2023) , we focus our search for digit-position-specific arithmetic circuits on MLP layers that could plausibly contribute to producing arithmetic output. We identify the earliest layer at which operand information has been propagated to the residual stream at the final token, as earlier layers lack relevant input context and are unlikely to contribute to the result generation. We therefore restrict our search for arithmetic circuits to layers at which operand information has been propagated.
We perform causal interventions on the output of individual modules - particularly each decoder, attention, and MLP block. We intervene during the forward pass on a base prompt (e.g., ’347 + 231 = ’ ) by replacing the activations of a specific module with the activations of the same module during the forward pass on a source prompt (e.g., ’261 + 512 = ’ ). We measure the change in output probabilities for the correct result of the base query ( bbb , here, ’578’) and the result of the source query ( sss , here, ’773’).
Figures 12 to 19 , reveal that intervention on specific attention modules dramatically increases the probability of sss in all models. This suggests that these attention modules are responsible for injecting operand information into the residual stream at the final token position, which is consistent with prior work Stolfo et al. (2023) .
We thus look for digit-wise addition neurons in the MLP layers following the operand injection into the residual stream. For Llama 3 8B for instance, this happens at layer 16 for D a d d , o p 1 D_{add,op1} and layer 15 for D a d d , o p 2 D_{add,op2} respectively (Figure 12 ).
## Appendix D Fisher Score for Digit-Sensitivity of Neurons.
We measure how sensitive individual MLP neurons are to digit-level structure in arithmetic prompts, using a Fisher Score that quantifies class discriminability.
Let:
• x ∈ 𝒳 x\in\mathcal{X} : an input prompt (e.g., "157 + 431 = " ),
• i i : index of a neuron in an MLP layer,
• d ∈ { hundred , ten , unit } d\in\{\text{hundred},\text{ten},\text{unit}\} : a fixed digit position in the operands (e.g., the "tens" digit),
• c ∈ { 00 , 01 , … , 99 } c\in\{00,01,\dots,99\} : class label for the digit pair at position d d , formed by concatenating 4 4 4 We choose to concatenate digit pairs, as a way to express the arithmetic digit level subtasks as a class label the digit from each operand (e.g., c = 71 c=71 for d = u n i t d=unit and input prompt 34 7 + 23 1 = 34\textbf{7}+23\textbf{1}= ),
• 𝒳 c , d ⊆ 𝒳 \mathcal{X}_{c,d}\subseteq\mathcal{X} : input prompts with digit pair c c at position d d (e.g., 𝒳 71 , u n i t = { 34 7 + 23 1 = , 21 7 + 65 1 = , … } \mathcal{X}_{71,unit}=\{34\textbf{7}+23\textbf{1}=,21\textbf{7}+65\textbf{1}=,...\} ),
• a i ( x ) ∈ ℝ a_{i}(x)\in\mathbb{R} : the activation of neuron i i when processing input x x .
Define:
• Mean activation for class c c at position d d : μ i , c , d = 1 | 𝒳 c , d | ∑ x ∈ 𝒳 c , d a i ( x ) \mu_{i,c,d}=\frac{1}{|\mathcal{X}_{c,d}|}\sum_{x\in\mathcal{X}_{c,d}}a_{i}(x)
• Variance of activations for class c c at position d d : σ i , c , d 2 = 1 | 𝒳 c , d | ∑ x ∈ 𝒳 c , d ( a i ( x ) − μ i , c , d ) 2 \sigma^{2}_{i,c,d}=\frac{1}{|\mathcal{X}_{c,d}|}\sum_{x\in\mathcal{X}_{c,d}}\left(a_{i}(x)-\mu_{i,c,d}\right)^{2}
• Overall mean activation across all classes at position d d : μ i , d = 1 ∑ c | 𝒳 c , d | ∑ c | 𝒳 c , d | μ i , c , d \mu_{i,d}=\frac{1}{\sum_{c}|\mathcal{X}_{c,d}|}\sum_{c}|\mathcal{X}_{c,d}|\mu_{i,c,d}
Then, the Fisher Score for neuron i i with respect to digit position d d is:
F i , d = ∑ c | 𝒳 c , d | ( μ i , c , d − μ i , d ) 2 ∑ c | 𝒳 c , d | σ i , c , d 2 F_{i,d}=\frac{\sum_{c}|\mathcal{X}_{c,d}|\left(\mu_{i,c,d}-\mu_{i,d}\right)^{2}}{\sum_{c}|\mathcal{X}_{c,d}|\sigma^{2}_{i,c,d}}
Intuition. The Fisher Score quantifies how much neuron i i ’s activation varies between digit-pair classes (numerator), relative to how much it varies within each class (denominator). A high F i , d F_{i,d} indicates that neuron i i ’s activation reliably distinguishes between different digit values at position d d , while remaining relatively insensitive to other input variations. This implies that neuron i i likely participates in a digit-position-specific addition subcircuit.
## Appendix E Statistics on Arithmetic Circuits
Circuit Size. We find that digit-specific circuits are relatively ’wide’ (Figure 21 ). For the respective best thresholds t ∗ t* 5 5 5 See Section 3.2 : 0.5 for unit, 0.6 for tens, 0.9 for hundreds , the average number of MLP neurons per layer responsible for one of the digit-position specific circuits is 60.3% of all MLP neurons. In other words, almost two-thirds of the MLP neurons in relevant layers are digit-position specific, when Llama 3 8B solves addition tasks.
Circuit Overlap. If arithmetic tasks are indeed solved in a digit-wise manner, then neuron groups responsible for generating different digit position results should be distinct. To assess the distinctiveness of different digit-position circuits, we examine the overlap of member neurons across digit position circuits. We find that neuron sets for different digit positions are largely distinct (Figure 21 ). In fact, for higher thresholds (>= 0.7) neural overlap between circuits is largely negligible (<2%). The distinctiveness of digit-position specific arithmetic circuits provides a first indication of digit-positional modularity in LLM arithmetic.
Circuit Sufficiency. To evaluate whether Fisher-identified neuron groups are sufficient to represent digit-specific arithmetic subtasks, we perform a Linear Discriminant Analysis (LDA)-based classification test. For each layer l l and digit position d d , we train two LDA classifiers to predict the digit-pair label c c : one using the full MLP activation vector, and one using a reduced representation containing only neurons above a Fisher importance threshold.
Figure 21 compares classification accuracy between the full and reduced settings. We find that performance remains high in the reduced setting—especially in middle layers (15–24)—indicating that the selected neurons are sufficient to support digit-position classification.
Sufficiency is strongest for the unit and hundreds digits, and at lower thresholds, also for the tens digit. Stable accuracy across thresholds suggests that unit and hundreds information is more redundantly or compactly encoded, while the tens digit may require more neurons. A drop in later layers suggests that digit-specific information becomes less localized in deeper MLP layers.
## Appendix F Effect of chosen Threshold on Digit-Circuit Intervention
## Appendix G Intervention Results on D a d d , o p 1 D_{add,op1} and D s u b , o p 1 D_{sub,op1}
m m o \mathrm{o} d d t ∗ t* bbb bbs bsb sbb bss sbs ssb sss Absolute change in prediction probability Δ p \Delta p in percentage points (after - before). Llama 3 8B + + unit 0.6 0.6 -55.74% +30.17% +1.01% +0.41% +3.65% +0.87% +0.30% +0.54% tens 0.4 0.4 -70.44% +1.27% +22.72% +1.71% +4.82% +0.28% +7.52% +2.67% hun.s 0.8 0.8 -72.17% +0.25% +0.87% +38.39% +0.13% +0.71% +5.83% +0.40% − - unit 0.6 0.6 -55.75% +28.87% +0.46% +1.12% +4.57% +1.20% +0.19% +0.63% tens 0.5 0.5 -50.48% +1.12% +14.39% +2.11% +2.76% +0.48% +3.97% +0.69% hun.s 0.8 0.8 -64.48% +0.46% +1.07% +32.28% +1.77% +0.62% +2.26% +0.41% Llama 3 70B + + unit 0.5 -28.51% +20.12% +0.48% +0.97% +1.66% +0.45% +0.15% +0.40% tens 0.4 -35.24% +0.67% +14.60% +1.75% +0.84% +0.12% +6.24% +0.93% hun.s 0.6 -37.65% +0.08% +0.61% +24.70% +0.12% +0.20% +1.63% +0.18% − - unit 0.5 -27.45% +19.65% +0.22% +0.49% +3.72% +0.43% +0.07% +0.66% tens 0.5 -9.52% +0.41% +7.22% +0.21% +0.04% +0.18% +0.76% +0.03% hun.s 0.5 -21.14% +0.13% +0.40% +15.47% +0.08% +0.09% +1.62% +0.11% Olmo 2 7B + + unit 0.4 0.4 -85.04% +30.75% +0.83% +7.34% +2.07% +4.39% +0.90% +2.28% tens 0.8 0.8 -84.41% -0.06% +42.13% +2.51% -0.05% +0.04% +4.56% +0.47% hun.s 0.8 0.8 -73.61% +0.55% +0.69% +35.81% +0.30% +1.88% +3.04% +0% − - unit 0.5 0.5 -84.73% +42.33% +0.42% +1.13% +8.14% +4.50% +0.13% +1.30% tens 0.8 0.8 -86.03% +0.14% +42.08% +0.73% +1.58% +0.03% +4.80% +0.30% hun.s 0.8 0.8 -89.26% +1.29% +1.11% +39.53% +0.25% +1.40% +0.49% +1.22%
## Appendix H Ablation: Deeper Circuits
## Appendix I Similarity of Addition and Subtraction Circuits
Layer Digit Pos Top-50 Top-100 Top-250 Top-500 Top-1000 15 unit 12.0% 17.0% 12.8% 7.2% 3.6% tens 4.0% 2.0% 0.8% 0.4% 0.2% hundreds 10.0% 10.0% 15.6% 18.2% 16.0% 16 unit 16.0% 14.0% 5.6% 2.8% 1.4% tens 8.0% 4.0% 1.6% 0.8% 0.4% hundreds 16.0% 15.0% 11.6% 5.8% 2.9% 17 unit 36.0% 32.0% 36.4% 26.0% 13.0% tens 2.0% 1.0% 0.4% 0.2% 0.1% hundreds 18.0% 18.0% 20.0% 10.0% 5.0% 18 unit 24.0% 25.0% 28.0% 15.6% 7.8% tens 6.0% 3.0% 1.2% 0.6% 0.3% hundreds 40.0% 32.0% 28.4% 31.0% 22.4% 19 unit 16.0% 18.0% 8.0% 4.0% 2.0% tens 6.0% 3.0% 1.2% 0.6% 0.3% hundreds 48.0% 44.0% 44.0% 42.8% 44.8% 20 unit 14.0% 7.0% 2.8% 1.4% 0.7% tens 6.0% 3.0% 1.2% 0.6% 0.3% hundreds 44.0% 45.0% 42.0% 40.0% 36.8% 21 unit 28.0% 29.0% 29.2% 14.6% 7.3% tens 26.0% 34.0% 21.6% 10.8% 5.4% hundreds 28.0% 26.0% 29.2% 25.0% 12.5% 22 unit 4.0% 7.0% 3.6% 1.8% 0.9% tens 26.0% 26.0% 20.4% 10.2% 5.1% hundreds 4.0% 3.0% 6.0% 5.6% 5.5% 23 unit 18.0% 17.0% 12.4% 6.2% 3.1% tens 4.0% 4.0% 5.6% 3.6% 1.8% hundreds 2.0% 5.0% 2.8% 1.4% 0.7% 24 unit 26.0% 24.0% 24.4% 24.2% 12.1% tens 12.0% 12.0% 7.6% 3.8% 1.9% hundreds 0.0% 0.0% 0.0% 0.0% 0.0%
## Appendix J Examples of Neuron Heuristics
## Instructions for reporting errors
We are continuing to improve HTML versions of papers, and your feedback helps enhance accessibility and mobile support. To report errors in the HTML that will help us improve conversion and rendering, choose any of the methods listed below:
Click the "Report Issue" ( ) button, located in the page header.
Tip: You can select the relevant text first, to include it in your report.
Our team has already identified the following issues . We appreciate your time reviewing and reporting rendering errors we may not have found yet. Your efforts will help us improve the HTML versions for all readers, because disability should not be a barrier to accessing research. Thank you for your continued support in championing open access for all.
Have a free development cycle? Help support accessibility at arXiv! Our collaborators at LaTeXML maintain a list of packages that need conversion , and welcome developer contributions .