RACE Attention: A Strictly Linear-Time Attention Layer for Training on Outrageously Large Contexts
Not on the map. Why?
Abstract (arXiv)
Softmax Attention has a quadratic time complexity in sequence length, which becomes prohibitive to run at long contexts, even with highly optimized GPU kernels. For example, FlashAttention-2/3 (exact, GPU-optimized implementations of Softmax Attention) cannot complete a single forward-backward pass of a single attention layer once the context exceeds ~4 million tokens on an NVIDIA GH200 (96 GB). We introduce Repeated Arrays-of-Count Estimators (RACE) Attention, a kernel-inspired alternative to Softmax Attention that is strictly linear in sequence length and embedding size. RACE Attention replaces the exponential kernel with a sharpened angular similarity, and approximates attention outputs via Gaussian random projections and soft Locality-Sensitive Hashing (LSH), avoiding construction of the full attention matrix. Across language modeling, masked language modeling, and text/image classification, RACE Attention matches or outperforms strong baselines up to 64K seqeuence length while reducing wall-clock time and memory usage. In addition, we conduct a controlled scaling study on a single attention layer and demonstrate processing of up to 12 million tokens on an NVIDIA GH200 GPU and 75 million tokens on an Intel Xeon Gold 5220R CPU in a single forward-backward pass, which is well beyond the capabilities of current state-of-the-art attention implementations. RACE Attention thus offers a practical and theoretically grounded mechanism for long-context training on today's hardware. We release our code at https://github.com/sahiljoshi515/RACE_Attention.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Builds on 30 of its 43 references that are in the map. First posted on arXiv 5 Oct 2025.
Builds on
30 of 43 references.
References · 30
- 2017Attention Is All You Needcited by 59,932
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
- 2017Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithmscited by 4,283
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,115
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2020Longformer: The Long-Document Transformercited by 3,362
- 2016Pointer Sentinel Mixture Modelscited by 2,992
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
- 2020Transformers are RNNs: Fast Autoregressive Transformers with Linear Attentioncited by 1,979
- 2020Big Bird: Transformers for Longer Sequencescited by 1,673
18 more
- 2020Reformer: The Efficient Transformercited by 1,658
- 2020Rethinking Attention with Performerscited by 1,584
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,462
- 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 696
- 2018Universal Transformerscited by 613
- 2024FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisioncited by 507
- 2021Nystr"omformer: A Nystr"om-Based Algorithm for Approximating Self-Attentioncited by 468
- 2023TinyStories: How Small Can Language Models Be and Still Speak Coherent English?cited by 425
- 2015An Introduction to Matrix Concentration Inequalitiescited by 391
- 2021Random Feature Attentioncited by 350
- 2022cosFormer: Rethinking Softmax in Attentioncited by 212
- 2023HyperAttention: Long-context Attention in Near-Linear Timecited by 85
- 2024Theory, Analysis, and Best Practices for Sigmoid Self-Attentioncited by 62
- 2017The Unreasonable Effectiveness of Structured Random Orthogonal Embeddingscited by 43
- 2020Simplified Self-Attention for Transformer-based End-to-End Speech Recognitioncited by 20
- 2021You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Samplingcited by 17
- 2017On the Fine-Grained Complexity of Empirical Risk Minimization: Kernel Methods and Neural Networkscited by 16
- 2019Sub-linear RACE Sketches for Approximate Kernel Density Estimation on Streaming Datacited by 13
Built on by
Citing papers per year: 2026: 4.
4 papers.
- 2026SOCKET: SOft Collision Kernel EsTimator for Sparse Attentioncited by 3
- 2026Do Vision Transformers Need All-to-All Attention? Global Communication Through Elastic Learned Corescited by 0
- 2026Inference Time Context Sparsity: Illusion or Opportunity?cited by 0
- 2026ELSAA: Efficient Low-Rank and Sparse Attention Approximation for Training Transformerscited by 0
- 2026ELSAA: Efficient Low-Rank and Sparse Attention Approximation for Training Transformers22 Jul 2026
- 2026Inference Time Context Sparsity: Illusion or Opportunity?22 May 2026
- 2026Do Vision Transformers Need All-to-All Attention? Global Communication Through Elastic Learned Cores12 May 2026
- 2026SOCKET: SOft Collision Kernel EsTimator for Sparse Attention6 Feb 2026