One Pass Streaming Algorithm for Super Long Token Attention Approximation in Sublinear Space
Not on the map. Why?
Abstract (arXiv)
Attention computation takes both the time complexity of O(n2) and the space complexity of O(n2) simultaneously, which makes deploying Large Language Models (LLMs) in streaming applications that involve long contexts requiring substantial computational resources. In recent OpenAI DevDay (Nov 6, 2023), OpenAI released a new model that is able to support a 128K-long document, in our paper, we focus on the memory-efficient issue when context length n is much greater than 128K (n gg 2d). Considering a single-layer self-attention with Query, Key, and Value matrices Q, K, V ∈ ℝn × d, the polynomial method approximates the attention output T ∈ ℝn × d. It accomplishes this by constructing U1, U2 ∈ ℝn × t to expedite attention sf Attn(Q, K, V) computation within n1+o(1) time executions. Despite this, computing the approximated attention matrix U1U2^top ∈ ℝn × n still necessitates O(n2) space, leading to significant memory usage. In response to these challenges, we introduce a new algorithm that only reads one pass of the data in a streaming fashion. This method employs sublinear space o(n) to store three sketch matrices, alleviating the need for exact K, V storage. Notably, our algorithm exhibits exceptional memory-efficient performance with super-long tokens. As the token length n increases, our error guarantee diminishes while the memory usage remains nearly constant. This unique attribute underscores the potential of our technique in efficiently handling LLMs in streaming applications.
Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Builds on 65 of its 92 references that are in the map. First posted on arXiv 24 Nov 2023.
Builds on
65 of 92 references.
References · 65
- 2023GPT-4 Technical Reportcited by 18,132
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2020Longformer: The Long-Document Transformercited by 3,362
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
- 2023FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioningcited by 2,551
- 2020Big Bird: Transformers for Longer Sequencescited by 1,673
38 more
- 2020Linformer: Self-Attention with Linear Complexitycited by 1,462
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
- 2023PaLM 2 Technical Reportcited by 1,154
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
- 2020Long Range Arena: A Benchmark for Efficient Transformerscited by 696
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
- 2023Sheared LLaMA: Accelerating Language Model Pre-training via Structured Pruningcited by 408
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 294
- 2023Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Timecited by 247
- 2020Synthesizer: Rethinking Self-Attention in Transformer Modelscited by 204
- 2023SantaCoder: don't reach for the stars!cited by 169
- 2023Representational Strengths and Limitations of Transformerscited by 132
- 2021Recent Advances in Deep Learning Based Dialogue Systems: A Systematic Surveycited by 130
- 2023A Theory for Emergence of Complex Skills in Language Modelscited by 111
- 2023Fast Attention Requires Bounded Entriescited by 102
- 2023LongEval: Guidelines for Human Evaluation of Faithfulness in Long-form Summarizationcited by 96
- 2021QA Dataset Explosion: A Taxonomy of NLP Resources for Question Answering and Reading Comprehensioncited by 91
- 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 85
- 2023HyperAttention: Long-context Attention in Near-Linear Timecited by 85
- 2023Transformers as Support Vector Machinescited by 67
- 2023A Survey on Proactive Dialogue Systems: Problems, Methods, and Prospectscited by 66
- 2023KDEformer: Accelerating Transformers via Kernel Density Estimationcited by 58
- 2023Extractive Summarization via ChatGPT for Faithful Summary Generationcited by 58
- 2023Attention Scheme Inspired Softmax Regressioncited by 49
- 2023An Over-parameterized Exponential Regressioncited by 45
- 2023Embrace Divergence for Richer Insights: A Multi-document Summarization Benchmark and a Case Study on Summarizing Diverse Information from News Articlescited by 45
- 2023Solving Regularized Exp, Cosh and Sinh Regression Problemscited by 44
- 2023How to Capture Higher-order Correlations? Generalizing Matrix Softmax Attention to Kronecker Computationcited by 44
- 2023Algorithm and Hardness for Dynamic Attention Maintenance in Large Language Modelscited by 37
- 2023Randomized and Deterministic Attention Sparsification Algorithms for Over-parameterized Feature Dimensioncited by 37
- 2023On the Optimization and Generalization of Multi-head Attentioncited by 37
- 2023In-Context Learning for Attention Scheme: from Single Softmax Regression to Multiple Softmax Regression via a Tensor Trickcited by 32
- 2023A Fast Optimization View: Reformulating Single Layer Attention in LLM Based on Tensor and SVM Trick, and Solving It in Matrix Multiplication Timecited by 30
- 2023A Mathematical Abstraction for Balancing the Trade-off Between Creativity and Reality in Large Language Modelscited by 29
- 2023How to Protect Copyright Data in Optimization of Large Language Models?cited by 26
- 2023Trainable Transformer in Transformercited by 17
- 2020Space-Efficient Interior Point Method, with applications to Linear Programming and Maximum Weight Bipartite Matchingcited by 14
50 most cited of 65 All 65 (JSON)
Built on by
Citing papers per year: 2024: 3; 2025: 2; 2026: 1.
6 papers.
- 2024Not All Layers of LLMs Are Necessary During Inferencecited by 95
- 2024Towards Infinite-Long Prefix in Transformercited by 10
- 2024Unlocking the Theory Behind Scaling 1-Bit Neural Networkscited by 3
- 2025Theoretical Foundation of Flow-Based Time Series Generation: Provable Approximation, Generalization, and Efficiencycited by 2
- 2025Unifying Learning Dynamics and Generalization in Transformers Scaling Lawcited by 1
- 2026Beyond Sparse Weights: When Is Attention Compressible?cited by 0
- 2026Beyond Sparse Weights: When Is Attention Compressible?21 Aug 2026
- 2025Unifying Learning Dynamics and Generalization in Transformers Scaling Law26 Dec 2025
- 2025Theoretical Foundation of Flow-Based Time Series Generation: Provable Approximation, Generalization, and Efficiency18 Mar 2025
- 2024Unlocking the Theory Behind Scaling 1-Bit Neural Networks3 Nov 2024
- 2024Towards Infinite-Long Prefix in Transformer20 Jun 2024
- 2024Not All Layers of LLMs Are Necessary During Inference4 Mar 2024