Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
41 tokens/sec
GPT-4o
59 tokens/sec
Gemini 2.5 Pro Pro
41 tokens/sec
o3 Pro
7 tokens/sec
GPT-4.1 Pro
50 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

Linearized Relative Positional Encoding (2307.09270v1)

Published 18 Jul 2023 in cs.CL

Abstract: 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 LLMing, 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.

User Edit Pencil Streamline Icon: https://streamlinehq.com
Authors (9)
  1. Zhen Qin (105 papers)
  2. Weixuan Sun (31 papers)
  3. Kaiyue Lu (4 papers)
  4. Hui Deng (133 papers)
  5. Dongxu Li (40 papers)
  6. Xiaodong Han (19 papers)
  7. Yuchao Dai (123 papers)
  8. Lingpeng Kong (134 papers)
  9. Yiran Zhong (75 papers)
Citations (11)
Github Logo Streamline Icon: https://streamlinehq.com