[Paper Review] Linear Complexity Randomized Self-attention Mechanism
This paper proposes Linear Randomized Attention (LARA), a novel linear-complexity self-attention mechanism that combines the expressiveness of an unbiased randomized attention (RA) estimator with the efficiency of random feature approximations. By reinterpreting RFAs as self-normalized importance samplers, the authors derive RA, which uses query-specific distributions for higher fidelity, and then generalize it via multiple query-dependent proposals and multiple importance sampling to achieve linear complexity while significantly outperforming existing methods on vision, NLP, and video tasks.
Recently, random feature attentions (RFAs) are proposed to approximate the softmax attention in linear time and space complexity by linearizing the exponential kernel. In this paper, we first propose a novel perspective to understand the bias in such approximation by recasting RFAs as self-normalized importance samplers. This perspective further sheds light on an \emph{unbiased} estimator for the whole softmax attention, called randomized attention (RA). RA constructs positive random features via query-specific distributions and enjoys greatly improved approximation fidelity, albeit exhibiting quadratic complexity. By combining the expressiveness in RA and the efficiency in RFA, we develop a novel linear complexity self-attention mechanism called linear randomized attention (LARA). Extensive experiments across various domains demonstrate that RA and LARA significantly improve the performance of RFAs by a substantial margin.
Motivation & Objective
- To address the approximation bias in existing random feature attention (RFA) methods, which are biased toward the softmax attention due to self-normalization in estimation.
- To develop an unbiased estimator for the full softmax attention by reinterpreting RFA as a self-normalized importance sampler and constructing a query-specific positive random feature estimator.
- To combine the high expressiveness of the unbiased estimator (RA) with the linear complexity of RFA to create a new efficient attention mechanism.
- To achieve state-of-the-art performance on diverse sequence modeling tasks while maintaining linear time and space complexity.
Proposed method
- Reinterpret RFA as a self-normalized importance sampler to identify the source of bias in approximating softmax attention.
- Propose Randomized Attention (RA), an unbiased estimator that constructs positive random features using query-specific distributions, improving approximation fidelity.
- Generalize the importance sampling framework by introducing multiple query-dependent proposal distributions, each tailored to subsets of queries.
- Apply multiple importance sampling with adaptive weighting functions to combine estimates from multiple proposals, enabling query-specific adaptation.
- Decouple query-agnostic and query-dependent components in the weighting function to improve estimation efficiency and accuracy.
- Parameterize each proposal using Gaussian or Gaussian mixture distributions, trained end-to-end within the transformer framework.
Experimental results
Research questions
- RQ1Why do existing random feature attention methods exhibit approximation bias despite unbiased estimation of the exponential kernel?
- RQ2Can we construct an unbiased estimator for the full softmax attention by reinterpreting the approximation as importance sampling?
- RQ3How can we maintain the computational efficiency of RFA while improving the approximation fidelity of RA?
- RQ4What is the impact of multiple query-dependent proposals and adaptive weighting on the performance and complexity of the attention mechanism?
- RQ5Can the proposed method achieve superior performance across diverse tasks while retaining linear complexity?
Key findings
- RA achieves higher approximation fidelity than RFA and performs competitively with standard softmax attention, outperforming it on 3 out of 5 tasks in the LRA benchmark with a 59.30% average top-1 accuracy.
- LARA, the linear-complexity variant of RA, achieves 59.12% average top-1 accuracy on the LRA benchmark, outperforming Performer (57.63%) and other baselines across all five tasks.
- On ImageNet1k using DeiT-Tiny, LARA achieves 71.48% top-1 accuracy, significantly outperforming Performer (65.92%) and the single-proposal variant (68.42%).
- The ablation study confirms that multiple proposals and decoupled weighting functions improve performance by over 0.4% accuracy compared to coupled counterparts.
- Using simple Gaussian parameterization for proposal distributions yields performance comparable to more complex Gaussian mixtures, indicating robustness and efficiency.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.