Executing Arithmetic: Fine-Tuning Large Language Models as Turing Machines

Junyu Lai, Jiahe Xu, Yao Yang, Yunpeng Huang, Chun Cao +1 more
10/10/2024
cs.AI

No official code found. Best implementation: NJUDeepEngine/CAEF (11 stars, last commit 2024-10-11).

Abstract

Large Language Models (LLMs) have demonstrated remarkable capabilities across a wide range of natural language processing and reasoning tasks. However, their performance in the foundational domain of arithmetic remains unsatisfactory. When dealing with arithmetic tasks, LLMs often memorize specific examples rather than learning the underlying computational logic, limiting their ability to generalize to new problems. In this paper, we propose a Composable Arithmetic Execution Framework (CAEF) that enables LLMs to learn to execute step-by-step computations by emulating Turing Machines, thereby gaining a genuine understanding of computational logic. Moreover, the proposed framework is highly scalable, allowing composing learned operators to significantly reduce the difficulty of learning complex operators. In our evaluation, CAEF achieves nearly 100% accuracy across seven common mathematical operations on the LLaMA 3.1-8B model, effectively supporting computations involving operands with up to 100 digits, a level where GPT-4o falls short noticeably in some settings.

View on arXivView PDF

Code Implementations(1)

NJUDeepEngine/CAEFCommunity100%

Code for paper: "Executing Arithmetic: Fine-Tuning Large Language Models as Turing Machines"

110PythonOct 10, 20242 years ago

Cite this paper

@article{lai2024executing,
  title  = {Executing Arithmetic: Fine-Tuning Large Language Models as Turing Machines},
  author = {Junyu Lai and Jiahe Xu and Yao Yang and Yunpeng Huang and Chun Cao and Jingwei Xu},
  year   = {2024},
  eprint = {2410.07896},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.07896v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.07896.svg)](https://codeofpaper.com/paper/2410.07896)

Discussion