Modular Arithmetic: Language Models Solve Math Digit by Digit

2508.02513v1 cs.CL, cs.AI 2025-08-09
Авторы:

Tanja Baeumel, Daniil Gurgurov, Yusser al Ghussin, Josef van Genabith, Simon Ostermann

Резюме на русском

Научная статья **"Modular Arithmetic: Language Models Solve Math Digit by Digit"** рассматривает проблему того, каким образом Large Language Models (LLMs) решают простые арифметические задачи. Несмотря на то, что ранее были выявлены некоторые стратегии LLMs для таких задач, полное понимание их механизмов остается неизвестным. Авторы показывают, что LLMs представляют числа по дизициям и используют отдельные подгруппы нейронов модульного слоя (MLP) для обработки каждой цифры в числе. Эти подгруппы независимо взаимодействуют с разными дизициями (единицы, десятки, сотни), независимо от размера модели и токенизационной стратегии (для чисел, записанных целиком или по дизициям). Используя методы Feature Importance и Causal Interventions, авторы выяснили, что эти подгруппы нейронов являются ключевыми для решения задач арифметики. Таким образом, статья демонстрирует, что LLMs решают математические задачи с помощью последовательной обработки каждой цифры.

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.

Ссылки и действия