Lune

ICLR2021Top-tier venue

Random Feature Attention

Hao Peng, Nikolaos Pappas, Dani Yogatama, Roy Schwartz, Noah A. Smith, Lingpeng Kong

Abstract

Transformers are state-of-the-art models for a variety of sequence modeling tasks. At their core is an attention function which models pairwise interactions between the inputs at every timestep. While attention is powerful, it does not scale efficiently to long sequences due to its quadratic time and space complexity in the sequence length. We propose RFA, a linear time and space attention that uses random feature methods to approximate the softmax function, and explore its application in transformers. RFA can be used as a drop-in replacement for conventional softmax attention and offers a straightforward way of learning with recency bias through an optional gating mechanism. Experiments on language modeling and machine translation demonstrate that RFA achieves similar or better performance compared to strong transformer baselines. In the machine translation experiment, RFA decodes twice as fast as a vanilla transformer. Compared to existing efficient transformer variants, RFA is competitive in terms of both accuracy and efficiency on three long text classification datasets. Our analysis shows that RFA's efficiency gains are especially notable on long sequences, suggesting that RFA will be particularly useful in tasks that require working with large inputs, fast decoding speed, or low memory footprints.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

138 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention cites Reformer: The Efficient Transformer
  • Long Range Arena : A Benchmark for Efficient Transformers cites Big Bird: Transformers for Longer Sequences
  • Long Range Arena : A Benchmark for Efficient Transformers cites Reformer: The Efficient Transformer
  • Big Bird: Transformers for Longer Sequences cites Reformer: The Efficient Transformer
  • Choose a Transformer: Fourier or Galerkin cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • Parallelizing Linear Transformers with the Delta Rule over Sequence Length cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • Parallelizing Linear Transformers with the Delta Rule over Sequence Length cites Big Bird: Transformers for Longer Sequences
  • Parallelizing Linear Transformers with the Delta Rule over Sequence Length cites Reformer: The Efficient Transformer
  • Parallelizing Linear Transformers with the Delta Rule over Sequence Length cites Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
  • FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision cites Big Bird: Transformers for Longer Sequences
  • FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision cites Reformer: The Efficient Transformer
  • Perceiver: General Perception with Iterative Attention cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • Perceiver: General Perception with Iterative Attention cites Long Range Arena : A Benchmark for Efficient Transformers
  • Perceiver: General Perception with Iterative Attention cites Reformer: The Efficient Transformer
  • Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers138

  1. Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space DualityTri Dao, Albert GuICML 2024 · 1,407 citations
  2. Perceiver: General Perception with Iterative AttentionAndrew Jaegle, Felix Gimeno, Andy Brock, Oriol Vinyals et al.ICML 2021 · 1,399 citations
  3. FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisionJay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar et al.NeurIPS 2024 · 727 citations
  4. Choose a Transformer: Fourier or GalerkinShuhao CaoNeurIPS 2021 · 516 citations
  5. Parallelizing Linear Transformers with the Delta Rule over Sequence LengthSonglin Yang, Bailin Wang, Yu Zhang, Yikang Shen et al.NeurIPS 2024 · 412 citations

Builds on15

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie et al.NeurIPS 2020 · 3,159 citations
  3. Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 citations
  4. Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 citations
  5. Long Range Arena : A Benchmark for Efficient TransformersYi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen et al.ICLR 2021 · 881 citations

Related papers

  1. Efficient Attention via Control VariatesLin Zheng, Jianbo Yuan, Chong Wang, Lingpeng KongICLR 2023 · 2 citations
  2. Linear Complexity Randomized Self-attention MechanismLin Zheng, Chong Wang, Lingpeng KongICML 2022 · 39 citations
  3. DARKER: Efficient Transformer with Data-driven Attention Mechanism for Time SeriesRundong Zuo, Guozhong Li, Rui Cao, Byron Choi et al.VLDB 2024 · 4 citations
  4. Luna: Linear Unified Nested AttentionXuezhe Ma, Xiang Kong, Sinong Wang, Chunting Zhou et al.NeurIPS 2021 · 145 citations
  5. Rethinking Attention with PerformersKrzysztof Marcin Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song et al.ICLR 2021 · 122 citations
Dusk over the sea between two cliffs drawn in fine vertical lines