English

Arbitrary-Length Generalization for Addition in a Tiny Transformer

Machine Learning 2024-06-13 v2 Applications Machine Learning

Abstract

This paper introduces a novel training methodology that enables a Transformer model to generalize the addition of two-digit numbers to numbers with unseen lengths of digits. The proposed approach employs an autoregressive generation technique, processing from right to left, which mimics a common manual method for adding large numbers. To the best of my knowledge, this methodology has not been previously explored in the literature. All results are reproducible, and the corresponding R code is available at github.com/AGPatriota/ALGA-R/.

Cite

@article{arxiv.2406.00075,
  title  = {Arbitrary-Length Generalization for Addition in a Tiny Transformer},
  author = {Alexandre Galvao Patriota},
  journal= {arXiv preprint arXiv:2406.00075},
  year   = {2024}
}

Comments

Testing-Digits.R output with 50-digit numbers (8 pages, 1 figure)

R2 v1 2026-06-28T16:48:58.081Z