Modular Arithmetic: Language Models Solve Math Digit by Digit

Tanja Baeumel, Daniil Gurgurov, Yusser al Ghussin, Josef van Genabith, Simon Ostermann
8/4/2025
cs.CLcs.AI

No confident code implementation found for this paper. 5 possible matches can be shown below.

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 5 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{baeumel2025modular,
  title  = {Modular Arithmetic: Language Models Solve Math Digit by Digit},
  author = {Tanja Baeumel and Daniil Gurgurov and Yusser al Ghussin and Josef van Genabith and Simon Ostermann},
  year   = {2025},
  eprint = {2508.02513},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.02513v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2508.02513.svg)](https://codeofpaper.com/paper/2508.02513)

Discussion