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

线性化相对位置编码

Linearized Relative Positional Encoding

Shanghai AI Laboratory(上海人工智能实验室);Australian National University(澳大利亚国立大学);Northwestern Polytechnical University(西北工业大学);The University of Hong Kong(香港大学)

Zhen Qin, Weixuan Sun, Kaiyue Lu, Hui Deng, Dongxu Li, Xiaodong Han, Yuchao Dai, Lingpeng Kong, Yiran Zhong

AI总结:

本研究针对线性Transformer缺乏适用相对位置编码设计原则的问题,整合现有方法并通过酉变换提出LRPE编码族,在多项任务中取得最优性能,提供了通用设计范式。

摘要:

相对位置编码被广泛应用于普通Transformer和线性Transformer中以表示位置信息。然而,普通Transformer的现有编码方法并非总能直接应用于线性Transformer,因为后者需要将查询和键表示分解为独立的核函数。尽管如此,适用于线性Transformer的编码方法设计原则仍未得到充分研究。在本研究中,我们将多种现有的线性相对位置编码方法整合为一种规范形式,并进一步通过酉变换提出了一类线性相对位置编码算法。我们的公式构建了一个原则性框架,可用于开发保持线性时空复杂度的新型相对位置编码方法。结合不同模型,所提出的线性化相对位置编码(LRPE)族能为各类应用生成有效的编码。实验表明,与现有方法相比,LRPE在语言建模、文本分类和图像分类任务中取得了当前最优性能。同时,它为设计更多可应用于线性Transformer的通用相对位置编码方法提供了通用范式。代码可在https://github.com/OpenNLPLab/Lrpe获取。

英文摘要:

Relative positional encoding is widely used in vanilla and linear transformers to represent positional information. However, existing encoding methods of a vanilla transformer are not always directly applicable to a linear transformer, because the latter requires a decomposition of the query and key representations into separate kernel functions. Nevertheless, principles for designing encoding methods suitable for linear transformers remain understudied. In this work, we put together a variety of existing linear relative positional encoding approaches under a canonical form and further propose a family of linear relative positional encoding algorithms via unitary transformation. Our formulation leads to a principled framework that can be used to develop new relative positional encoding methods that preserve linear space-time complexity. Equipped with different models, the proposed linearized relative positional encoding (LRPE) family derives effective encoding for various applications. Experiments show that compared with existing methods, LRPE achieves state-of-the-art performance in language modeling, text classification, and image classification. Meanwhile, it emphasizes a general paradigm for designing broadly more relative positional encoding methods that are applicable to linear transformers. The code is available at https://github.com/OpenNLPLab/Lrpe.

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

↑