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.
Can "consciousness" be observed from large language model (LLM) internal states? Dissecting LLM representations obtained from Theory of Mind test with Integrated Information Theory and Span Representation analysis
Lost in Multilinguality: Dissecting Cross-lingual Factual Inconsistency in Transformer Language Models
Bosch Center for Artificial Intelligence(博世人工智能中心);LMU Munich(慕尼黑大学);Munich Center for Machine Learning (MCML)(慕尼黑机器学习中心);Hochschule der Medien(斯图加特媒体大学);Karlsruhe University of Applied Sciences(卡尔斯鲁厄应用技术大学)
MemoryFormer: Minimize Transformer Computation by Removing Fully-Connected Layers
State Key Lab of General AI, School of Intelligence Science and Technology, Peking University(人工智能国家重点实验室,智能科学与技术学院,北京大学);Huawei Noah’s Ark Lab(华为诺亚实验室);Huawei HiSilicon(华为海思)
Faith and Fate: Limits of Transformers on Compositionality
Allen Institute for Artificial Intelligence(艾伦人工智能研究所);University of Washington(华盛顿大学);University of Southern California(南加州大学);University of Chicago(芝加哥大学)
How Numerical Precision Affects Arithmetical Reasoning Capabilities of LLMs
State Key Laboratory of General Artificial Intelligence, School of Intelligence Science and Technology, Peking University(通用人工智能国家重点实验室,智能科学与技术学院,北京大学);School of EECS, Peking University(电子工程系,北京大学);Huawei Noah’s Ark Lab(华为诺亚实验室);Center for Machine Learning Research, Peking University(机器学习研究中心,北京大学)
Department of Mathematics and Statistics(数学与统计学系);York University(约克大学);Department of Computer Science(计算机科学系);University of California Davis(加州大学戴维斯分校);Market Risk Model Bank of Montreal Financial Group(蒙特利尔银行市场风险模型财务集团)