mlsanityData to 7 Oct 2026

You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling

arXiv 2111.09714 ↗First posted 18 Nov 2021cs.LG cs.CLcited by 17

Not on the map. Why?

Abstract (arXiv)

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

Key facts. Cited by 17 papers in the map (data through 7 Oct 2026). Builds on 30 of its 46 references that are in the map. First posted on arXiv 18 Nov 2021.

Builds on

30 of 46 references.

References · 30

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  4. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
  5. 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,854
  6. 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,115
  7. 2020Longformer: The Long-Document Transformercited by 3,362
  8. 2019XLNet: Generalized Autoregressive Pretraining for Language Understandingcited by 2,801
  9. 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,772
  10. 2017A Broad-Coverage Challenge Corpus for Sentence Understanding through Inferencecited by 2,665
  11. 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,979
  12. 2020Big Bird: Transformers for Longer Sequencescited by 1,673
18 more
  1. 2020Reformer: The Efficient Transformercited by 1,658
  2. 2020Rethinking Attention with Performerscited by 1,584
  3. 2019Generating Long Sequences with Sparse Transformerscited by 1,523
  4. 2020Linformer: Self-Attention with Linear Complexitycited by 1,462
  5. 2015Aligning Books and Movies: Towards Story-like Visual Explanations by Watching Movies and Reading Bookscited by 1,041
  6. 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 696
  7. 2019Defending Against Neural Fake Newscited by 553
  8. 2021Nystr"omformer: A Nystr"om-Based Algorithm for Approximating Self-Attentioncited by 468
  9. 2021Random Feature Attentioncited by 350
  10. 2018A Simple Method for Commonsense Reasoningcited by 223
  11. 2017Constructing Datasets for Multi-hop Reading Comprehension Across Documentscited by 190
  12. 2018ListOps: A Diagnostic Dataset for Latent Tree Learningcited by 128
  13. 2015Practical and Optimal LSH for Angular Distancecited by 105
  14. 2018Learning long-range spatial dependencies with horizontal gated-recurrent unitscited by 98
  15. 2020Masked Language Modeling for Proteins via Linearly Scalable Long-Context Transformerscited by 49
  16. 2018Hashing-Based-Estimators for Kernel Density in High Dimensionscited by 31
  17. 2014On Symmetric and Asymmetric LSHs for Inner Product Searchcited by 23
  18. 2017A New Unbiased and Efficient Class of LSH-Based Samplers and Estimators for Partition Function Computation in Log-Linear Modelscited by 15

Built on by

Cited by year

Citing papers per year: 2022: 7; 2023: 4; 2024: 4; 2025: 2.

17 papers.

Sort:

By area:

  1. 2022Deep Unlearning via Randomized Conditionally Independent Hessianscited by 83
  2. 2022Flowformer: Linearizing Transformers with Conservation Flowscited by 69
  3. 2022Attention Mechanism in Neural Networks: Where it Comes and Where it Goescited by 29
  4. 2023Primal-Attention: Self-attention through Asymmetric Kernel SVD in Primal Representationcited by 28
  5. 2022Sampling Is All You Need on Modeling Long-Term User Behaviors for CTR Predictioncited by 24
  6. 2022Multi Resolution Analysis (MRA) for Approximate Self-Attentioncited by 11
  7. 2023Graph Convolutions Enrich the Self-Attention in Transformers!cited by 11
  8. 2022CAB: Comprehensive Attention Benchmarking on Long Sequence Modelingcited by 10
  9. 2024When Linear Attention Meets Autoregressive Decoding: Towards More Effective and Efficient Linearized Large Language Modelscited by 9
  10. 2024LookupFFN: Making Transformers Compute-lite for CPU inferencecited by 8
  11. 2023Vcc: Scaling Transformers to 128K Tokens or More by Prioritizing Important Tokenscited by 6
  12. 2023From Characters to Words: Hierarchical Pre-trained Language Model for Open-vocabulary Language Understandingcited by 4
5 more
  1. 2024MemoryFormer: Minimize Transformer Computation by Removing Fully-Connected Layerscited by 4
  2. 2025RACE Attention: A Strictly Linear-Time Attention Layer for Training on Outrageously Large Contextscited by 4
  3. 2022DBA: Efficient Transformer with Dynamic Bilinear Low-Rank Attentioncited by 3
  4. 2024Computation and Parameter Efficient Multi-Modal Fusion Transformer for Cued Speech Recognitioncited by 3
  5. 2025Learning Advanced Self-Attention for Linear Transformers in the Singular Value Domaincited by 3