Length Generalization in Arithmetic Transformers
Not on the map. Why?
Abstract (arXiv)
We examine how transformers cope with two challenges: learning basic integer arithmetic, and generalizing to longer sequences than seen during training. We find that relative position embeddings enable length generalization for simple tasks, such as addition: models trained on 5-digit numbers can perform 15-digit sums. However, this method fails for multiplication, and we propose train set priming: adding a few (10 to 50) long sequences to the training set. We show that priming allows models trained on 5-digit × 3-digit multiplications to generalize to 35× 3 examples. We also show that models can be primed for different generalization lengths, and that the priming sample size scales as the logarithm of the training set size. Finally, we discuss potential applications of priming beyond arithmetic.
Key facts. Cited by 66 papers in the map (data through 14 Oct 2026). Builds on 43 of its 54 references that are in the map. First posted on arXiv 27 Jun 2023.
Builds on
43 of 54 references.
References · 43
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2021Training Verifiers to Solve Math Word Problemscited by 10,109
- 2016SGDR: Stochastic Gradient Descent with Warm Restartscited by 5,045
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,703
- 2021On the Opportunities and Risks of Foundation Modelscited by 4,033
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,790
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,850
31 more
- 2021Decision Transformer: Reinforcement Learning via Sequence Modelingcited by 1,546
- 2022Solving Quantitative Reasoning Problems with Language Modelscited by 1,392
- 2019Mastering Atari, Go, Chess and Shogi by Planning with a Learned Modelcited by 1,353
- 2018Self-Attention with Relative Position Representationscited by 1,120
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,103
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 886
- 2019Solving Rubik's Cube with a Robot Handcited by 734
- 2021Offline Reinforcement Learning as One Big Sequence Modeling Problemcited by 644
- 2022Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasetscited by 629
- 2020Generative Language Modeling for Automated Theorem Provingcited by 388
- 2019Deep Learning for Symbolic Mathematicscited by 270
- 2022Exploring Length Generalization in Large Language Modelscited by 206
- 2021Investigating the Limitations of Transformers with Simple Arithmetic Taskscited by 139
- 2015Neural GPUs Learn Algorithmscited by 121
- 2018Correcting Length Bias in Neural Machine Translationcited by 120
- 2022Teaching Algorithmic Reasoning via In-context Learningcited by 112
- 2022Unveiling Transformers with LEGO: a synthetic reasoning taskcited by 106
- 2015Inferring Algorithmic Patterns with Stack-Augmented Recurrent Netscited by 76
- 2020Improve Transformer Models with Better Relative Position Embeddingscited by 73
- 2018Neural Arithmetic Logic Unitscited by 70
- 2021Linear algebra with transformerscited by 63
- 2020Teaching Temporal Logics to Neural Networkscited by 51
- 2020The EOS Decision and Length Extrapolationcited by 46
- 2021SHAPE: Shifted Absolute Position Embedding for Transformerscited by 37
- 2019Location Attention for Extrapolation to Longer Sequencescited by 33
- 2022End-to-end Algorithm Synthesis with Recurrent Networks: Logical Extrapolation Without Overthinkingcited by 33
- 2022SALSA: Attacking Lattice Cryptography with Transformerscited by 28
- 2022Simplifying Polylogarithms with Machine Learningcited by 15
- 2022Induced Natural Language Rationales and Interleaved Markup Tokens Enable Extrapolation in Large Language Modelscited by 10
- 2019Solving Math Word Problems with Double-Decoder Transformercited by 7
- 2021Solving Arithmetic Word Problems with Transformers and Preprocessing of Problem Textcited by 7
Built on by
Citing papers per year: 2023: 10; 2024: 24; 2025: 18; 2026: 14.
66 papers.
Sort:
By area:
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 216
- 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Processcited by 108
- 2023Amortizing intractable inference in large language modelscited by 97
- 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 86
- 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 78
- 2023GPT Can Solve Mathematical Problems Without a Calculatorcited by 68
- 2023Positional Description Matters for Transformers Arithmeticcited by 56
- 2023SNIP: Bridging Mathematical Symbolic and Numeric Realms with Unified Pre-trainingcited by 47
- 2024How Far Can Transformers Reason? The Globality Barrier and Inductive Scratchpadcited by 36
- 2025Self-Improving Transformers Overcome Easy-to-Hard and Length Generalization Challengescited by 31
- 2024Global Lyapunov functions: a long-standing open problem in mathematics, with symbolic transformerscited by 29
- 2024Universal Length Generalization with Turing Programscited by 25
38 more
- 2023Mathematical Language Models: A Surveycited by 24
- 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 23
- 2024On Provable Length and Compositional Generalizationcited by 22
- 2024Mixture of Parrots: Experts improve memorization more than reasoningcited by 21
- 2025Long-Context Generalization with Sparse Attentioncited by 21
- 2025Generalizing from SIMPLE to HARD Visual Reasoning: Can We Mitigate Modality Imbalance in VLMs?cited by 14
- 2025Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalizationcited by 14
- 2023Improving Length-Generalization in Transformers via Task Hintingcited by 13
- 2025A Survey on Mathematical Reasoning and Optimization with Large Language Modelscited by 12
- 2024A Theory for Length Generalization in Learning to Reasoncited by 11
- 2024Explicitly Encoding Structural Symmetry is Key to Length Generalization in Arithmetic Taskscited by 11
- 2025Graph neural networks extrapolate out-of-distribution for shortest pathscited by 11
- 2023Chain-of-Thought Reasoning is a Policy Improvement Operatorcited by 8
- 2023Adaptivity and Modularity for Efficient Generalization Over Task Complexitycited by 7
- 2024Mastering Text, Code and Math Simultaneously via Fusing Highly Specialized Language Modelscited by 7
- 2024Contextual Counting: A Mechanistic Study of Transformers on a Quantitative Taskcited by 7
- 2025Random Scaling of Emergent Capabilitiescited by 7
- 2025Born a Transformer -- Always a Transformer? On the Effect of Pretraining on Architectural Abilitiescited by 6
- 2025Unlocking Out-of-Distribution Generalization in Transformers via Recursive Latent Space Reasoningcited by 6
- 2025From Shortcut to Induction Head: How Data Diversity Shapes Algorithm Selection in Transformerscited by 6
- 2023Boolformer: Symbolic Regression of Logic Functions with Transformerscited by 5
- 2024Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Taskscited by 5
- 2024Quantifying artificial intelligence through algorithmic generalizationcited by 5
- 2024Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmeticcited by 4
- 2025Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networkscited by 4
- 2025Long-Short Alignment for Effective Long-Context Modeling in LLMscited by 4
- 2025To Infinity and Beyond: Tool-Use Unlocks Length Generalization in State Space Modelscited by 4
- 2026Seeing to Generalize: How Visual Data Corrects Binding Shortcutscited by 4
- 2026Length Generalization Bounds for Transformerscited by 4
- 2024Provable Length Generalization in Sequence Prediction via Spectral Filteringcited by 3
- 2025The Imitation Game: Turing Machine Imitator is Length Generalizable Reasonercited by 3
- 2026The Long Delay to Arithmetic Generalization: When Learned Representations Outrun Behaviorcited by 3
- 2026Understanding In-Context Learning for Nonlinear Regression with Transformers: Attention as Featurizercited by 3
- 2026The Expressive Power of Low Precision Softmax Transformers with (Summarized) Chain-of-Thoughtcited by 3
- 2023It Ain't That Bad: Understanding the Mysterious Performance Drop in OOD Generalization for Generative Transformer Modelscited by 2
- 2024Machine learning for modular multiplicationcited by 2
- 2024Low-Dimension-to-High-Dimension Generalization And Its Implications for Length Generalizationcited by 2
- 2024Three Pathways to Neurosymbolic Reinforcement Learning with Interpretable Model and Policy Networkscited by 1
50 most cited of 66 All 66 (JSON)
- 2026AGI Maze Prediction Datasets: A Compact Benchmark for Learning World Dynamics with Transformers2 Sep 2026
- 2026Can a Dynamic Internal Field Govern a Transformer's Cognition? Certifiability, not Superiority, in Homeostatic Compute Control25 Aug 2026
- 2026Frontier Language Models Struggle to Copy: Text Can Be Better Viewed in 2D17 Jul 2026
- 2026Fine-Tuning Large Language Models for Quantum Reasoning20 Jun 2026
- 2026Can Transformers Learn to Verify During Backtracking Search?21 May 2026
- 2026The Expressive Power of Low Precision Softmax Transformers with (Summarized) Chain-of-Thought18 May 2026
- 2026Convex Optimization of Spiking Neural Networks with Global and Approximation Guarantees8 May 2026
- 2026Understanding In-Context Learning for Nonlinear Regression with Transformers: Attention as Featurizer6 May 2026
- 2026Barriers to Universal Reasoning With Transformers (And How to Overcome Them)28 Apr 2026
- 2026Generalization in LLM Problem Solving: The Case of the Shortest Path16 Apr 2026
- 2026The Long Delay to Arithmetic Generalization: When Learned Representations Outrun Behavior30 Mar 2026
- 2026On the Mirage of Long-Range Dependency, with an Application to Integer Multiplication30 Mar 2026
38 more
- 2026Seeing to Generalize: How Visual Data Corrects Binding Shortcuts16 Feb 2026
- 2026Length Generalization Bounds for Transformers13 Feb 2026
- 2025From Shortcut to Induction Head: How Data Diversity Shapes Algorithm Selection in Transformers21 Dec 2025
- 2025Exact Learning of Arithmetic with Differentiable Agents27 Nov 2025
- 2025Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization10 Nov 2025
- 2025To Infinity and Beyond: Tool-Use Unlocks Length Generalization in State Space Models16 Oct 2025
- 2025Unlocking Out-of-Distribution Generalization in Transformers via Recursive Latent Space Reasoning15 Oct 2025
- 2025On the Limitations and Capabilities of Position Embeddings for Length Generalization5 Oct 2025
- 2025The Imitation Game: Turing Machine Imitator is Length Generalizable Reasoner17 Jul 2025
- 2025Long-Context Generalization with Sparse Attention19 Jun 2025
- 2025Long-Short Alignment for Effective Long-Context Modeling in LLMs13 Jun 2025
- 2025Born a Transformer -- Always a Transformer? On the Effect of Pretraining on Architectural Abilities27 May 2025
- 2025Graph neural networks extrapolate out-of-distribution for shortest paths24 Mar 2025
- 2025A Survey on Mathematical Reasoning and Optimization with Large Language Models22 Mar 2025
- 2025Random Scaling of Emergent Capabilities24 Feb 2025
- 2025Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networks24 Feb 2025
- 2025Self-Improving Transformers Overcome Easy-to-Hard and Length Generalization Challenges3 Feb 2025
- 2025Learning Model Successors31 Jan 2025
- 2025Generating particle physics Lagrangians with transformers16 Jan 2025
- 2025Generalizing from SIMPLE to HARD Visual Reasoning: Can We Mitigate Modality Imbalance in VLMs?5 Jan 2025
- 2024Rethinking Associative Memory Mechanism in Induction Head16 Dec 2024
- 2024Quantifying artificial intelligence through algorithmic generalization8 Nov 2024
- 2024Provable Length Generalization in Sequence Prediction via Spectral Filtering1 Nov 2024
- 2024Mixture of Parrots: Experts improve memorization more than reasoning24 Oct 2024
- 2024Learning Mathematical Rules with Large Language Models22 Oct 2024
- 2024Low-Dimension-to-High-Dimension Generalization And Its Implications for Length Generalization11 Oct 2024
- 2024Global Lyapunov functions: a long-standing open problem in mathematics, with symbolic transformers10 Oct 2024
- 2024Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic4 Oct 2024
- 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Process29 Jul 2024
- 2024Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Tasks25 Jul 2024
- 2024Universal Length Generalization with Turing Programs3 Jul 2024
- 2024How Far Can Transformers Reason? The Globality Barrier and Inductive Scratchpad10 Jun 2024
- 2024Explicitly Encoding Structural Symmetry is Key to Length Generalization in Arithmetic Tasks4 Jun 2024
- 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structure31 May 2024
- 2024Contextual Counting: A Mechanistic Study of Transformers on a Quantitative Task30 May 2024
- 2024Transformers Can Do Arithmetic with the Right Embeddings27 May 2024
- 2024A Theory for Length Generalization in Learning to Reason31 Mar 2024
- 2024Mastering Text, Code and Math Simultaneously via Fusing Highly Specialized Language Models13 Mar 2024
50 newest of 66 All 66 (JSON)
- 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Processcited by 108
- 2024Global Lyapunov functions: a long-standing open problem in mathematics, with symbolic transformerscited by 29
- 2025Generalizing from SIMPLE to HARD Visual Reasoning: Can We Mitigate Modality Imbalance in VLMs?cited by 14
- 2025Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalizationcited by 14
- 2025A Survey on Mathematical Reasoning and Optimization with Large Language Modelscited by 12
- 2024Explicitly Encoding Structural Symmetry is Key to Length Generalization in Arithmetic Taskscited by 11
- 2023Chain-of-Thought Reasoning is a Policy Improvement Operatorcited by 8
- 2025Unlocking Out-of-Distribution Generalization in Transformers via Recursive Latent Space Reasoningcited by 6
- 2024Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Taskscited by 5
- 2025The Imitation Game: Turing Machine Imitator is Length Generalizable Reasonercited by 3
- 2026The Expressive Power of Low Precision Softmax Transformers with (Summarized) Chain-of-Thoughtcited by 3
- 2026Barriers to Universal Reasoning With Transformers (And How to Overcome Them)cited by 1
12 most cited of 15 All 15 (JSON)
- 2026Frontier Language Models Struggle to Copy: Text Can Be Better Viewed in 2D17 Jul 2026
- 2026Fine-Tuning Large Language Models for Quantum Reasoning20 Jun 2026
- 2026The Expressive Power of Low Precision Softmax Transformers with (Summarized) Chain-of-Thought18 May 2026
- 2026Barriers to Universal Reasoning With Transformers (And How to Overcome Them)28 Apr 2026
- 2025Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization10 Nov 2025
- 2025Unlocking Out-of-Distribution Generalization in Transformers via Recursive Latent Space Reasoning15 Oct 2025
- 2025The Imitation Game: Turing Machine Imitator is Length Generalizable Reasoner17 Jul 2025
- 2025A Survey on Mathematical Reasoning and Optimization with Large Language Models22 Mar 2025
- 2025Generalizing from SIMPLE to HARD Visual Reasoning: Can We Mitigate Modality Imbalance in VLMs?5 Jan 2025
- 2024Rethinking Associative Memory Mechanism in Induction Head16 Dec 2024
- 2024Global Lyapunov functions: a long-standing open problem in mathematics, with symbolic transformers10 Oct 2024
- 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Process29 Jul 2024
12 newest of 15 All 15 (JSON)
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 216
- 2023Amortizing intractable inference in large language modelscited by 97
- 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 86
- 2024Transformers Can Do Arithmetic with the Right Embeddingscited by 78
- 2023GPT Can Solve Mathematical Problems Without a Calculatorcited by 68
- 2023Positional Description Matters for Transformers Arithmeticcited by 56
- 2023SNIP: Bridging Mathematical Symbolic and Numeric Realms with Unified Pre-trainingcited by 47
- 2024How Far Can Transformers Reason? The Globality Barrier and Inductive Scratchpadcited by 36
- 2024Universal Length Generalization with Turing Programscited by 25
- 2023Mathematical Language Models: A Surveycited by 24
- 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 23
- 2024On Provable Length and Compositional Generalizationcited by 22
12 most cited of 46 All 46 (JSON)
- 2026Can a Dynamic Internal Field Govern a Transformer's Cognition? Certifiability, not Superiority, in Homeostatic Compute Control25 Aug 2026
- 2026Can Transformers Learn to Verify During Backtracking Search?21 May 2026
- 2026Convex Optimization of Spiking Neural Networks with Global and Approximation Guarantees8 May 2026
- 2026Understanding In-Context Learning for Nonlinear Regression with Transformers: Attention as Featurizer6 May 2026
- 2026Generalization in LLM Problem Solving: The Case of the Shortest Path16 Apr 2026
- 2026The Long Delay to Arithmetic Generalization: When Learned Representations Outrun Behavior30 Mar 2026
- 2026On the Mirage of Long-Range Dependency, with an Application to Integer Multiplication30 Mar 2026
- 2026Length Generalization Bounds for Transformers13 Feb 2026
- 2025From Shortcut to Induction Head: How Data Diversity Shapes Algorithm Selection in Transformers21 Dec 2025
- 2025Exact Learning of Arithmetic with Differentiable Agents27 Nov 2025
- 2025To Infinity and Beyond: Tool-Use Unlocks Length Generalization in State Space Models16 Oct 2025
- 2025On the Limitations and Capabilities of Position Embeddings for Length Generalization5 Oct 2025
12 newest of 46 All 46 (JSON)