mlsanityData to 14 Oct 2026

Stable, Fast and Accurate: Kernelized Attention with Relative Positional Encoding

arXiv 2106.12566 ↗First posted 23 Jun 2021cs.LG cs.CL stat.MLcited by 51

Not on the map. Why?

Abstract (arXiv)

The attention module, which is a crucial component in Transformer, cannot scale efficiently to long sequences due to its quadratic complexity. Many works focus on approximating the dot-then-exponentiate softmax function in the original attention, leading to sub-quadratic or even linear-complexity Transformer architectures. However, we show that these methods cannot be applied to more powerful attention modules that go beyond the dot-then-exponentiate style, e.g., Transformers with relative positional encoding (RPE). Since in many state-of-the-art models, relative positional encoding is used as default, designing efficient Transformers that can incorporate RPE is appealing. In this paper, we propose a novel way to accelerate attention calculation for Transformers with RPE on top of the kernelized attention. Based upon the observation that relative positional encoding forms a Toeplitz matrix, we mathematically show that kernelized attention with RPE can be calculated efficiently using Fast Fourier Transform (FFT). With FFT, our method achieves O(nlog n) time complexity. Interestingly, we further demonstrate that properly using relative positional encoding can mitigate the training instability problem of vanilla kernelized attention. On a wide range of tasks, we empirically show that our models can be trained from scratch without any optimization issues. The learned model performs better than many efficient Transformer variants and is faster than standard Transformer in the long-sequence regime.

Key facts. Cited by 51 papers in the map (data through 14 Oct 2026). Builds on 43 of its 53 references that are in the map. First posted on arXiv 23 Jun 2021.

Builds on

43 of 53 references.

References · 43

  1. 2017Attention Is All You Needcited by 60,361
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  3. 2014Adam: A Method for Stochastic Optimizationcited by 37,240
  4. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
  5. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
  6. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
  7. 2021Swin Transformer: Hierarchical Vision Transformer using Shifted Windowscited by 12,139
  8. 2020End-to-End Object Detection with Transformerscited by 7,414
  9. 2015Rethinking the Inception Architecture for Computer Visioncited by 5,475
  10. 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,899
  11. 2020Training data-efficient image transformers & distillation through attentioncited by 4,586
  12. 2015Neural Machine Translation of Rare Words with Subword Unitscited by 2,918
31 more
  1. 2019XLNet: Generalized Autoregressive Pretraining for Language Understandingcited by 2,811
  2. 2020DeBERTa: Decoding-enhanced BERT with Disentangled Attentioncited by 2,181
  3. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 2,022
  4. 2018SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processingcited by 1,989
  5. 2020Conformer: Convolution-augmented Transformer for Speech Recognitioncited by 1,863
  6. 2017Decoupled Weight Decay Regularizationcited by 1,831
  7. 2020Reformer: The Efficient Transformercited by 1,668
  8. 2020Rethinking Attention with Performerscited by 1,601
  9. 2019Generating Long Sequences with Sparse Transformerscited by 1,546
  10. 2019fairseq: A Fast, Extensible Toolkit for Sequence Modelingcited by 1,488
  11. 2020Linformer: Self-Attention with Linear Complexitycited by 1,474
  12. 2018Self-Attention with Relative Position Representationscited by 1,120
  13. 2015Aligning Books and Movies: Towards Story-like Visual Explanations by Watching Movies and Reading Bookscited by 1,043
  14. 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 1,003
  15. 2020Efficient Transformers: A Surveycited by 790
  16. 2018Image Transformercited by 772
  17. 2021Maximum Likelihood Training of Score-Based Diffusion Modelscited by 672
  18. 2021Nystr"omformer: A Nystr"om-Based Algorithm for Approximating Self-Attentioncited by 471
  19. 2017A Downsampled Variant of ImageNet as an Alternative to the CIFAR datasetscited by 377
  20. 2019Axial Attention in Multidimensional Transformerscited by 358
  21. 2021Random Feature Attentioncited by 354
  22. 2018A Simple Method for Commonsense Reasoningcited by 223
  23. 2019Transformer Dissection: A Unified Understanding of Transformer's Attention via the Lens of Kernelcited by 213
  24. 2020UniLMv2: Pseudo-Masked Language Models for Unified Language Model Pre-Trainingcited by 204
  25. 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
  26. 2019Blockwise Self-Attention for Long Document Understandingcited by 159
  27. 2020Fast Transformers with Clustered Attentioncited by 123
  28. 2021Finetuning Pretrained Transformers into RNNscited by 96
  29. 2021Do Transformer Modifications Transfer Across Implementations and Applications?cited by 87
  30. 2021Densely connected normalizing flowscited by 49
  31. 2020SMYRF: Efficient Attention using Asymmetric Clusteringcited by 43

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2021: 5; 2022: 12; 2023: 10; 2024: 10; 2025: 6; 2026: 8.

51 papers.

Sort:

