Algorithm and Hardness for Dynamic Attention Maintenance in Large Language Models
Jan van den Brand, Zhao Song, Tianyi Zhou
Abstract
Large language models (LLMs) have made fundamental changes in human life. The attention scheme is one of the key components over all the LLMs, such as BERT, GPT-1, Transformers, GPT-2, 3, 3.5 and 4. Inspired by previous theoretical study of static version of the attention multiplication problem [Zandieh, Han, Daliri, and Karbasi arXiv 2023, Alman and Song arXiv 2023]. In this work, we formally define a dynamic version of attention matrix multiplication problem. There are matrices , they represent query, key and value in LLMs. In each iteration we update one entry in or . In the query stage, we receive as input, and want to answer , where is a square matrix and is a diagonal matrix. Here denote a length- vector that all the entries are ones. We provide two results: an algorithm and a conditional lower bound. On one hand, inspired by the lazy update idea from [Demetrescu and Italiano FOCS 2000, Sankowski FOCS 2004, Cohen, Lee and Song STOC 2019, Brand SODA 2020], we provide a data-structure that uses amortized update time, and worst-case query time. On the other hand, show that unless the hinted matrix vector multiplication conjecture [Brand, Nanongkai and Saranurak FOCS 2019] is false, there is no algorithm that can use both amortized update time, and worst query time. In conclusion, our algorithmic result is conditionally optimal unless hinted matrix vector multiplication conjecture is false.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext f913fbed-fd0c-4808-867d-6147ff3dcff6Cited by top-tier papers16
- H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language ModelsZhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen et al.NeurIPS 2023 · 1,003 citations
- Deja Vu: Contextual Sparsity for Efficient LLMs at Inference TimeZichang Liu, Jue Wang, Tri Dao, Tianyi Zhou et al.ICML 2023 · 318 citations
- The Closeness of In-Context Learning and Weight Shifting for Softmax RegressionShuai Li, Zhao Song, Yu Xia, Tong Yu et al.NeurIPS 2024 · 53 citations
- On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity AnalysisJerry Yao-Chieh Hu, Thomas Lin, Zhao Song, Han LiuICML 2024 · 47 citations
- How to Protect Copyright Data in Optimization of Large Language Models?Timothy Chu, Zhao Song, Chiwun YangAAAI 2024 · 42 citations
Builds on18
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 citations
- Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi et al.ICLR 2020 · 481 citations
- A Refined Laser Method and Faster Matrix MultiplicationJosh Alman, Virginia Vassilevska WilliamsSODA 2021 · 275 citations
- Inductive Biases and Variable Creation in Self-Attention MechanismsBenjamin L. Edelman, Surbhi Goel, Sham M. Kakade, Cyril ZhangICML 2022 · 154 citations
Related papers
- Fast Attention Requires Bounded EntriesJosh Alman, Zhao SongNeurIPS 2023 · 115 citations
- Sublinear Time Quantum Algorithm for Attention ApproximationZhao Song, Jianfei Xue, Jiahao Zhang, Lichen ZhangICLR 2026 · 2 citations
- The Fine-Grained Complexity of Gradient Computation for Training Large Language ModelsJosh Alman, Zhao SongNeurIPS 2024 · 33 citations
- HyperAttention: Long-context Attention in Near-Linear TimeInsu Han, Rajesh Jayaram, Amin Karbasi, Vahab Mirrokni et al.ICLR 2024 · 104 citations
- Subquadratic Algorithms and Hardness for Attention with Any TemperatureShreya Gupta, Boyang Huang, Barna Saha, Yinzhan Xu et al.ICLR 2026 · 5 citations
