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

从插值到外推:算术 Transformer 的完整长度泛化

From Interpolation to Extrapolation: Complete Length Generalization for Arithmetic Transformers

RDFZ(中国人民大学附属中学);Institute for Interdisciplinary Information Sciences, Tsinghua University(清华大学交叉信息研究院)

Shaoxiong Duan, Yining Shi, Wei Xu

AI总结:

针对 Transformer 学习算术算法时难以外推到更长序列的问题,提出 Attention Bias Calibration(ABC)自动校准注意力偏置,实现近乎完美的长度泛化并攻克 Parity 任务。

摘要:

本文研究 transformer 模型在学习加法和奇偶性等算术算法方面的内在能力。通过实验和注意力分析,我们识别出实现最佳长度泛化的若干关键因素。我们表明,在有针对性的注意力偏置帮助下,transformer 模型能够泛化到较长长度。特别地,我们的解决方案解决了 Parity 任务,这是 Transformer 一个众所周知且经理论证明的失败模式。随后,我们引入 Attention Bias Calibration(ABC),这是一个校准阶段,使模型能够自动学习适当的注意力偏置;我们证明这些偏置与相对位置编码中的机制相关。我们展示,使用 ABC 后,transformer 模型可在某些算术任务上实现前所未有的、近乎完美的长度泛化。此外,我们表明 ABC 与 RPE 和 LoRA 具有显著相似性,这可能表明其有应用于更复杂任务的潜力。

英文摘要:

In this paper, we investigate the inherent capabilities of transformer models in learning arithmetic algorithms, such as addition and parity. Through experiments and attention analysis, we identify a number of crucial factors for achieving optimal length generalization. We show that transformer models are able to generalize to long lengths with the help of targeted attention biasing. In particular, our solution solves the Parity task, a well-known and theoretically proven failure mode for Transformers. We then introduce Attention Bias Calibration (ABC), a calibration stage that enables the model to automatically learn the proper attention biases, which we show to be connected to mechanisms in relative position encoding. We demonstrate that using ABC, the transformer model can achieve unprecedented near-perfect length generalization on certain arithmetic tasks. In addition, we show that ABC bears remarkable similarities to RPE and LoRA, which may indicate the potential for applications to more complex tasks.

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

↑