NYU Center for Data Science(纽约大学数据科学中心);School of Computer Science, Tel Aviv University(特拉维夫大学计算机科学学院);Google Research(谷歌研究);Bar-Ilan University(巴伊兰大学);Google DeepMind(谷歌DeepMind)
Gilad Yehudai, Haim Kaplan, Guy Dar, Royi Rassin, Asma Ghandeharioun, Mor Geva, Amir Globerson
Large language models based on the transformer architecture can solve highly complex tasks, yet their fundamental limitations on simple algorithmic problems remain poorly understood. In this work, we focus on basic counting tasks and investigate how the difficulty of these tasks scales with the transformer embedding dimension, the context length, and the vocabulary size. We reveal a sharp theoretical phase transition governed by the relationship between the embedding dimension and the vocabulary size. When the dimension is at least as large as the vocabulary, transformers can perfectly maintain token counts. However, when the vocabulary exceeds the embedding dimension, the interference between non-orthogonal token representations forces the network weights to scale polynomially. This renders the exact counting algorithm numerically unstable and practically unlearnable. We empirically validate this bottleneck by training transformers from scratch, demonstrating a strict performance drop at the theoretical threshold and catastrophic out of distribution failure when scaling the vocabulary or context length. Furthermore, we show that state-of-the-art pretrained models suffer from similar failure cases. Our work reveals a critical blind spot absent from the current literature regarding the connection among these three parameters, proving that vocabulary size fundamentally dictates the difficulty of counting tasks.
Contextual Counting: A Mechanistic Study of Transformers on a Quantitative Task
New York University(纽约大学);Flatiron Institute(弗莱伦研究所);Lawrence Berkeley National Laboratory(劳伦斯伯克利国家实验室);University of Cambridge(剑桥大学);The University of Tokyo(东京大学);University of Colorado Boulder(科罗拉多大学博尔德分校);Prescient Design, Genentech(基因泰克公司Prescient Design部门);Princeton University(普林斯顿大学)
Shattered Compositionality: Counterintuitive Learning Dynamics of Transformers for Arithmetic
University of Wisconsin–Madison(威斯康星大学麦迪逊分校);Department of Computer Sciences, University of Wisconsin–Madison(威斯康星大学麦迪逊分校计算机科学系);Department of Statistics, University of Wisconsin–Madison(威斯康星大学麦迪逊分校统计学系)