arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2405.20671cs.LGcs.AIcs.CL
收藏

位置耦合:利用任务结构提升算术Transformer的长度泛化能力

Position Coupling: Improving Length Generalization of Arithmetic Transformers Using Task Structure

Graduate School of AI, KAIST(韩国科学技术院人工智能研究生院);Google Research(谷歌研究院);NYU(纽约大学)

Hanseul Cho, Jaeyoung Cha, Pranjal Awasthi, Srinadh Bhojanapalli, Anupam Gupta, Chulhee Yun

AI总结:

针对Transformer算术任务长度泛化差的问题,提出将任务结构嵌入位置编码的位置耦合方法,经实验和理论验证可大幅提升泛化能力,且适用于多种算法任务。

摘要:

即便对于整数加法这类简单的算术任务,Transformer也很难泛化到比训练时遇到的序列更长的输入上。为解决这一问题,我们提出位置耦合(position coupling)方法,这是一种简单且有效的策略,直接将任务结构嵌入到仅解码器(decoder-only)Transformer的位置编码中。与为每个token分配唯一位置ID的普通绝对位置机制不同,我们为两个或更多“相关”token分配相同的位置ID;在整数加法任务中,我们将相同数位的数字视为处于同一位置。在实验层面,我们证明采用所提出的位置耦合后,在1至30位加法上训练的模型可泛化至最多200位加法(为训练长度的6.67倍)。在理论层面,我们证明带有耦合位置的1层Transformer可以解决涉及指数级位数的加法任务,而任何不带位置信息的1层Transformer都无法完全解决该任务。我们还证明位置耦合可应用于其他算法任务,例如Nx2乘法和一项二维任务。

英文摘要:

Even for simple arithmetic tasks like integer addition, it is challenging for Transformers to generalize to longer sequences than those encountered during training. To tackle this problem, we propose position coupling, a simple yet effective method that directly embeds the structure of the tasks into the positional encoding of a (decoder-only) Transformer. Taking a departure from the vanilla absolute position mechanism assigning unique position IDs to each of the tokens, we assign the same position IDs to two or more "relevant" tokens; for integer addition tasks, we regard digits of the same significance as in the same position. On the empirical side, we show that with the proposed position coupling, our models trained on 1 to 30-digit additions can generalize up to 200-digit additions (6.67x of the trained length). On the theoretical side, we prove that a 1-layer Transformer with coupled positions can solve the addition task involving exponentially many digits, whereas any 1-layer Transformer without positional information cannot entirely solve it. We also demonstrate that position coupling can be applied to other algorithmic tasks such as Nx2 multiplication and a two-dimensional task.

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

↑