atlas

Research map / Architectures and efficiency / Attention and transformers

Arithmetic Transformers Can Length-Generalize in Both Operand Length and Count

ICLR 2025 · 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.

Combines task-specific scratchpads with multi-level Position Coupling in decoder-only Transformers to achieve length generalization over both operand length and count for multi-operand addition and multiplication, with a 1-layer theoretical construction.

Problem

Transformers fail to length-generalize on arithmetic tasks where both the operand length and the number of operands increase at test time, notably multi-operand addition and multiplication with both operands variable in length.

Approach

Pair a cumulative-sum scratchpad (two-stage for multiplication) that keeps the number of attended tokens constant per step with multi-level Position Coupling (bi-level for addition, tri-level for multiplication) that tells the model which positions to attend to.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Combine a scratchpad with bi-level Position CouplingDecoder-only Transformer for multi-operand addition · Multi-operand addition, operands up to 30 digits and 30 operandsmedian exact-match accuracyHelped
Combine a two-stage scratchpad with tri-level Position CouplingDecoder-only Transformer for multiplication · Multiplication with both operand lengths varyingmedian exact-match accuracyHelped
Add a scratchpad to Position CouplingTransformer for parity · Parity, queries up to 100 bitsaccuracyHelped
Add a scratchpad to NoPE or FIRE (ablation)Transformer for parity · Parity, queries up to 35 bitsaccuracyHelped
Add a scratchpad to NoPE or FIRE (ablation)Transformer for multi-operand addition · Multi-operand additionexact-match accuracyHelped
Use NoPE or FIRE instead of Position Coupling with the scratchpad (ablation)Transformer for multi-operand addition · 13 operands, each 12 digits longexact-match accuracyHurt
Remove the scratchpad (ablation)Transformer for multi-operand addition · Out-of-distribution operand lengths and countsexact-match accuracyHurt
Train on a wider range of operand lengths and counts (ablation)Transformer for multi-operand addition · Multi-operand additionexact-match accuracyHelped
Remove zero-padding from query and response (ablation)Scratchpad + Position Coupling for multi-operand addition · Multi-operand additionexact-match accuracyHurt
Use a 1-layer 2-head architecture (ablation)Scratchpad + Position Coupling for multi-operand addition · Longer operands and varying operand countsexact-match accuracyHurt
Use a 2-layer 2-head architecture instead of the 6-layer 8-head baseline (ablation)Scratchpad + Position Coupling for multi-operand addition · All combinations of operand length 1–30 and count 2–30median exact-match accuracy: 67.8% or above -> at least 90.0%Helped
Increase dimension per head from 128 to 256 (ablation)1-layer 8-head Transformer for multi-operand addition · Multi-operand additionexact-match accuracyHelped

Surprising findings

Limitations

Experimental setup

Datasets: synthetic multi-operand addition S_A(n,m) synthetic multiplication S_M(n,m) synthetic parity

Benchmarks: multi-operand addition test sets T_A(n,m) up to 30 operands x 30 digits multiplication test sets T_M(n,m) up to 30x30 digits parity up to 100 bits

Metrics: exact-match accuracy median accuracy over seeds

Baselines: NoPE FIRE RoPE Position Coupling without scratchpad

Builds on: Position Coupling scratchpad FIRE NoPE

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