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

DAPE:面向长度外推的数据自适应位置编码

DAPE: Data-Adaptive Positional Encoding for Length Extrapolation

CUHK(香港中文大学);NUS(新加坡国立大学);HKU(香港大学);HKBU(香港浸会大学)

Chuanyang Zheng, Yihang Gao, Han Shi, Minbin Huang, Jingyao Li, Jing Xiong, Xiaozhe Ren, Michael Ng, Xin Jiang, Zhenguo Li, Yu Li

AI总结:

本文提出数据自适应位置编码(DAPE),根据输入上下文动态调整位置编码,在Arxiv、Books3和CHE数据集上显著提升长度泛化性能,并在128训练长度下于8192评估长度上优于静态方法。

摘要:

位置编码在Transformer中起着至关重要的作用,显著影响模型性能和长度泛化能力。已有研究引入了绝对位置编码(APE)和相对位置编码(RPE)来区分给定序列中的token位置。然而,无论是APE还是RPE,在模型训练后都保持固定不变,与输入数据无关,限制了它们的适应性和灵活性。因此,我们期望理想的位置编码应当具有数据自适应性,并能根据给定的注意力动态调整。在本文中,我们提出了一种数据自适应位置编码(DAPE)方法,该方法根据输入上下文和学习的固定先验进行动态且语义上的调整。在真实世界数据集(Arxiv、Books3和CHE)上的实验验证表明,DAPE在训练长度和长度泛化方面提升了模型性能,且改进具有统计显著性。模型可视化表明,我们的模型能够同时保留局部和反局部信息。最后,我们成功地在序列长度128上训练模型,并在评估序列长度8192时取得了优于其他静态位置编码方法的性能,这揭示了自适应位置编码方法的优势。

英文摘要:

Positional encoding plays a crucial role in transformers, significantly impacting model performance and length generalization. Prior research has introduced absolute positional encoding (APE) and relative positional encoding (RPE) to distinguish token positions in given sequences. However, both APE and RPE remain fixed after model training regardless of input data, limiting their adaptability and flexibility. Hence, we expect that the desired positional encoding should be data-adaptive and can be dynamically adjusted with the given attention. In this paper, we propose a Data-Adaptive Positional Encoding (DAPE) method, which dynamically and semantically adjusts based on input context and learned fixed priors. Experimental validation on real-world datasets (Arxiv, Books3, and CHE) demonstrates that DAPE enhances model performances in terms of trained length and length generalization, where the improvements are statistically significant. The model visualization suggests that our model can keep both local and anti-local information. Finally, we successfully train the model on sequence length 128 and achieve better performance at evaluation sequence length 8192, compared with other static positional encoding methods, revealing the benefit of the adaptive positional encoding method.

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

↑