Don’t Learn What You Can Compute: Arithmetic Residual Blocks for Exact Arithmetic in Transformers
Abstract
Language models typically approximate arithmetic through learned weights, even when an exact computation is available. We introduce Arithmetic Residual Blocks (ARBs), which recognize a supported terminal equation, compute its bounded integer result with a frozen residue-number core, and expose that result inside a transformer's forward pass through a small learned residual/output interface. On a frozen SmolLM2-360M model, ARB reaches 99.95\% exact match on 36,000 supplied 1--3-digit expressions, versus 4.56\% for the unmodified model. The interface remains near ceiling at rank one (99.89\% with 305,602 learned parameters, versus 1.86M at rank 32). We next train two equally sized 20M decoders from random initialization on a mixture of ordinary text and equations: the ARB model reaches 97.7\% supplied-equation accuracy versus 19.0\% for the learned-arithmetic baseline, with essentially the same held-out ordinary-text NLL. Finally, a five-seed staged experiment shows that keeping arithmetic exact lets a model retain it while acquiring 40,000 unrelated key--value associations. ARB therefore provides a concrete in-forward computation primitive, evidence that it integrates with language-model training, and a controlled first measurement of reduced task interference.