You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling
Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Moo Fung, Vikas Singh
摘要
Transformer-based models are widely used in natural language processing (NLP). Central to the transformer model is the self-attention mechanism, which captures the interactions of token pairs in the input sequences and depends quadratically on the sequence length. Training such models on longer sequences is expensive. In this paper, we show that a Bernoulli sampling attention mechanism based on Locality Sensitive Hashing (LSH), decreases the quadratic complexity of such models to linear. We bypass the quadratic cost by considering self-attention as a sum of individual tokens associated with Bernoulli random variables that can, in principle, be sampled at once by a single hash (although in practice, this number may be a small constant). This leads to an efficient sampling scheme to estimate self-attention which relies on specific modifications of LSH (to enable deployment on GPU architectures). We evaluate our algorithm on the GLUE benchmark with standard 512 sequence length where we see favorable performance relative to a standard pretrained Transformer. On the Long Range Arena (LRA) benchmark, for evaluating performance on long sequences, our method achieves results consistent with softmax self-attention but with sizable speed-ups and memory savings and often outperforms other efficient self-attention methods. Our code is available at https://github.com/mlpen/YOSO .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 14 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention 引用了 ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
- Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention 引用了 Reformer: The Efficient Transformer
- Long Range Arena : A Benchmark for Efficient Transformers 引用了 Reformer: The Efficient Transformer
- Graph Convolutions Enrich the Self-Attention in Transformers! 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Graph Convolutions Enrich the Self-Attention in Transformers! 引用了 ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
- Multi Resolution Analysis (MRA) for Approximate Self-Attention 引用了 Long Range Arena : A Benchmark for Efficient Transformers
- Multi Resolution Analysis (MRA) for Approximate Self-Attention 引用了 Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention
- Multi Resolution Analysis (MRA) for Approximate Self-Attention 引用了 Reformer: The Efficient Transformer
- Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention 引用了 Long Range Arena : A Benchmark for Efficient Transformers
- Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention 引用了 ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
- Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention 引用了 Reformer: The Efficient Transformer
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation 引用了 Long Range Arena : A Benchmark for Efficient Transformers
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation 引用了 Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation 引用了 Reformer: The Efficient Transformer
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representation 引用了 Flowformer: Linearizing Transformers with Conservation Flows
- Flowformer: Linearizing Transformers with Conservation Flows 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
- Flowformer: Linearizing Transformers with Conservation Flows 引用了 Long Range Arena : A Benchmark for Efficient Transformers
- Flowformer: Linearizing Transformers with Conservation Flows 引用了 Nyströmformer: A Nyström-based Algorithm for Approximating Self-Attention
- Flowformer: Linearizing Transformers with Conservation Flows 引用了 Reformer: The Efficient Transformer
引用它的顶会 Paper14
- Flowformer: Linearizing Transformers with Conservation FlowsHaixu Wu, Jialong Wu, Jiehui Xu, Jianmin Wang 等ICML 2022 · 130 次引用
- Deep Unlearning via Randomized Conditionally Independent HessiansRonak Mehta, Sourav Pal, Vikas Singh, Sathya N. RaviCVPR 2022 · 50 次引用
- Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal RepresentationYingyi Chen, Qinghua Tao, Francesco Tonin, Johan A. K. SuykensNeurIPS 2023 · 42 次引用
- Graph Convolutions Enrich the Self-Attention in Transformers!Jeongwhan Choi, Hyowon Wi, Jayoung Kim, Yehjin Shin 等NeurIPS 2024 · 24 次引用
- Multi Resolution Analysis (MRA) for Approximate Self-AttentionZhanpeng Zeng, Sourav Pal, Jeffery Kline, Glenn Moo Fung 等ICML 2022 · 14 次引用
它引用的 Paper7
- ALBERT: A Lite BERT for Self-supervised Learning of Language RepresentationsZhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel 等ICLR 2020 · 7,418 次引用
- Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 次引用
- Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 次引用
- Long Range Arena : A Benchmark for Efficient TransformersYi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen 等ICLR 2021 · 881 次引用
- Nyströmformer: A Nyström-based Algorithm for Approximating Self-AttentionYunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan 等AAAI 2021 · 675 次引用
相关 Paper
- Sparse Attention with Learning to HashZhiqing Sun, Yiming Yang, Shinjae YooICLR 2022 · 21 次引用
- RACE Attention: A Strictly Linear-Time Attention for Long-Sequence TrainingSahil Joshi, Agniva Chowdhury, Amar Kanakamedala, Ekam Singh 等ICLR 2026 · 2 次引用
- Linear-Time Self Attention with Codeword Histogram for Efficient RecommendationYongji Wu, Defu Lian, Neil Zhenqiang Gong, Lu Yin 等WWW 2021 · 18 次引用
- Fast Attention Over Long Sequences With Dynamic Sparse Flash AttentionMatteo Pagliardini, Daniele Paliotta, Martin Jaggi, François FleuretNeurIPS 2023 · 26 次引用
- SMYRF - Efficient Attention using Asymmetric ClusteringGiannis Daras, Nikita Kitaev, Augustus Odena, Alexandros G. DimakisNeurIPS 2020 · 54 次引用
