arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.17399cs.LGcs.AI
收藏

使用正确的嵌入,Transformers 能够进行算术运算

Transformers Can Do Arithmetic with the Right Embeddings

University of Maryland(马里兰大学);Lawrence Livermore National Laboratory(劳伦斯利弗莫尔国家实验室);ELLIS Institute Tübingen(图宾根ELLIS研究所);Max Planck Institute for Intelligent Systems(马克斯·普朗克智能系统研究所);Carnegie Mellon University(卡内基梅隆大学)

Sean McLeish, Arpit Bansal, Alex Stein, Neel Jain, John Kirchenbauer, Brian R. Bartoldson, Bhavya Kailkhura, Abhinav Bhatele, Jonas Geiping, Avi Schwarzschild, Tom Goldstein

AI总结:

针对Transformer在算术任务中无法追踪数字精确位置的问题,提出相对位置嵌入并结合架构修改,在100位加法上达99%准确率,并提升了排序和乘法等多步推理能力。

摘要:

Transformers 在算术任务上的糟糕表现似乎在很大程度上源于它们无法跟踪一大串数字中每个数字的精确位置。我们通过为每个数字添加一个嵌入来修复这个问题,该嵌入编码了数字相对于数字起始处的位置。除了这些嵌入本身带来的提升外,我们还表明这一修复使得诸如输入注入和循环层等架构修改能够进一步提升性能。在解决了位置问题后,我们可以研究 Transformers 的逻辑外推能力。它们能否解决比训练数据中更大、更复杂的算术问题?我们发现,仅使用单个 GPU 训练一天,在 20 位数字上训练,就能达到最先进的性能,在 100 位数字加法问题上实现高达 99% 的准确率。最后,我们表明这些在算术能力上的提升也解锁了在其他多步推理任务上的改进,包括排序和乘法。

英文摘要:

The poor performance of transformers on arithmetic tasks seems to stem in large part from their inability to keep track of the exact position of each digit inside of a large span of digits. We mend this problem by adding an embedding to each digit that encodes its position relative to the start of the number. In addition to the boost these embeddings provide on their own, we show that this fix enables architectural modifications such as input injection and recurrent layers to improve performance even further. With positions resolved, we can study the logical extrapolation ability of transformers. Can they solve arithmetic problems that are larger and more complex than those in their training data? We find that training on only 20 digit numbers with a single GPU for one day, we can reach state-of-the-art performance, achieving up to 99% accuracy on 100 digit addition problems. Finally, we show that these gains in numeracy also unlock improvements on other multi-step reasoning tasks including sorting and multiplication.

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

↑