Investigating the Limitations of Transformers with Simple Arithmetic Tasks

By Rodrigo Nogueira, Jimmy J. Li. 2021

163 citations recorded by the source corpus.

The ability to perform arithmetic tasks is a remarkable trait of human intelligence and might form a critical component of more complex reasoning tasks. In this work, we investigate if the surface form of a number has any influence on how sequence-to-sequence language models learn simple arithmetic tasks such as addition and subtraction across a wide range of values. We find that how a number is represented in its surface form has a strong influence on the model's accuracy. In particular, the model fails to learn addition of five-digit numbers when using subwords (e.g.,"32"), and it struggles to learn with character-level representations (e.g.,"3 2"). By introducing position tokens (e.g.,"3 10e1 2"), the model learns to accurately add and subtract numbers up to 60 digits. We conclude that modern pretrained language models can easily learn arithmetic from very few examples, as long as we use the proper surface representation. This result bolsters evidence that subword tokenizers and positional encodings are components in current transformer designs that might need improvement. Moreover, we show that regardless of the number of parameters and training examples, models cannot learn addition rules that are independent of the length of the numbers seen during training. Code to reproduce our experiments is available at https://github.com/castorini/transformers-arithmetic

Subfields: Artificial Intelligence, Large Language Models, Natural Language Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Graham Neubig
  2. Mohit Bansal
  3. Yoshua Bengio
  4. Pengfei Liu
  5. Luyu Gao
  6. Jianfeng Gao
  7. Luke S. Zettlemoyer
  8. Kyunghyun Cho

In Large Language Models

  1. Graham Neubig
  2. Xifeng Yan
  3. Hong Wang
  4. SHIYANG LI
  5. Zekun Li
  6. Jingu Qian
  7. Pengfei Liu
  8. Yue Zhang

In Natural Language Processing

  1. Luyu Gao
  2. Graham Neubig
  3. Pengfei Liu
  4. Yue Zhang
  5. Shuyan Zhou
  6. Uri Alon
  7. Cunxiang Wang
  8. Jamie Callan

Citations in the corpus