NeurIPS 2026QuestionsPapersAreasAboutMarkdown

Assign and Add: A Mechanistic Study of Compositional Arithmetic

Brady Exoo, Alberto Bietti, John Sous

NeurIPS page · OpenReview · alphaXiv · Open on the map

Category: Interpretability & Model Adaptation › Compositional Generalization in Transformers · Type: empirical study · Keywords: transformer compositionality, modular addition, variable assignment, learning dynamics, theoretical framework

Areas: LLM Reasoning › Reasoning Mechanisms › Looped Reasoning; Model Architectures & Sequence Modeling › Language Model Architectures › Transformer Structural Properties

Summary

Assign and Add investigates how transformers achieve compositional generalization by analyzing variable assignment and modular addition, revealing three learning phases and a theoretical framework for compositionality.

Explained to a 5-year-old

The paper looks at tiny computer brains called transformers. It teaches them to add numbers and remember results in little boxes. By splitting the learning into steps, the brain learns to do new tricks it hasn't practiced. The researchers watch how the brain changes during learning and find three stages. They also create a simple story that explains why the brain can combine things on its own.

Explained to a 5-year-old, longer

The paper studies how small computer models called transformers can solve new problems. It focuses on two simple tasks: adding numbers together and storing results in a place called a variable. The researchers give the model many examples that mix these tasks in different ways. They notice that the model can handle combinations it has never seen before. By looking inside the model, they find that the same part of the model does the adding whether the numbers come directly or from a variable. They watch how the model learns over time and see three clear stages. First, the model learns how to add numbers correctly. Next, it learns how to use the variable to remember intermediate results. Finally, it refines its behavior and can solve even trickier sequences. The researchers also create a simple theory that explains why these steps lead to the ability to combine ideas. This helps us understand that compositionality can happen naturally as the model trains. The findings give insights for building smarter and more flexible AI systems.

For a technical reader

The study investigates how transformer models achieve compositional generalization by analyzing a controlled arithmetic task that involves variable assignment and modular addition. Using a partitioned dataset, the authors show that small transformers can extrapolate to unseen variable-number combinations without explicit training on those combos. Mechanistic analysis reveals that a single modular addition MLP is reused for both direct and indirect inputs, and training dynamics uncover three distinct learning phases. Finally, a theoretical framework explains how these internal mechanisms naturally give rise to compositionality.

Problem

Understanding how large language models compose skills to solve unseen tasks remains unclear. This paper seeks to uncover the underlying mechanisms that enable compositional generalization in transformers.

Method

The approach uses a controlled setting with variable assignment and modular addition tasks, partitions training data into disjoint sets, and conducts mechanistic analysis of the transformer’s internal modules. It examines the reuse of a modular addition MLP across direct and indirect inputs, tracks learning phases through training dynamics, and develops a theoretical framework linking these observations.

Results

The approach shows that small transformers can generalize to unseen variable-number combinations and identifies three distinct learning phases, with a theoretical framework explaining how compositionality emerges from training dynamics.

Contributions

It provides a mechanistic analysis revealing that a single modular addition module is reused for both direct and indirect inputs, uncovers the stepwise learning dynamics of variable assignment and composition, and offers a theoretical account of how compositionality emerges from training.

Research questions this paper is counted under

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction