atlas

Research map / Architectures and efficiency / Attention and transformers

Understanding Addition in Transformers

ICLR 2024 · Architectures and efficiency › Attention and transformers · approach: Transformer expressivity and learnability · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Reverse-engineers a one-layer, three-head Transformer trained on n-digit integer addition, showing it processes digits in parallel streams with left-to-right staging and explaining its failure on rare carry-cascade cases.

Problem

Mechanistic understanding of how a small Transformer performs multi-digit integer addition, including why it is accurate on most questions but fails on rare carry-cascade cases.

Approach

Introduces a mathematical framework of necessary addition subtasks (BaseAdd, MakeCarry, MakeSum, UseCarry, UseSum) used only for analysis, and combines training-loss decomposition, attention-pattern inspection, and ablation to reverse-engineer the model's left-to-right, digit-parallel algorithm.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add the Base Add computation performed by Head 1 (ablation)1-layer Transformer · 5-digit addition, Base Add questionsaverage loss: 4.712 -> 0.021Helped
Add the function of Head 0 (ablation)1-layer Transformer · 5-digit addition, Base Add questionsaverage loss: 0.016 -> 0.021Helped
Add the function of Head 2 (ablation)1-layer Transformer · 5-digit addition, Base Add questionsaverage loss: 0.062 -> 0.021Helped
Use the calculations at token positions 11–16 (ablation)1-layer Transformer · 5-digit additionaverage loss: 0.322, 0.497, 0.604, 0.921, 1.181, 1.021 when ablatedHelped
Avoid relying on token positions 0–10 and 17 for the addition calculation (ablation)1-layer Transformer · 5-digit additionaverage loss: 0.070No clear effect
Use three attention heads rather than two or four (ablation)1-layer Transformer · 5-digit additionattention-task separationHelped
Use 2 or 4 attention heads instead of 3 (ablation)1-layer Transformer · 5-digit additioninterpretabilityHurt
Implement the cascading Use Sum 9 cases accurately1-layer Transformer · addition with Use Sum 9 cascadesanswer correctnessHelped
Change the random seed, optimization algorithm, and answer format while retaining a 1-layer model1-layer Transformer · 5-digit additionalgorithm behaviorNo clear effect

Surprising findings

Limitations

Experimental setup

Datasets: synthetic n-digit addition questions (5, 10, 15 digit)

Benchmarks: 5-digit addition test questions 10- and 15-digit addition

Metrics: negative log likelihood loss answer accuracy loss after ablation

Builds on: TransformerLens mathematical framework for transformer circuits

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy