Learning the greatest common divisor: explaining transformer predictions
Not on the map. Why?
Abstract (arXiv)
The predictions of small transformers, trained to calculate the greatest common divisor (GCD) of two positive integers, can be fully characterized by looking at model inputs and outputs. As training proceeds, the model learns a list mathcal D of integers, products of divisors of the base used to represent integers and small primes, and predicts the largest element of mathcal D that divides both inputs. Training distributions impact performance. Models trained from uniform operands only learn a handful of GCD (up to 38 GCD ≤100). Log-uniform operands boost performance to 73 GCD ≤ 100, and a log-uniform distribution of outcomes (i.e. GCD) to 91. However, training from uniform (balanced) GCD breaks explainability.
Key facts. Cited by 33 papers in the map (data through 14 Oct 2026). Builds on 21 of its 31 references that are in the map. First posted on arXiv 29 Aug 2023.
Builds on
21 of 31 references.
References · 21
- 2017Attention Is All You Needcited by 60,361
- 2014Learning Phrase Representations using RNN Encoder-Decoder for Statistical Machine Translationcited by 4,057
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 886
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 839
- 2022Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasetscited by 629
- 2019Analysing Mathematical Reasoning Abilities of Neural Modelscited by 335
- 2019Deep Learning for Symbolic Mathematicscited by 270
- 2023The Clock and the Pizza: Two Stories in Mechanistic Explanation of Neural Networkscited by 156
- 2021Investigating the Limitations of Transformers with Simple Arithmetic Taskscited by 139
- 2023Teaching Arithmetic to Small Transformerscited by 123
- 2015Neural GPUs Learn Algorithmscited by 121
- 2022Teaching Algorithmic Reasoning via In-context Learningcited by 112
9 more
- 2018Neural Arithmetic Logic Unitscited by 70
- 2021Linear algebra with transformerscited by 63
- 2021Symbolic Brittleness in Sequence Models: on Systematic Generalization in Symbolic Mathematicscited by 27
- 2015Grid Long Short-Term Memorycited by 20
- 2022What is my math transformer doing? -- Three results on interpretability and generalizationcited by 19
- 2015Learning Simple Algorithms from Examplescited by 12
- 2021Transformer-based Machine Learning for Fast SAT Solvers and Logic Synthesiscited by 9
- 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: 2; 2024: 15; 2025: 10; 2026: 6.
33 papers.
Sort:
By area:
- 2024Formal Mathematical Reasoning: A New Frontier in AIcited by 81
- 2023Dichotomy of Early and Late Phase Implicit Biases Can Provably Induce Grokkingcited by 80
- 2024Beyond Model Collapse: Scaling Up with Synthesized Data Requires Verificationcited by 45
- 2024Why Do You Grok? A Theoretical Analysis of Grokking Modular Additioncited by 36
- 2024Opening the AI black box: program synthesis via mechanistic interpretabilitycited by 20
- 2024Transforming the Bootstrap: Using Transformers to Compute Scattering Amplitudes in Planar N = 4 Super Yang-Mills Theorycited by 18
- 2024Regress, Don't Guess -- A Regression-like Loss on Number Tokens for Language Modelscited by 13
- 2024Emergent properties with repeated examplescited by 11
- 2026To Grok Grokking: Provable Grokking in Ridge Regressioncited by 8
- 2023Learning to Compute Gr"obner Basescited by 7
- 2025Efficient numeracy in language models through single-token number embeddingscited by 7
- 2024A Triumvirate of AI Driven Theoretical Discoverycited by 5
21 more
- 2024Clustering and Alignment: Understanding the Training Dynamics in Modular Additioncited by 5
- 2024Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmeticcited by 4
- 2024Acceleration of Grokking in Learning Arithmetic Operations via Kolmogorov-Arnold Representationcited by 3
- 2025Lightweight Latent Verifiers for Efficient Meta-Generation Strategiescited by 3
- 2025Not All Explanations for Deep Learning Phenomena Are Equally Valuablecited by 3
- 2025From Black Box to Bijection: Interpreting Machine Learning to Build a Zeta Map Algorithmcited by 3
- 2026The Long Delay to Arithmetic Generalization: When Learned Representations Outrun Behaviorcited by 3
- 2024Transformers to Predict the Applicability of Symbolic Integration Routinescited by 2
- 2024Automated Software Vulnerability Static Code Analysis Using Generative Pre-Trained Transformer Modelscited by 1
- 2024A Mechanistic Study of Transformers Training Dynamicscited by 1
- 2025Generating particle physics Lagrangians with transformerscited by 1
- 2025Studying number theory with deep learning: a case study with the M"obius and squarefree indicator functionscited by 1
- 2025Int2Int: a framework for mathematics with transformerscited by 1
- 2025Discovering Learning-Friendly Generation Orders for Sequential Computationcited by 1
- 2026Gradient Flow Through Diagram Expansions: Learning Regimes and Explicit Solutionscited by 1
- 2026Numeracy in Large Language Models: Fundamental Limitations and Paths to Improvementcited by 1
- 2024Identifying Sub-networks in Neural Networks via Functionally Similar Representationscited by 0
- 2025Learning Moderately Input-Sensitive Functions: A Case Study in QR Code Decodingcited by 0
- 2025Learning Modular Exponentiation with Transformerscited by 0
- 2026Slower Generalization, Faster Memorization: A Sweet Spot in Algorithmic Learningcited by 0
- 2026Learning First Integrals via Backward-Generated Data and Guided Reinforcement Learningcited by 0
- 2026Numeracy in Large Language Models: Fundamental Limitations and Paths to Improvement13 Aug 2026
- 2026Learning First Integrals via Backward-Generated Data and Guided Reinforcement Learning20 May 2026
- 2026Slower Generalization, Faster Memorization: A Sweet Spot in Algorithmic Learning14 May 2026
- 2026The Long Delay to Arithmetic Generalization: When Learned Representations Outrun Behavior30 Mar 2026
- 2026Gradient Flow Through Diagram Expansions: Learning Regimes and Explicit Solutions4 Feb 2026
- 2026To Grok Grokking: Provable Grokking in Ridge Regression27 Jan 2026
- 2025From Black Box to Bijection: Interpreting Machine Learning to Build a Zeta Map Algorithm16 Nov 2025
- 2025Efficient numeracy in language models through single-token number embeddings8 Oct 2025
- 2025Discovering Learning-Friendly Generation Orders for Sequential Computation30 Jun 2025
- 2025Learning Modular Exponentiation with Transformers30 Jun 2025
- 2025Not All Explanations for Deep Learning Phenomena Are Equally Valuable29 Jun 2025
- 2025Learning Moderately Input-Sensitive Functions: A Case Study in QR Code Decoding25 Jun 2025
21 more
- 2025Lightweight Latent Verifiers for Efficient Meta-Generation Strategies23 Apr 2025
- 2025Int2Int: a framework for mathematics with transformers22 Feb 2025
- 2025Studying number theory with deep learning: a case study with the M"obius and squarefree indicator functions14 Feb 2025
- 2025Generating particle physics Lagrangians with transformers16 Jan 2025
- 2024Formal Mathematical Reasoning: A New Frontier in AI20 Dec 2024
- 2024Regress, Don't Guess -- A Regression-like Loss on Number Tokens for Language Models4 Nov 2024
- 2024A Mechanistic Study of Transformers Training Dynamics31 Oct 2024
- 2024Transformers to Predict the Applicability of Symbolic Integration Routines31 Oct 2024
- 2024Identifying Sub-networks in Neural Networks via Functionally Similar Representations21 Oct 2024
- 2024Emergent properties with repeated examples9 Oct 2024
- 2024Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmetic4 Oct 2024
- 2024Clustering and Alignment: Understanding the Training Dynamics in Modular Addition18 Aug 2024
- 2024Automated Software Vulnerability Static Code Analysis Using Generative Pre-Trained Transformer Models31 Jul 2024
- 2024Why Do You Grok? A Theoretical Analysis of Grokking Modular Addition17 Jul 2024
- 2024Beyond Model Collapse: Scaling Up with Synthesized Data Requires Verification11 Jun 2024
- 2024A Triumvirate of AI Driven Theoretical Discovery30 May 2024
- 2024Acceleration of Grokking in Learning Arithmetic Operations via Kolmogorov-Arnold Representation26 May 2024
- 2024Transforming the Bootstrap: Using Transformers to Compute Scattering Amplitudes in Planar N = 4 Super Yang-Mills Theory9 May 2024
- 2024Opening the AI black box: program synthesis via mechanistic interpretability7 Feb 2024
- 2023Dichotomy of Early and Late Phase Implicit Biases Can Provably Induce Grokking30 Nov 2023
- 2023Learning to Compute Gr"obner Bases21 Nov 2023
- 2023Dichotomy of Early and Late Phase Implicit Biases Can Provably Induce Grokkingcited by 80
- 2024Why Do You Grok? A Theoretical Analysis of Grokking Modular Additioncited by 36
- 2024Transforming the Bootstrap: Using Transformers to Compute Scattering Amplitudes in Planar N = 4 Super Yang-Mills Theorycited by 18
- 2024Regress, Don't Guess -- A Regression-like Loss on Number Tokens for Language Modelscited by 13
- 2024Emergent properties with repeated examplescited by 11
- 2026To Grok Grokking: Provable Grokking in Ridge Regressioncited by 8
- 2023Learning to Compute Gr"obner Basescited by 7
- 2025Efficient numeracy in language models through single-token number embeddingscited by 7
- 2024A Triumvirate of AI Driven Theoretical Discoverycited by 5
- 2024Clustering and Alignment: Understanding the Training Dynamics in Modular Additioncited by 5
- 2024Making Hard Problems Easier with Custom Data Distributions and Loss Regularization: A Case Study in Modular Arithmeticcited by 4
- 2024Acceleration of Grokking in Learning Arithmetic Operations via Kolmogorov-Arnold Representationcited by 3
12 most cited of 27 All 27 (JSON)
- 2026Slower Generalization, Faster Memorization: A Sweet Spot in Algorithmic Learning14 May 2026
- 2026The Long Delay to Arithmetic Generalization: When Learned Representations Outrun Behavior30 Mar 2026
- 2026Gradient Flow Through Diagram Expansions: Learning Regimes and Explicit Solutions4 Feb 2026
- 2026To Grok Grokking: Provable Grokking in Ridge Regression27 Jan 2026
- 2025From Black Box to Bijection: Interpreting Machine Learning to Build a Zeta Map Algorithm16 Nov 2025
- 2025Efficient numeracy in language models through single-token number embeddings8 Oct 2025
- 2025Discovering Learning-Friendly Generation Orders for Sequential Computation30 Jun 2025
- 2025Not All Explanations for Deep Learning Phenomena Are Equally Valuable29 Jun 2025
- 2025Learning Moderately Input-Sensitive Functions: A Case Study in QR Code Decoding25 Jun 2025
- 2025Lightweight Latent Verifiers for Efficient Meta-Generation Strategies23 Apr 2025
- 2025Int2Int: a framework for mathematics with transformers22 Feb 2025
- 2025Studying number theory with deep learning: a case study with the M"obius and squarefree indicator functions14 Feb 2025
12 newest of 27 All 27 (JSON)