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

位置描述对 Transformers 算术任务至关重要

Positional Description Matters for Transformers Arithmetic

University of Washington(华盛顿大学);Microsoft Research(微软研究院)

Ruoqi Shen, Sébastien Bubeck, Ronen Eldan, Yin Tat Lee, Yuanzhi Li, Yi Zhang

AI总结:

针对 Transformers 因依赖位置信息而在算术任务中表现不佳的问题,提出修改位置编码或任务表示的方法,使小模型在乘法和加法任务上实现优异的准确率与长度外推能力。

摘要:

Transformers 作为现代自然语言处理成功的关键,尽管拥有强大的能力(矛盾的是,这甚至包括出色的编程能力),但在算术任务上却常常表现不佳。我们观察到,一个关键的挑战是它们天真地依赖位置信息来解决具有少量数字的算术问题,这导致了在更大数字上的表现不佳。在此,我们深入探讨了位置编码的作用,并提出了几种解决该问题的方法:要么直接修改位置编码,要么修改算术任务的表示以不同方式利用标准位置编码。我们研究了这些修改在三个任务中的价值:(i) 经典乘法,(ii) 加法中的长度外推,以及 (iii) 自然语言上下文中的加法。对于(i),我们在一个小型数据集上训练了一个小模型(100M 参数和 300k 样本),该模型在(直接的,无暂存器)15 位数乘法上表现出卓越的资质,并且在 12 位数以内基本完美,而在此情境下的常规训练只会得到一个在 4 位数乘法上就失败的模型。在加法实验中,我们仅使用 120k 样本进行演示:对于(ii),从 10 位数外推到对 12 位数进行测试,而常规训练将毫无外推能力;对于(iii),在 5 位数以内几乎达到完美准确率,而常规训练仅能正确到 3 位数(在 120k 样本的训练集下,这本质上只是记忆)。

英文摘要:

Transformers, central to the successes in modern Natural Language Processing, often falter on arithmetic tasks despite their vast capabilities --which paradoxically include remarkable coding abilities. We observe that a crucial challenge is their naive reliance on positional information to solve arithmetic problems with a small number of digits, leading to poor performance on larger numbers. Herein, we delve deeper into the role of positional encoding, and propose several ways to fix the issue, either by modifying the positional encoding directly, or by modifying the representation of the arithmetic task to leverage standard positional encoding differently. We investigate the value of these modifications for three tasks: (i) classical multiplication, (ii) length extrapolation in addition, and (iii) addition in natural language context. For (i) we train a small model on a small dataset (100M parameters and 300k samples) with remarkable aptitude in (direct, no scratchpad) 15 digits multiplication and essentially perfect up to 12 digits, while usual training in this context would give a model failing at 4 digits multiplication. In the experiments on addition, we use a mere 120k samples to demonstrate: for (ii) extrapolation from 10 digits to testing on 12 digits numbers while usual training would have no extrapolation, and for (iii) almost perfect accuracy up to 5 digits while usual training would be correct only up to 3 digits (which is essentially memorization with a training set of 120k samples).

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

↑