Don’t Learn What You Can Compute: Arithmetic Residual Blocks for Exact Arithmetic in Transformers
Eric Gilerson
NeurIPS page · OpenReview · Open on the map
Category: Interpretability & Model Adaptation › Chain-of-Thought Reasoning in Transformers · Type: new method · Keywords: exact arithmetic, frozen residual blocks, Residue Number System, parameter-efficient fine-tuning, transformer arithmetic
Areas: LLM Reasoning › Reasoning Mechanisms › Looped Reasoning; Model Architectures & Sequence Modeling › Language Model Architectures › Transformer Memory and Reasoning
Summary
Arithmetic Residual Blocks (ARBs) enable transformers to perform exact integer arithmetic by inserting frozen RNS-based modules, achieving >99.9% accuracy on multi-digit operations while training only 1.7M parameters.
Explained to a 5-year-old
Big computer brains, like the ones that read and write text, try to learn how to do math on their own. They spend a lot of time and memory trying to guess the right answers. This works sometimes, but they often make mistakes, especially with bigger numbers. We noticed that some math problems have exact answers that can be calculated perfectly. We created a special math block that does exact calculations without needing to learn.
Explained to a 5-year-old, longer
Big computer brains, like the ones that read and write text, try to learn how to do math on their own. They spend a lot of time and memory trying to guess the right answers. This works sometimes, but they often make mistakes, especially with bigger numbers. We noticed that some math problems have exact answers that can be calculated perfectly. We created a special math block that does exact calculations without needing to learn. This block works like a perfect calculator that can be turned on when needed. The big brain can still think about other things, but it can use this block for math. Only a tiny part of the brain is trained to know when to use the block. This makes the brain much faster and more accurate for math tasks. The block never forgets how to do math, so it never makes mistakes. It helps the brain get almost perfect answers on addition, subtraction, multiplication, and division. By using this idea, we can make computer brains better at solving math problems.
For a technical reader
The paper introduces Arithmetic Residual Blocks (ARBs) that embed exact integer arithmetic as frozen modules in a transformer, allowing only a tiny trainable interface to route through them. By keeping the arithmetic computation static, the model can achieve near-perfect accuracy on multi-digit operations while training only 1.7M parameters. Experiments on a frozen SmolLM2-360M show >99.9% exact-match accuracy versus 4.6% for the base model, with errors limited to later digit positions. The authors argue that any deterministic function can be similarly frozen, suggesting a broader design principle for efficient model specialization. This approach could be applied to other exact sub-tasks beyond arithmetic.
Problem
Large language models waste capacity approximating deterministic arithmetic functions and often fail on multi-digit calculations. There is a need for a method that leverages exact computation rather than learning approximations.
Method
The approach inserts frozen residual blocks that compute exact integer arithmetic using a Residue Number System, while only training a gated injection pathway and a low-rank adapter on the language model head. The base model and arithmetic modules remain frozen, allowing the model to route through the exact computation when beneficial.
Results
The augmented model reaches 99.9%+ accuracy on all four operations, compared to only 4.6% mean accuracy of the unmodified base model, with residual errors of 0.047% concentrated at later digit positions.
Contributions
Introduces a design principle of embedding exact deterministic functions as frozen residual blocks, demonstrates that only a small interface needs training, and shows dramatic accuracy gains on multi-digit arithmetic.
Limitations and assumptions
Evaluated on arithmetic with up to three-digit operands and on a single model (SmolLM2-360M).
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