English

Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Tasks

Machine Learning 2025-08-07 v2 Artificial Intelligence

Abstract

Transformer-based models excel in various tasks but their generalization capabilities, especially in arithmetic reasoning, remain incompletely understood. Arithmetic tasks provide a controlled framework to explore these capabilities, yet performance anomalies persist, such as inconsistent effectiveness in multiplication and erratic generalization in modular addition (e.g., modulo 100 vs. 101). This paper develops a unified theoretical framework for understanding the generalization behaviors of transformers in arithmetic tasks, focusing on length generalization. Through detailed analysis of addition, multiplication, and modular operations, we reveal that translation invariance in addition aligns with relative positional encoding for robust generalization, while base mismatch in modular operations disrupts this alignment. Experiments across GPT-family models validate our framework, confirming its ability to predict generalization behaviors. Our work highlights the importance of task structure and training data distribution for achieving data-efficient and structure-aware training, providing a systematic approach to understanding of length generalization in transformers.

Keywords

Cite

@article{arxiv.2407.17963,
  title  = {Principled Understanding of Generalization for Generative Transformer Models in Arithmetic Reasoning Tasks},
  author = {Xingcheng Xu and Zibo Zhao and Haipeng Zhang and Yanqing Yang},
  journal= {arXiv preprint arXiv:2407.17963},
  year   = {2025}
}

Comments

Accepted by the 63rd Annual Meeting of the Association for Computational Linguistics (ACL 2025), Main Conference

R2 v1 2026-06-28T17:53:24.347Z