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

一种长度可外推的Transformer

A Length-Extrapolatable Transformer

Microsoft(微软)

Yutao Sun, Li Dong, Barun Patra, Shuming Ma, Shaohan Huang, Alon Benhaim, Vishrav Chaudhary, Xia Song, Furu Wei

摘要:

位置建模在Transformers中起着至关重要的作用。在本文中,我们专注于长度外推,即,在评估较长序列的同时训练短文本。我们将注意力分辨率定义为外推的指标。然后,我们提出了两个设计,以改善上述度量的Transformers。具体来说,我们引入了一个相对位置嵌入显式最大化注意力分辨率。此外,我们在推理过程中使用分块因果注意力,以获得更好的解决方案。我们用语言建模来评估不同的Transformer变体。实验结果表明,我们的模型实现了很强的性能,在两个内插和外推设置。该代码将在https://aka.ms/LeX-Transformer上提供。

英文摘要:

Position modeling plays a critical role in Transformers. In this paper, we focus on length extrapolation, i.e., training on short texts while evaluating longer sequences. We define attention resolution as an indicator of extrapolation. Then we propose two designs to improve the above metric of Transformers. Specifically, we introduce a relative position embedding to explicitly maximize attention resolution. Moreover, we use blockwise causal attention during inference for better resolution. We evaluate different Transformer variants with language modeling. Experimental results show that our model achieves strong performance in both interpolation and extrapolation settings. The code will be available at https://aka.ms/LeX-Transformer.

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

↑