FastRPB: a Scalable Relative Positional Encoding for Long Sequence Tasks

Maksim Zubkov, Daniil Gavrilov
2/23/2022
cs.LG
transformer-attention

Official code: maximzubkov/LinBERT (1 star, Python, last commit 2021-10-05).

Abstract

Transformers achieve remarkable performance in various domains, including NLP, CV, audio processing, and graph analysis. However, they do not scale well on long sequence tasks due to their quadratic complexity w.r.t. the inputs length.

Show full abstract

Linear Transformers were proposed to address this limitation. However, these models have shown weaker performance on the long sequence tasks comparing to the original one. In this paper, we explore Linear Transformer models, rethinking their two core components. Firstly, we improved Linear Transformer with Shift-Invariant Kernel Function SIKF, which achieve higher accuracy without loss in speed. Secondly, we introduce FastRPB which stands for Fast Relative Positional Bias, which efficiently adds positional information to self-attention using Fast Fourier Transformation. FastRPB is independent of the self-attention mechanism and can be combined with an original self-attention and all its efficient variants. FastRPB has O(N log(N)) computational complexity, requiring O(N) memory w.r.t. input sequence length N.

View on arXivView PDF

Code Implementations(1)

10Python, CudaOct 28, 20205 years agoNOASSERTION

Similar Papers

Cite this paper

@article{zubkov2022fastrpb,
  title  = {FastRPB: a Scalable Relative Positional Encoding for Long Sequence Tasks},
  author = {Maksim Zubkov and Daniil Gavrilov},
  year   = {2022},
  eprint = {2202.11364},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2202.11364}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2202.11364.svg)](https://codeofpaper.com/paper/2202.11364)

Discussion