LevAttention: Time, Space and Streaming Efficient Algorithm for Heavy Attentions
Ravindran Kannan, Chiranjib Bhattacharyya, Praneeth Kacham, David P. Woodruff
摘要
A central problem related to transformers can be stated as follows: given two n × d matrices Q and K, and a non-negative function f , define the matrix A as follows: (1) apply the function f to each entry of the n × n matrix QK T , and then (2) normalize each of the row sums of A to be equal to 1. The matrix A can be computed in O(n 2 d) time assuming f can be applied to a number in constant time, but the quadratic dependence on n is prohibitive in applications where it corresponds to long context lengths. For a large class of functions f , we show how to find all the "large attention scores", i.e., entries of A which are at least a positive value ε, in time with linear dependence on n (i.e., n • poly(d/ε)) for a positive parameter ε > 0. Our class of functions include all functions f of the form f (x) = |x| p , as explored recently in transformer models. Using recently developed tools from randomized numerical linear algebra, we prove that for any K, there is a "universal set" U ⊂ [n] of size independent of n, such that for any Q and any row i, the large attention scores Ai,j in row i of A all have j ∈ U . We also find U in n • poly(d/ε) time. Notably, we (1) make no assumptions on the data, (2) our workspace does not grow with n, and (3) our algorithms can be computed in streaming and parallel settings. We call the attention mechanism that uses only the subset of keys in the universal set as LevAttention since our algorithm to identify the universal set U is based on leverage scores. We empirically show the benefits of our scheme for vision transformers, showing how to train new models that use our universal set while training as well, showing that our model is able to consistently select "important keys" during training. * Ravindran Kannan is listed as the first author. The remaining authors are ordered alphabetically. D. Woodruff also acknowledges Office of Naval Research award number N000142112647.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 1 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Random Feature Attention 引用了 Sparse Sinkhorn Attention
- Random Feature Attention 引用了 Reformer: The Efficient Transformer
- Sparse Sinkhorn Attention 引用了 Reformer: The Efficient Transformer
- Sublinear Time Quantum Algorithm for Attention Approximation 引用了 Random Feature Attention
- Sublinear Time Quantum Algorithm for Attention Approximation 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Sublinear Time Quantum Algorithm for Attention Approximation 引用了 Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention
- Sublinear Time Quantum Algorithm for Attention Approximation 引用了 Reformer: The Efficient Transformer
- Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention 引用了 Reformer: The Efficient Transformer
引用它的顶会 Paper1
它引用的 Paper15
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn 等ICLR 2021 · 21,477 次引用
- Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 次引用
- Nyströmformer: A Nyström-based Algorithm for Approximating Self-AttentionYunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan 等AAAI 2021 · 675 次引用
- Random Feature AttentionHao Peng, Nikolaos Pappas, Dani Yogatama, Roy Schwartz 等ICLR 2021 · 425 次引用
- Sparse Sinkhorn AttentionYi Tay, Dara Bahri, Liu Yang, Donald Metzler 等ICML 2020 · 391 次引用
相关 Paper
- Fast Attention Requires Bounded EntriesJosh Alman, Zhao SongNeurIPS 2023 · 115 次引用
- H-Transformer-1D: Fast One-Dimensional Hierarchical Attention for SequencesZhenhai Zhu, Radu SoricutACL 2021
- Subquadratic Algorithms and Hardness for Attention with Any TemperatureShreya Gupta, Boyang Huang, Barna Saha, Yinzhan Xu 等ICLR 2026 · 5 次引用
- How to Capture Higher-order Correlations? Generalizing Matrix Softmax Attention to Kronecker ComputationJosh Alman, Zhao SongICLR 2024 · 53 次引用
- Improved Algorithms for Kernel Matrix-Vector Multiplication Under Sparsity AssumptionsPiotr Indyk, Michael Kapralov, Kshiteej Sheth, Tal WagnerICLR 2025
