Lune

ICML2024顶会

Algorithm and Hardness for Dynamic Attention Maintenance in Large Language Models

Jan van den Brand, Zhao Song, Tianyi Zhou

摘要

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 Q,K,V∈Rn×dQ,K, V \in \mathbb{R}^{n \times d}, they represent query, key and value in LLMs. In each iteration we update one entry in KK or VV. In the query stage, we receive (i,j)∈[n]×[d](i,j) \in [n] \times [d] as input, and want to answer (D−1AV)i,j(D^{-1} A V)_{i,j}, where A:=exp⁡(QK⊤)∈Rn×nA:=\exp(QK^\top) \in \mathbb{R}^{n \times n} is a square matrix and D:=diag(A1n)∈Rn×nD := \mathrm{diag}(A {\bf 1}_n) \in \mathbb{R}^{n \times n} is a diagonal matrix. Here 1n{\bf 1}_n denote a length-nn vector that all the entries are ones. We provide two results: an algorithm and a conditional lower bound. ∙\bullet 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 O(nω(1,1,τ)−τ)O(n^{\omega(1,1,\tau)-\tau}) amortized update time, and O(n1+τ)O(n^{1+\tau}) worst-case query time. ∙\bullet 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 O(nω(1,1,τ)−τ−Ω(1))O(n^{\omega(1,1,\tau) - \tau- \Omega(1)}) amortized update time, and O(n1+τ−Ω(1))O(n^{1+\tau-\Omega(1)}) worst query time. In conclusion, our algorithmic result is conditionally optimal unless hinted matrix vector multiplication conjecture is false.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 16 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time 引用了 The Closeness of In-Context Learning and Weight Shifting for Softmax Regression
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression 引用了 Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time
  • Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time 引用了 Language Models are Few-Shot Learners
  • Inductive Biases and Variable Creation in Self-Attention Mechanisms 引用了 Language Models are Few-Shot Learners
  • Inductive Biases and Variable Creation in Self-Attention Mechanisms 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 Inductive Biases and Variable Creation in Self-Attention Mechanisms
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 The Closeness of In-Context Learning and Weight Shifting for Softmax Regression
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 Language Models are Few-Shot Learners
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 How to Protect Copyright Data in Optimization of Large Language Models?
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression 引用了 Inductive Biases and Variable Creation in Self-Attention Mechanisms
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression 引用了 Language Models are Few-Shot Learners
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression 引用了 On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity Analysis
  • How to Protect Copyright Data in Optimization of Large Language Models? 引用了 Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time
  • How to Protect Copyright Data in Optimization of Large Language Models? 引用了 The Closeness of In-Context Learning and Weight Shifting for Softmax Regression
  • How to Protect Copyright Data in Optimization of Large Language Models? 引用了 Language Models are Few-Shot Learners
  • On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity Analysis 引用了 Language Models are Few-Shot Learners
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper16

  1. H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language ModelsZhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen 等NeurIPS 2023 · 1,003 次引用
  2. Deja Vu: Contextual Sparsity for Efficient LLMs at Inference TimeZichang Liu, Jue Wang, Tri Dao, Tianyi Zhou 等ICML 2023 · 318 次引用
  3. The Closeness of In-Context Learning and Weight Shifting for Softmax RegressionShuai Li, Zhao Song, Yu Xia, Tong Yu 等NeurIPS 2024 · 53 次引用
  4. On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity AnalysisJerry Yao-Chieh Hu, Thomas Lin, Zhao Song, Han LiuICML 2024 · 47 次引用
  5. How to Protect Copyright Data in Optimization of Large Language Models?Timothy Chu, Zhao Song, Chiwun YangAAAI 2024 · 42 次引用

它引用的 Paper19

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 次引用
  3. Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi 等ICLR 2020 · 481 次引用
  4. A Refined Laser Method and Faster Matrix MultiplicationJosh Alman, Virginia Vassilevska WilliamsSODA 2021 · 275 次引用
  5. Inductive Biases and Variable Creation in Self-Attention MechanismsBenjamin L. Edelman, Surbhi Goel, Sham M. Kakade, Cyril ZhangICML 2022 · 154 次引用

相关 Paper

  1. Fast Attention Requires Bounded EntriesJosh Alman, Zhao SongNeurIPS 2023 · 115 次引用
  2. Sublinear Time Quantum Algorithm for Attention ApproximationZhao Song, Jianfei Xue, Jiahao Zhang, Lichen ZhangICLR 2026 · 2 次引用
  3. The Fine-Grained Complexity of Gradient Computation for Training Large Language ModelsJosh Alman, Zhao SongNeurIPS 2024 · 33 次引用
  4. HyperAttention: Long-context Attention in Near-Linear TimeInsu Han, Rajesh Jayaram, Amin Karbasi, Vahab Mirrokni 等ICLR 2024 · 104 次引用
  5. Subquadratic Algorithms and Hardness for Attention with Any TemperatureShreya Gupta, Boyang Huang, Barna Saha, Yinzhan Xu 等ICLR 2026 · 5 次引用
黄昏的海面,两侧是细线勾勒的悬崖