atlas

Research map / Architectures and efficiency / RNNs and normalization

Teaching Arithmetic to Small Transformers

ICLR 2024 · Architectures and efficiency › RNNs and normalization · approach: Layer-wise analysis of language models · 7 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.

Shows that small transformers trained from scratch learn arithmetic much faster with reversed-output and chain-of-thought scratchpad data formats, with sample-efficiency gains linked to low-rank matrix completion.

Problem

How to efficiently teach small transformers trained from random initialization to perform arithmetic (addition, subtraction, multiplication, sine, square root) with next-token prediction, given that standard plain data formats learn poorly and slowly.

Approach

Reverse the output digit order so each output digit depends only on two operand digits and a carry, and add chain-of-thought scratchpads with intermediate steps; balance sampling by digit count and carry count. Phase transitions are linked to low-rank matrix completion of the addition table.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
train jointly on five arithmetic tasks instead of training on the task individuallyNanoGPT · Multiplicationaccuracy: 4.58 -> 14.28Helped
train jointly on five arithmetic tasks instead of training on the task individuallyNanoGPT · Subtractionaccuracy: 79.97 -> 72.83Hurt
balance sampling by operand digit length (ablation)NanoGPT addition training · 3-digit additionoverall accuracy: 97.74 -> 98.13Helped
balance the number of carry-on operations (ablation)NanoGPT addition training · 3-digit additionoverall accuracy: 97.74 -> 98.29Helped
reverse the output digitsNanoGPT · 3-digit additionaccuracy: Plain plateaus at slightly over 85%; Reverse reaches 100%Helped
add simplified scratchpad digit-sum and carry stepsNanoGPT addition training · 3-digit additiontraining samples to reach 100% accuracy: 2000 samplesHelped
add detailed scratchpad intermediate stepsNanoGPT addition training · 3-digit additiontraining samples to reach 100% accuracy: 1000 samplesHelped
use subtraction scratchpad Version 2 with operand comparison and swapping instead of Version 1 (ablation)NanoGPT subtraction training · 3-digit subtractionaccuracyHurt
replace correct intermediate digit-sum and carry labels with random labels (ablation)NanoGPT simplified-scratchpad addition training · Additionsample efficiencyHurt
exclude 500 operands from training (ablation)NanoGPT reverse-format addition · 3-digit additionoverall accuracy: 99.97% -> 99.99%No clear effect
exclude the least significant digit 5 during training (ablation)NanoGPT reverse-format addition · 3-digit addition, excluded-digit examplesexclusion accuracy: 99.90% -> 66%Hurt
add random perturbations to preceding output tokens (ablation)NanoGPT plain-format addition · 3-digit additionexact accuracy: 49.88%Hurt

Surprising findings

Limitations

Experimental setup

Datasets: Shakespeare corpus self-constructed arithmetic datasets (addition, subtraction, multiplication, sine, square root)

Benchmarks: self-constructed arithmetic test sets (addition, subtraction, multiplication, sine, square root)

Metrics: accuracy sample complexity exact accuracy relaxed accuracy

Baselines: plain format reverse format random sampling

Builds on: chain-of-thought prompting least-to-most prompting Scratchpads for intermediate computation

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