Dissecting Multiplication in Transformers: Insights into LLMs
Not on the map. Why?
Abstract (arXiv)
Transformer-based large language models have achieved remarkable performance across various natural language processing tasks. However, they often struggle with seemingly easy tasks like arithmetic despite their vast capabilities. This stark disparity raise human's concerns about their safe and ethical use, hinder their widespread adoption.In this paper, we focus on a typical arithmetic task, integer multiplication, to explore and explain the imperfection of transformers in this domain. We provide comprehensive analysis of a vanilla transformer trained to perform n-digit integer multiplication. Our observations indicate that the model decomposes multiplication task into multiple parallel subtasks, sequentially optimizing each subtask for each digit to complete the final multiplication. Based on observation and analysis, we infer the reasons of transformers deficiencies in multiplication tasks lies in their difficulty in calculating successive carryovers and caching intermediate results, and confirmed this inference through experiments. Guided by these findings, we propose improvements to enhance transformers performance on multiplication tasks. These enhancements are validated through rigorous testing and mathematical modeling, not only enhance transformer's interpretability, but also improve its performance, e.g., we achieve over 99.9% accuracy on 5-digit integer multiplication with a tiny transformer, outperform LLMs GPT-4. Our method contributes to the broader fields of model understanding and interpretability, paving the way for analyzing more complex tasks and Transformer models. This work underscores the importance of explainable AI, helping to build trust in large language models and promoting their adoption in critical applications.
Key facts. Cited by 7 papers in the map (data through 7 Oct 2026). Builds on 14 of its 22 references that are in the map. First posted on arXiv 22 Jul 2024.
Builds on
14 of 22 references.
References · 14
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2022LaMDA: Language Models for Dialog Applicationscited by 1,218
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
- 2018RISE: Randomized Input Sampling for Explanation of Black-box Modelscited by 825
- 2022Galactica: A Large Language Model for Sciencecited by 736
- 2019A Multiscale Visualization of Attention in the Transformer Modelcited by 292
- 2018Explaining Image Classifiers by Counterfactual Generationcited by 144
- 2023Circuit Component Reuse Across Tasks in Transformer Language Modelscited by 105
2 more
Built on by
Citing papers per year: 2024: 1; 2025: 3; 2026: 3.
7 papers.
- 2025Exposing Numeracy Gaps: A Benchmark to Evaluate Fundamental Numerical Abilities in Large Language Modelscited by 14
- 2024Seq-VCR: Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoningcited by 9
- 2025Do Large Language Models Truly Grasp Addition? A Rule-Focused Diagnostic Using Two-Integer Arithmeticcited by 8
- 2025Increasing LLM response trustworthiness using voting ensemblescited by 1
- 2026On the Mirage of Long-Range Dependency, with an Application to Integer Multiplicationcited by 0
- 2026The Shape of Addition: Geometric Structures of Arithmetic in Large Language Modelscited by 0
- 2026TriPLU: Bypassing the Gate with Direct Trilinear Product FFNs in Tiny Language Modelscited by 0
- 2026TriPLU: Bypassing the Gate with Direct Trilinear Product FFNs in Tiny Language Models17 Jun 2026
- 2026The Shape of Addition: Geometric Structures of Arithmetic in Large Language Models29 May 2026
- 2026On the Mirage of Long-Range Dependency, with an Application to Integer Multiplication30 Mar 2026
- 2025Increasing LLM response trustworthiness using voting ensembles5 Oct 2025
- 2025Do Large Language Models Truly Grasp Addition? A Rule-Focused Diagnostic Using Two-Integer Arithmetic7 Apr 2025
- 2025Exposing Numeracy Gaps: A Benchmark to Evaluate Fundamental Numerical Abilities in Large Language Models16 Feb 2025
- 2024Seq-VCR: Preventing Collapse in Intermediate Transformer Representations for Enhanced Reasoning4 Nov 2024