By area:

  1. 2022Hungry Hungry Hippos: Towards Language Modeling with State Space Modelscited by 499
  2. 2022What Makes Convolutional Models Great on Long Sequence Modeling?cited by 87
  3. 2022KERPLE: Kernelized Relative Positional Embedding for Length Extrapolationcited by 86
  4. 2022Flowformer: Linearizing Transformers with Conservation Flowscited by 69
  5. 2024RNNs are not Transformers (Yet): The Key Bottleneck on In-context Retrievalcited by 64
  6. 2022Your Transformer May Not be as Powerful as You Expectcited by 55
  7. 2021From block-Toeplitz matrices to differential equations on graphs: towards a general theory for scalable masked Transformerscited by 38
  8. 2024DAPE: Data-Adaptive Positional Encoding for Length Extrapolationcited by 31
  9. 2022Attention Mechanism in Neural Networks: Where it Comes and Where it Goescited by 29
  10. 2021Hybrid Random Featurescited by 25
  11. 2023Efficient Attention via Control Variatescited by 23
  12. 2023ESSAformer: Efficient Transformer for Hyperspectral Image Super-resolutioncited by 23
38 more
  1. 2024Do Efficient Transformers Really Save Computation?cited by 20
  2. 2025Learning the RoPEs: Better 2D and 3D Position Encodings with STRINGcited by 19
  3. 2021Can Vision Transformers Perform Convolution?cited by 18
  4. 2021On Learning the Transformer Kernelcited by 15
  5. 2024Locality-Sensitive Hashing-Based Efficient Point Transformer with Applications in High-Energy Physicscited by 12
  6. 2022A Quality Index Metric and Method for Online Self-Assessment of Autonomous Vehicles Sensory Perceptioncited by 10
  7. 2023Learning a Fourier Transform for Linear Relative Positional Encodings in Transformerscited by 10
  8. 2024Let the Code LLM Edit Itself When You Edit the Codecited by 10
  9. 2024DAPE V2: Process Attention Score as Feature Map for Length Extrapolationcited by 10
  10. 2023Simplex Random Featurescited by 9
  11. 2023Mnemosyne: Learning to Train Transformers with Transformerscited by 9
  12. 2023Monotonic Location Attention for Length Generalizationcited by 9
  13. 2023Single Cells Are Spatial Tokens: Transformers for Spatial Transcriptomic Data Imputationcited by 7
  14. 2024Linear Transformer Topological Masking with Graph Random Featurescited by 7
  15. 2025Statistical Advantage of Softmax Attention: Insights from Single-Location Regressioncited by 7
  16. 2022Improving Sample Efficiency of Value Based Models Using Attention and Vision Transformerscited by 4
  17. 2022Self-explaining Hierarchical Model for Intraoperative Time Seriescited by 4
  18. 2022DBA: Efficient Transformer with Dynamic Bilinear Low-Rank Attentioncited by 4
  19. 2023MEGA: Multimodal Alignment Aggregation and Distillation For Cinematic Video Segmentationcited by 4
  20. 2025Linear Attention for Efficient Bidirectional Sequence Modelingcited by 4
  21. 2025LOTFormer: Doubly-Stochastic Linear Attention via Low-Rank Optimal Transportcited by 4
  22. 2024Fast Tree-Field Integrators: From Low Displacement Rank to Topological Transformerscited by 3
  23. 2021Ripple Attention for Visual Perception with Sub-quadratic Complexitycited by 2
  24. 2024Building on Efficient Foundations: Effectively Training LLMs with Structured Feedforward Layerscited by 2
  25. 2025Degrees of Freedom for Linear Attention: Distilling Softmax Attention with Optimal Feature Efficiencycited by 2
  26. 2026NeuroGame Transformer: Gibbs-Inspired Attention Driven by Game Theory and Statistical Physicscited by 2
  27. 2022FastRPB: a Scalable Relative Positional Encoding for Long Sequence Taskscited by 1
  28. 2022Lightweight Structure-Aware Attention for Visual Understandingcited by 1
  29. 2024In-context Learning for Mixture of Linear Regressions: Existence, Generalization and Training Dynamicscited by 1
  30. 2025From Small to Large: Generalization Bounds for Transformers on Variable-Size Inputscited by 1
  31. 2026RelFlexformer: Efficient Attention 3D-Transformers for Integrable Relative Positional Encodingscited by 1
  32. 2026SMat-Attention: Structured Long-Context Sequence Modelingcited by 1
  33. 2023TAP: The Attention Patch for Cross-Modal Knowledge Transfer from Unlabeled Modalitycited by 0
  34. 2023SKI to go Faster: Accelerating Toeplitz Neural Networks via Asymmetric Kernelscited by 0
  35. 2026Chimera: Neuro-Symbolic Attention Primitives for Trustworthy Dataplane Intelligencecited by 0
  36. 2026Projection-Free Transformers via Gaussian Kernel Attentioncited by 0
  37. 2026Improving Adversarial Robustness of Attribution via Implicit Regularizationcited by 0
  38. 2026A Coulomb Particle Model for Learning Kernel Attention in Transformerscited by 0

50 most cited of 51 All 51 (JSON)