Longer Attention Span: Increasing Transformer Context Length with Sparse Graph Processing Techniques
Not on the map. Why?
Abstract (arXiv)
Transformers have demonstrated great success in numerous domains including natural language processing and bioinformatics. This success stems from the use of the attention mechanism by these models in order to represent and propagate pairwise interactions between individual tokens of sequential data. However, the primary limitation of this operation is its quadratic memory and time complexity in relation to the input's context length - the length of a sequence over which the interactions need to be captured. This significantly limits the length of sequences that can be inferred upon by these models. Extensive research has been conducted to reduce the number of pairwise interactions to sub-quadratic in relation to the context length by introducing sparsity into the attention mechanism through the development of sparse attention masks. However, efficient implementations that achieve "true sparsity" are lacking. In this work, we address this issue by proposing a graph computing view of attention where tokens are perceived as nodes of the graph and the attention mask determines the edges of the graph. Using this view, we develop graph processing algorithms to implement the attention mechanism. Both theoretically and empirically, we demonstrate that our algorithms only perform the needed computations, i.e., they are work optimal. We also perform extensive experimentation using popular attention masks to explore the impact of sparsity on execution time and achievable context length. Our experiments demonstrate significant speedups in execution times compared to state-of-the-art attention implementations such as FlashAttention for large sequence lengths. We also demonstrate that our algorithms are able to achieve extremely long sequence lengths of as high as 160 million on a single NVIDIA A100 GPU (SXM4 80GB).
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 19 of its 27 references that are in the map. First posted on arXiv 31 Jan 2025.
Builds on
19 of 27 references.
References · 19
- 2017Attention Is All You Needcited by 60,361
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,673
- 2020Longformer: The Long-Document Transformercited by 3,413
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,598
- 2023A Survey of Large Language Modelscited by 2,576
- 2019Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelismcited by 1,868
- 2020Big Bird: Transformers for Longer Sequencescited by 1,684
- 2020Reformer: The Efficient Transformercited by 1,668
- 2019Generating Long Sequences with Sparse Transformerscited by 1,546
- 2024FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precisioncited by 519
- 2023Ring Attention with Blockwise Transformers for Near-Infinite Contextcited by 457
7 more
- 2023DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Modelscited by 245
- 2023LongNet: Scaling Transformers to 1,000,000,000 Tokenscited by 204
- 2022Representing Long-Range Context for Graph Neural Networks with Global Attentioncited by 195
- 2023HyenaDNA: Long-Range Genomic Sequence Modeling at Single Nucleotide Resolutioncited by 194
- 2018Online normalizer calculation for softmaxcited by 162
- 2023Faster Causal Attention Over Large Sequences Through Sparse Flash Attentioncited by 25
- 2024Efficiently Dispatching Flash Attention For Partially Filled Attention Maskscited by 2
Built on by
Citing papers per year: 2025: 1.
1 paper.
- 2025Sparse Fine-Tuning of Transformers for Generative Taskscited by 1
- 2025Sparse Fine-Tuning of Transformers for Generative Tasks14 Jul 2025