arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2407.15160cs.CLcs.AIcs.LG
收藏

Transformer何时能数到n?

When Can Transformers Count to n?

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

AI总结:

研究揭示了Transformer在计数任务中受词汇量限制的理论瓶颈,证明词汇量决定计数难度。

摘要:

基于变压器架构的大语言模型能够解决高度复杂的任务,但它们在简单算法问题上的基本限制仍理解不清。在本工作中,我们聚焦于基础的计数任务,并研究这些任务的难度如何随着变压器嵌入维度、上下文长度和词汇量而变化。我们揭示了一种由嵌入维度和词汇量之间关系决定的理论相变。当维度至少等于词汇量时,变压器可以完美维持令牌计数。然而,当词汇量超过嵌入维度时,非正交令牌表示之间的干扰迫使网络权重以多项式方式增长。这使得精确计数算法在数值上不稳定且实际上无法学习。我们通过从头开始训练变压器来验证这一瓶颈,证明在理论阈值处存在严格的表现下降,并在扩大词汇量或上下文长度时出现灾难性分布外失败。此外,我们还显示,最先进的预训练模型也面临类似的问题。我们的工作揭示了当前文献中关于这三个参数之间关系的关键盲点,证明词汇量从根本上决定了计数任务的难度。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