mlsanityData to 7 Oct 2026

Pre-trained Large Language Models Use Fourier Features to Compute Addition

arXiv 2406.03445 ↗First posted 5 Jun 2024cs.LG cs.CLcited by 38

On the map: LLM reasoning → Mathematical reasoning

Abstract (arXiv)

Pre-trained large language models (LLMs) exhibit impressive mathematical reasoning capabilities, yet how they compute basic arithmetic, such as addition, remains unclear. This paper shows that pre-trained LLMs add numbers using Fourier features -- dimensions in the hidden state that represent numbers via a set of features sparse in the frequency domain. Within the model, MLP and attention layers use Fourier features in complementary ways: MLP layers primarily approximate the magnitude of the answer using low-frequency features, while attention layers primarily perform modular addition (e.g., computing whether the answer is even or odd) using high-frequency features. Pre-training is crucial for this mechanism: models trained from scratch to add numbers only exploit low-frequency features, leading to lower accuracy. Introducing pre-trained token embeddings to a randomly initialized model rescues its performance. Overall, our analysis demonstrates that appropriate pre-trained representations (e.g., Fourier features) can unlock the ability of Transformers to learn precise mechanisms for algorithmic tasks.

Key facts. Cited by 38 papers in the map (data through 7 Oct 2026). Placed in Mathematical reasoning, one of 17 directions in LLM reasoning. Builds on 29 of its 47 references that are in the map. First posted on arXiv 5 Jun 2024.

Builds on

29 of 47 references.

Closest ancestors · 2

Same direction, newest first

  1. 2022Limitations of Language Models in Arithmetic and Symbolic Induction9 Aug
  2. 2022NumGLUE: A Suite of Fundamental yet Challenging Mathematical Reasoning Tasks12 Apr

Other references · 27

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2021Training Verifiers to Solve Math Word Problemscited by 9,743
  4. 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,203
  5. 2020Fourier Features Let Networks Learn High Frequency Functions in Low Dimensional Domainscited by 2,170
  6. 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
  7. 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
  8. 2022Transformers learn in-context by gradient descentcited by 714
  9. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
  10. 2022Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasetscited by 599
  11. 2021Knowledge Neurons in Pretrained Transformerscited by 590
  12. 2023Eliciting Latent Predictions from Transformers with the Tuned Lenscited by 579
15 more
  1. 2022Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Spacecited by 522
  2. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  3. 2023Physics of Language Models: Part 3.1, Knowledge Storage and Extractioncited by 264
  4. 2023Mathematical Capabilities of ChatGPTcited by 263
  5. 2023How does GPT-2 compute greater-than?: Interpreting mathematical abilities in a pre-trained language modelcited by 199
  6. 2023A Toy Model of Universality: Reverse Engineering How Networks Learn Group Operationscited by 141
  7. 2021Investigating the Limitations of Transformers with Simple Arithmetic Taskscited by 136
  8. 2023Teaching Arithmetic to Small Transformerscited by 121
  9. 2023Language Models Implement Simple Word2Vec-style Vector Arithmeticcited by 97
  10. 2021Representing Numbers in NLP: a Survey and a Visioncited by 83
  11. 2022Finding Skill Neurons in Pre-trained Transformer-based Language Modelscited by 65
  12. 2023Feature emergence via margin maximization: case studies in algebraic taskscited by 33
  13. 2023Harmonics of Learning: Universal Fourier Features Emerge in Invariant Networkscited by 23
  14. 2022Bispectral Neural Networkscited by 17
  15. 2023A polar prediction model for learning to represent visual transformationscited by 6

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 3; 2025: 21; 2026: 14.

38 papers.

Sort:

By area:

  1. 2024Arithmetic Without Algorithms: Language Models Solve Math With a Bag of Heuristicscited by 94
  2. 2026When Models Manipulate Manifolds: The Geometry of a Counting Taskcited by 43
  3. 2024Language Models Encode Numbers Using Digit Representations in Base 10cited by 32
  4. 2025FoNE: Precise Single-Token Number Embeddings via Fourier Featurescited by 21
  5. 2025Probing for Arithmetic Errors in Language Modelscited by 17
  6. 2025Implicit Reasoning in Transformers is Reasoning through Shortcutscited by 14
  7. 2025Alternating Gradient Flows: A Theory of Feature Learning in Two-layer Neural Networkscited by 11
  8. 2025Understanding In-context Learning of Addition via Activation Subspacescited by 8
  9. 2026Why Larger Models Learn More: Effects of Capacity, Interference, and Rare-Task Retentioncited by 8
  10. 2026Sequential Group Composition: A Window into the Mechanics of Deep Learningcited by 7
  11. 2025Mechanistic Indicators of Understanding in Large Language Modelscited by 6
  12. 2025Modular Arithmetic: Language Models Solve Math Digit by Digitcited by 6
26 more
  1. 2024Composing Global Solutions to Reasoning Tasks via Algebraic Objects in Neural Netscited by 5
  2. 2026Convergent Evolution: How Different Language Models Learn Similar Number Representationscited by 5
  3. 2025CoCo-CoLa: Evaluating and Improving Language Adherence in Multilingual LLMscited by 4
  4. 2025Path Channels and Plan Extension Kernels: a Mechanistic Description of Planning in a Sokoban RNNcited by 4
  5. 2025Language Models Do Not Embed Numbers Continuouslycited by 4
  6. 2025In-Context Algebracited by 4
  7. 2026The Geometric Inductive Bias of Grokking: Bypassing Phase Transitions via Architectural Topologycited by 4
  8. 2025Investigating Compositional Reasoning in Time Series Foundation Modelscited by 3
  9. 2025Block Circulant Adapter for Large Language Modelscited by 3
  10. 2025Addition in Four Movements: Mapping Layer-wise Information Trajectories in LLMscited by 3
  11. 2025Pre-trained Language Models Learn Remarkably Accurate Representations of Numberscited by 3
  12. 2025Latent Concept Disentanglement in Transformer-based Language Modelscited by 3
  13. 2026Structuring Sparsity: Block-Sparse Featurizers Capture Visual Concept Manifoldscited by 3
  14. 2025Function Induction and Task Generalization: An Interpretability Study with Off-by-One Additioncited by 2
  15. 2025StreetMath: Study of LLMs' Approximation Behaviorscited by 2
  16. 2025Sequential Enumeration in Large Language Modelscited by 2
  17. 2026Shattered Compositionality: Counterintuitive Learning Dynamics of Transformers for Arithmeticcited by 2
  18. 2026Disentangling Geometry, Performance, and Training in Language Modelscited by 2
  19. 2025Language Models Learn Universal Representations of Numbers and Here's Why You Should Carecited by 1
  20. 2026TabFM: A Zero-Shot Foundation Model for Tabular Datacited by 1
  21. 2025Reverse Browser: Vector-Image-to-Code Generatorcited by 0
  22. 2026Post-Routing Arithmetic in Llama-3: Last-Token Result Writing and Rotation-Structured Digit Directionscited by 0
  23. 2026Language Models Compare Quantities Using Number-specific and Unit-specific Heuristicscited by 0
  24. 2026Causal and Interpretable Structures in LLM Compositional Taskscited by 0
  25. 2026A Polyphonic Conception of AI Understandingcited by 0
  26. 2026TabFM-Auto: Self-Evolving Pipelines for Tabular Foundation Modelscited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024Language Models Do Hard Arithmetic Tasks Easily and Hardly Do Easy Arithmetic Tasks
  2. 2025Language Models Use Trigonometry to Do Addition
  3. 2024Unraveling Arithmetic in Large Language Models: The Role of Algebraic Structures
  4. 2024How Numerical Precision Affects Arithmetical Reasoning Capabilities of LLMs
  5. 2026Disentangling Mathematical Reasoning in LLMs: A Methodological Investigation of Internal Mechanisms
  6. 2022Overcoming Barriers to Skill Injection in Language Modeling: Case Study in Arithmetic
  7. 2025Do Large Language Models Truly Grasp Addition? A Rule-Focused Diagnostic Using Two-Integer Arithmetic
  8. 2022Impact of Pretraining Term Frequencies on Few-Shot Reasoning