Transformers Can Do Arithmetic with the Right Embeddings
Not on the map. Why?
Abstract (arXiv)
The poor performance of transformers on arithmetic tasks seems to stem in large part from their inability to keep track of the exact position of each digit inside of a large span of digits. We mend this problem by adding an embedding to each digit that encodes its position relative to the start of the number. In addition to the boost these embeddings provide on their own, we show that this fix enables architectural modifications such as input injection and recurrent layers to improve performance even further. With positions resolved, we can study the logical extrapolation ability of transformers. Can they solve arithmetic problems that are larger and more complex than those in their training data? We find that training on only 20 digit numbers with a single GPU for one day, we can reach state-of-the-art performance, achieving up to 99% accuracy on 100 digit addition problems. Finally, we show that these gains in numeracy also unlock improvements on other multi-step reasoning tasks including sorting and multiplication.
Key facts. Cited by 77 papers in the map (data through 7 Oct 2026). Builds on 43 of its 48 references that are in the map. First posted on arXiv 27 May 2024.
Builds on
43 of 48 references.
References · 43
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023GPT-4 Technical Reportcited by 18,132
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2016Layer Normalizationcited by 5,579
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,772
- 2020GLU Variants Improve Transformercited by 1,724
- 2018Self-Attention with Relative Position Representationscited by 1,112
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2021Scaling Vision Transformerscited by 993
31 more
- 2018Universal Transformerscited by 613
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
- 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 496
- 2019Analysing Mathematical Reasoning Abilities of Neural Modelscited by 331
- 2023The Impact of Positional Encoding on Length Generalization in Transformerscited by 319
- 2023Looped Transformers as Programmable Computerscited by 224
- 2022Exploring Length Generalization in Large Language Modelscited by 204
- 2023What Algorithms can Transformers Learn? A Study in Length Generalizationcited by 198
- 2022Mega: Moving Average Equipped Gated Attentioncited by 178
- 2022DeepNet: Scaling Transformers to 1,000 Layerscited by 176
- 2019Adaptive Attention Span in Transformerscited by 148
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 135
- 2023Teaching Arithmetic to Small Transformerscited by 121
- 2023Randomized Positional Encodings Boost Length Generalization of Transformerscited by 114
- 2021Can You Learn an Algorithm? Generalizing from Easy to Hard Problems with Recurrent Networkscited by 108
- 2022The CLRS Algorithmic Reasoning Benchmarkcited by 103
- 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 84
- 2024Transformers Can Achieve Length Generalization But Not Robustlycited by 82
- 2022Cramming: Training a Language Model on a Single GPU in One Daycited by 81
- 2022Limitations of Language Models in Arithmetic and Symbolic Inductioncited by 71
- 2023GPT Can Solve Mathematical Problems Without a Calculatorcited by 68
- 2023Length Generalization in Arithmetic Transformerscited by 64
- 2022A Generalist Neural Algorithmic Learnercited by 58
- 2023Positional Description Matters for Transformers Arithmeticcited by 56
- 2022Dissecting Transformer Length Extrapolation via the Lens of Receptive Field Analysiscited by 39
- 2022End-to-end Algorithm Synthesis with Recurrent Networks: Logical Extrapolation Without Overthinkingcited by 33
- 2022Path Independent Equilibrium Models Can Better Exploit Test-Time Computationcited by 33
- 2024Simulation of Graph Algorithms with Looped Transformerscited by 29
- 2023Can neural networks do arithmetic? A survey on the elementary numerical skills of state-of-the-art deep learning modelscited by 18
- 2024Discrete Neural Algorithmic Reasoningcited by 8
- 2024Benchmarking ChatGPT on Algorithmic Reasoningcited by 8
Built on by
Citing papers per year: 2024: 23; 2025: 32; 2026: 22.
77 papers.
Sort:
By area:
- 2024Instructional Segment Embedding: Improving LLM Safety with Instruction Hierarchycited by 62
- 2025Any2AnyTryon: Leveraging Adaptive Position Embeddings for Versatile Virtual Clothing Taskscited by 62
- 2024Eliminating Position Bias of Language Models: A Mechanistic Approachcited by 61
- 2025Position: Graph Learning Will Lose Relevance Due To Poor Benchmarkscited by 52
- 2024Procedural Knowledge in Pretraining Drives Reasoning in Large Language Modelscited by 41
- 2024Reconciling Kaplan and Chinchilla Scaling Lawscited by 36
- 2025Self-Improving Transformers Overcome Easy-to-Hard and Length Generalization Challengescited by 30
- 2025Lower Bounds for Chain-of-Thought Reasoning in Hard-Attention Transformerscited by 28
- 2024Language Models Need Inductive Biases to Count Inductivelycited by 25
- 2024How Numerical Precision Affects Arithmetical Reasoning Capabilities of LLMscited by 24
- 2025Encode, Think, Decode: Scaling test-time reasoning with recursive latent thoughtscited by 23
- 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 22
38 more
- 2025FoNE: Precise Single-Token Number Embeddings via Fourier Featurescited by 21
- 2024Mixture of Parrots: Experts improve memorization more than reasoningcited by 20
- 2026Recurrent-Depth VLA: Implicit Test-Time Compute Scaling of Vision-Language-Action Models via Latent Iterative Reasoningcited by 17
- 2024LieRE: Lie Rotational Positional Encodingscited by 16
- 2025Exposing Numeracy Gaps: A Benchmark to Evaluate Fundamental Numerical Abilities in Large Language Modelscited by 14
- 2025Extrapolation by Association: Length Generalization Transfer in Transformerscited by 13
- 2025The Strawberry Problem: Emergence of Character-level Understanding in Tokenized Language Modelscited by 11
- 2025Revolution or Hype? Seeking the Limits of Large Models in Hardware Designcited by 9
- 2024Scaling Behavior for Large Language Models regarding Numeral Systems: An Example using Pythiacited by 8
- 2025The Role of Sparsity for Length Generalization in Transformerscited by 8
- 2025Quantitative Bounds for Length Generalization in Transformerscited by 8
- 2024How language models extrapolate outside the training data: A case study in Textualized Gridworldcited by 7
- 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMscited by 7
- 2025Chain-of-Experts: Unlocking the Communication Power of Mixture-of-Experts Modelscited by 7
- 2025Scaling Self-Supervised Representation Learning for Symbolic Piano Performancecited by 7
- 2025Comprehension Without Competence: Architectural Limits of LLMs in Symbolic Computation and Reasoningcited by 7
- 2025Efficient Parallel Samplers for Recurrent-Depth Models and Their Connection to Diffusion Language Modelscited by 7
- 2025Self-Supervised Transformers as Iterative Solution Improvers for Constraint Satisfactioncited by 6
- 2025Benford's Curse: Tracing Digit Bias to Numerical Hallucination in LLMscited by 6
- 2025Beyond Statistical Learning: Exact Learning Is Essential for General Intelligencecited by 6
- 2025Efficient numeracy in language models through single-token number embeddingscited by 6
- 2024Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Taskscited by 5
- 2024ENTP: Encoder-only Next Token Predictioncited by 5
- 2024Interleaving Text and Number Embeddings to Solve Mathemathics Problemscited by 5
- 2024Quantifying artificial intelligence through algorithmic generalizationcited by 5
- 2024DEPT: Decoupled Embeddings for Pre-training Language Modelscited by 4
- 2025Rethinking Addressing in Language Models via Contexualized Equivariant Positional Encodingcited by 4
- 2025Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networkscited by 4
- 2024Towards a Science Exocortexcited by 3
- 2025To Infinity and Beyond: Tool-Use Unlocks Length Generalization in State Space Modelscited by 3
- 2024Low-Dimension-to-High-Dimension Generalization And Its Implications for Length Generalizationcited by 2
- 2025GeoPE:A Unified Geometric Positional Embedding for Structured Tensorscited by 2
- 2026Understanding In-Context Learning for Nonlinear Regression with Transformers: Attention as Featurizercited by 2
- 2024Learning interpretable positional encodings in transformers depends on initializationcited by 1
- 2025Discovering Learning-Friendly Generation Orders for Sequential Computationcited by 1
- 2025CompoST: A Benchmark for Analyzing the Ability of LLMs To Compositionally Interpret Questions in a QALD Settingcited by 1
- 2026AI-rithmeticcited by 1
- 2026Training Transformers as a Universal Computercited by 1
50 most cited of 77 All 77 (JSON)
- 2026Why Do Conventional World Models Fail to Learn Cellular Automata?30 Sep 2026
- 2026Hidden Reasoning Must Leak, but Need Not Be Readable: Fundamental Opportunities and Limits for Chain-of-Thought Monitoring29 Sep 2026
- 2026The Geometry of Logic: Stratification Induces Semantic Structure and Robust Reasoning26 Sep 2026
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers31 Aug 2026
- 2026Numeracy in Large Language Models: Fundamental Limitations and Paths to Improvement13 Aug 2026
- 2026Mask-Based Priors Are More Persistent than Query-Key Initializations1 Aug 2026
- 2026Same Quantity, Different Answer: Numerical Representation Invariance in Language Models27 Jul 2026
- 2026How Should Transformers Encode Numeric Values in Electronic Health Records?1 Jul 2026
- 2026Prime Fourier Embeddings: A Principled Basis for Modular Arithmetic22 Jun 2026
- 2026The Confidence Shortcut: A Reasoning Failure Mode of Masked Diffusion Models27 May 2026
- 2026Length Generalization with Log-Depth Recurrent Units25 May 2026
- 2026Globally Optimal Training of Spiking Neural Networks via Parameter Reconstruction8 May 2026
38 more
- 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
- 2026Training Transformers as a Universal Computer28 Apr 2026
- 2026Arithmetic OOD Failure Unfolds in Stages in Minimal GPTs27 Mar 2026
- 2026AS2 -- Attention-Based Soft Answer Sets: An End-to-End Differentiable Neuro-Soft-Symbolic Reasoning Architecture19 Mar 2026
- 2026AI-rithmetic11 Feb 2026
- 2026Recurrent-Depth VLA: Implicit Test-Time Compute Scaling of Vision-Language-Action Models via Latent Iterative Reasoning8 Feb 2026
- 2026Breaking the Data Barrier in Learning Symbolic Computation: A Case Study on Variable Ordering Suggestion for Cylindrical Algebraic Decomposition20 Jan 2026
- 2026Neural Isomorphic Fields: A Transformer-based Algebraic Numerical Embedding17 Jan 2026
- 2026Training Language Models with homotokens Leads to Delayed Overfitting6 Jan 2026
- 2025LIME: Making LLM Data More Efficient with Linguistic Metadata Embeddings8 Dec 2025
- 2025GeoPE:A Unified Geometric Positional Embedding for Structured Tensors4 Dec 2025
- 2025Quantitative Bounds for Length Generalization in Transformers30 Oct 2025
- 2025Efficient Parallel Samplers for Recurrent-Depth Models and Their Connection to Diffusion Language Models16 Oct 2025
- 2025To Infinity and Beyond: Tool-Use Unlocks Length Generalization in State Space Models16 Oct 2025
- 2025Encode, Think, Decode: Scaling test-time reasoning with recursive latent thoughts8 Oct 2025
- 2025Efficient numeracy in language models through single-token number embeddings8 Oct 2025
- 2025On the Limitations and Capabilities of Position Embeddings for Length Generalization5 Oct 2025
- 2025PiERN: Token-Level Routing for Integrating High-Precision Computation and Reasoning17 Sep 2025
- 2025Reverse Browser: Vector-Image-to-Code Generator5 Sep 2025
- 2025Revolution or Hype? Seeking the Limits of Large Models in Hardware Design5 Sep 2025
- 2025CompoST: A Benchmark for Analyzing the Ability of LLMs To Compositionally Interpret Questions in a QALD Setting28 Jul 2025
- 2025Comprehension Without Competence: Architectural Limits of LLMs in Symbolic Computation and Reasoning14 Jul 2025
- 2025Beyond Statistical Learning: Exact Learning Is Essential for General Intelligence30 Jun 2025
- 2025Discovering Learning-Friendly Generation Orders for Sequential Computation30 Jun 2025
- 2025Scaling Self-Supervised Representation Learning for Symbolic Piano Performance30 Jun 2025
- 2025Chain-of-Experts: Unlocking the Communication Power of Mixture-of-Experts Models23 Jun 2025
- 2025Extrapolation by Association: Length Generalization Transfer in Transformers10 Jun 2025
- 2025Benford's Curse: Tracing Digit Bias to Numerical Hallucination in LLMs2 Jun 2025
- 2025Position as Probability: Self-Supervised Transformers that Think Past Their Training for Length Extrapolation1 Jun 2025
- 2025The Strawberry Problem: Emergence of Character-level Understanding in Tokenized Language Models20 May 2025
- 2025The Role of Sparsity for Length Generalization in Transformers24 Feb 2025
- 2025Learning to Add, Multiply, and Execute Algorithmic Instructions Exactly with Neural Networks24 Feb 2025
- 2025Position: Graph Learning Will Lose Relevance Due To Poor Benchmarks20 Feb 2025
- 2025Self-Supervised Transformers as Iterative Solution Improvers for Constraint Satisfaction18 Feb 2025
- 2025Beyond Single-Task: Robust Multi-Task Length Generalization for LLMs17 Feb 2025
- 2025Exposing Numeracy Gaps: A Benchmark to Evaluate Fundamental Numerical Abilities in Large Language Models16 Feb 2025
- 2025FoNE: Precise Single-Token Number Embeddings via Fourier Features13 Feb 2025
50 newest of 77 All 77 (JSON)
- 2024Procedural Knowledge in Pretraining Drives Reasoning in Large Language Modelscited by 41
- 2025Lower Bounds for Chain-of-Thought Reasoning in Hard-Attention Transformerscited by 28
- 2024How Numerical Precision Affects Arithmetical Reasoning Capabilities of LLMscited by 24
- 2025Encode, Think, Decode: Scaling test-time reasoning with recursive latent thoughtscited by 23
- 2026Recurrent-Depth VLA: Implicit Test-Time Compute Scaling of Vision-Language-Action Models via Latent Iterative Reasoningcited by 17
- 2025Comprehension Without Competence: Architectural Limits of LLMs in Symbolic Computation and Reasoningcited by 7
- 2025Beyond Statistical Learning: Exact Learning Is Essential for General Intelligencecited by 6
- 2024Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Taskscited by 5
- 2025Rethinking Addressing in Language Models via Contexualized Equivariant Positional Encodingcited by 4
- 2026Barriers to Universal Reasoning With Transformers (And How to Overcome Them)cited by 1
- 2026The Confidence Shortcut: A Reasoning Failure Mode of Masked Diffusion Modelscited by 1
- 2026Numeracy in Large Language Models: Fundamental Limitations and Paths to Improvementcited by 1
12 most cited of 19 All 19 (JSON)
- 2026Hidden Reasoning Must Leak, but Need Not Be Readable: Fundamental Opportunities and Limits for Chain-of-Thought Monitoring29 Sep 2026
- 2026The Geometry of Logic: Stratification Induces Semantic Structure and Robust Reasoning26 Sep 2026
- 2026Numeracy in Large Language Models: Fundamental Limitations and Paths to Improvement13 Aug 2026
- 2026The Confidence Shortcut: A Reasoning Failure Mode of Masked Diffusion Models27 May 2026
- 2026Barriers to Universal Reasoning With Transformers (And How to Overcome Them)28 Apr 2026
- 2026AS2 -- Attention-Based Soft Answer Sets: An End-to-End Differentiable Neuro-Soft-Symbolic Reasoning Architecture19 Mar 2026
- 2026Recurrent-Depth VLA: Implicit Test-Time Compute Scaling of Vision-Language-Action Models via Latent Iterative Reasoning8 Feb 2026
- 2026Breaking the Data Barrier in Learning Symbolic Computation: A Case Study on Variable Ordering Suggestion for Cylindrical Algebraic Decomposition20 Jan 2026
- 2025Encode, Think, Decode: Scaling test-time reasoning with recursive latent thoughts8 Oct 2025
- 2025PiERN: Token-Level Routing for Integrating High-Precision Computation and Reasoning17 Sep 2025
- 2025Comprehension Without Competence: Architectural Limits of LLMs in Symbolic Computation and Reasoning14 Jul 2025
- 2025Beyond Statistical Learning: Exact Learning Is Essential for General Intelligence30 Jun 2025
12 newest of 19 All 19 (JSON)
- 2025Any2AnyTryon: Leveraging Adaptive Position Embeddings for Versatile Virtual Clothing Taskscited by 62
- 2024Eliminating Position Bias of Language Models: A Mechanistic Approachcited by 61
- 2025Position: Graph Learning Will Lose Relevance Due To Poor Benchmarkscited by 52
- 2024Reconciling Kaplan and Chinchilla Scaling Lawscited by 36
- 2024Language Models Need Inductive Biases to Count Inductivelycited by 25
- 2024Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structurecited by 22
- 2025FoNE: Precise Single-Token Number Embeddings via Fourier Featurescited by 21
- 2024LieRE: Lie Rotational Positional Encodingscited by 16
- 2025Exposing Numeracy Gaps: A Benchmark to Evaluate Fundamental Numerical Abilities in Large Language Modelscited by 14
- 2025Extrapolation by Association: Length Generalization Transfer in Transformerscited by 13
- 2025The Strawberry Problem: Emergence of Character-level Understanding in Tokenized Language Modelscited by 11
- 2025Revolution or Hype? Seeking the Limits of Large Models in Hardware Designcited by 9
12 most cited of 52 All 52 (JSON)
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers31 Aug 2026
- 2026Mask-Based Priors Are More Persistent than Query-Key Initializations1 Aug 2026
- 2026Same Quantity, Different Answer: Numerical Representation Invariance in Language Models27 Jul 2026
- 2026How Should Transformers Encode Numeric Values in Electronic Health Records?1 Jul 2026
- 2026Prime Fourier Embeddings: A Principled Basis for Modular Arithmetic22 Jun 2026
- 2026Length Generalization with Log-Depth Recurrent Units25 May 2026
- 2026Globally Optimal Training of Spiking Neural Networks via Parameter Reconstruction8 May 2026
- 2026Understanding In-Context Learning for Nonlinear Regression with Transformers: Attention as Featurizer6 May 2026
- 2026Training Transformers as a Universal Computer28 Apr 2026
- 2026Arithmetic OOD Failure Unfolds in Stages in Minimal GPTs27 Mar 2026
- 2026AI-rithmetic11 Feb 2026
- 2026Neural Isomorphic Fields: A Transformer-based Algebraic Numerical Embedding17 Jan 2026
12 newest of 52 All 52 (JSON)