English

Arithmetic with Language Models: from Memorization to Computation

Artificial Intelligence 2024-08-05 v4 Computation and Language

Abstract

A better understanding of the emergent computation and problem-solving capabilities of recent large language models is of paramount importance to further improve them and broaden their applicability. This work investigates how a language model, trained to predict the next token, can perform arithmetic computations generalizing beyond training data. Binary addition and multiplication constitute a good testbed for this purpose, since they require a very small vocabulary and exhibit relevant input/output discontinuities making smooth input interpolation ineffective for novel data. We successfully trained a light language model to learn these tasks and ran a number of experiments to investigate the extrapolation capabilities and internal information processing. Our findings support the hypothesis that the language model works as an Encoding-Regression-Decoding machine where the computation takes place in the value space once the input token representation is mapped to an appropriate internal representation.

Keywords

Cite

@article{arxiv.2308.01154,
  title  = {Arithmetic with Language Models: from Memorization to Computation},
  author = {Davide Maltoni and Matteo Ferrara},
  journal= {arXiv preprint arXiv:2308.01154},
  year   = {2024}
}

Comments

The article has been accepted for publication in Elsevier Neural Networks journal. The final version is available on the Elsevier ScienceDirect platform

R2 v1 2026-06-28T11:46:27.519Z