Lune

ICLR2024Top-tier venue

How to Capture Higher-order Correlations? Generalizing Matrix Softmax Attention to Kronecker Computation

Josh Alman, Zhao Song

Abstract

In the classical transformer attention scheme, we are given three n×dn \times d size matrices Q,K,VQ, K, V (the query, key, and value tokens), and the goal is to compute a new n×dn \times d size matrix D−1exp⁡(QK⊤)VD^{-1} \exp(QK^\top) V where D=diag(exp⁡(QK⊤)1n)D = \mathrm{diag}( \exp(QK^\top) {\bf 1}_n ). In this work, we study a generalization of attention which captures triple-wise correlations. This generalization is able to solve problems about detecting triple-wise connections that were shown to be impossible for transformers. The potential downside of this generalization is that it appears as though computations are even more difficult, since the straightforward algorithm requires cubic time in nn. However, we show that in the bounded-entry setting (which arises in practice, and which is well-studied in both theory and practice), there is actually a near-linear time algorithm. More precisely, we show that bounded entries are both necessary and sufficient for quickly performing generalized computations: ∙\bullet On the positive side, if all entries of the input matrices are bounded above by o(log⁡n3)o(\sqrt[3]{\log n}) then we show how to approximate the ``tensor-type'' attention matrix in n1+o(1)n^{1+o(1)} time. ∙\bullet On the negative side, we show that if the entries of the input matrices may be as large as Ω(log⁡n3)\Omega(\sqrt[3]{\log n}), then there is no algorithm that runs faster than n3−o(1)n^{3-o(1)} (assuming the Strong Exponential Time Hypothesis from fine-grained complexity theory). We also show that our construction, algorithms, and lower bounds naturally generalize to higher-order tensors and correlations. Interestingly, the higher the order of the tensors, the lower the bound on the entries needs to be for an efficient algorithm. Our results thus yield a natural tradeoff between the boundedness of the entries, and order of the tensor one may use for more expressive, efficient attention computation.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

19 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Language Models are Few-Shot Learners
  • SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models cites Language Models are Few-Shot Learners
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites The Closeness of In-Context Learning and Weight Shifting for Softmax Regression
  • H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models cites Language Models are Few-Shot Learners
  • FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression cites Language Models are Few-Shot Learners
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression cites Outlier-Efficient Hopfield Layers for Large Transformer-Based Models
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression cites On Statistical Rates and Provably Efficient Criteria of Latent Diffusion Transformers (DiTs)
  • The Closeness of In-Context Learning and Weight Shifting for Softmax Regression cites On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity Analysis
  • Outlier-Efficient Hopfield Layers for Large Transformer-Based Models cites Language Models are Few-Shot Learners
  • Outlier-Efficient Hopfield Layers for Large Transformer-Based Models cites On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity Analysis
  • On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity Analysis cites Outlier-Efficient Hopfield Layers for Large Transformer-Based Models
  • On Statistical Rates and Provably Efficient Criteria of Latent Diffusion Transformers (DiTs) cites Language Models are Few-Shot Learners
  • On Statistical Rates and Provably Efficient Criteria of Latent Diffusion Transformers (DiTs) cites Outlier-Efficient Hopfield Layers for Large Transformer-Based Models
  • On Statistical Rates and Provably Efficient Criteria of Latent Diffusion Transformers (DiTs) cites On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity Analysis
  • On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity Analysis cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers19

  1. 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
  2. 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
  3. On Statistical Rates and Provably Efficient Criteria of Latent Diffusion Transformers (DiTs)Jerry Yao-Chieh Hu, Weimin Wu, Zhuoru Li, Sophia Pi et al.NeurIPS 2024 · 49 citations
  4. On Computational Limits of Modern Hopfield Models: A Fine-Grained Complexity AnalysisJerry Yao-Chieh Hu, Thomas Lin, Zhao Song, Han LiuICML 2024 · 47 citations
  5. Outlier-Efficient Hopfield Layers for Large Transformer-Based ModelsJerry Yao-Chieh Hu, Pei-Hsuan Chang, Haozheng Luo, Hong-Yu Chen et al.ICML 2024 · 46 citations

Builds on18

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra et al.NeurIPS 2022 · 5,493 citations
  3. Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 citations
  4. FlashAttention-2: Faster Attention with Better Parallelism and Work PartitioningTri DaoICLR 2024 · 2,600 citations
  5. SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language ModelsGuangxuan Xiao, Ji Lin, Mickaël Seznec, Hao Wu et al.ICML 2023 · 1,493 citations

Related papers

  1. Fast Attention Requires Bounded EntriesJosh Alman, Zhao SongNeurIPS 2023 · 115 citations
  2. Poly-attention: a general scheme for higher-order self-attentionSayak Chakrabarti, Toniann Pitassi, Josh AlmanICLR 2026 · 3 citations
  3. Subquadratic Algorithms and Hardness for Attention with Any TemperatureShreya Gupta, Boyang Huang, Barna Saha, Yinzhan Xu et al.ICLR 2026 · 5 citations
  4. Representational Strengths and Limitations of TransformersClayton Sanford, Daniel J. Hsu, Matus TelgarskyNeurIPS 2023 · 162 citations
  5. Conv-Basis: A New Paradigm for Efficient Attention Inference and Gradient Computation in TransformersYingyu Liang, Heshan Liu, Zhenmei Shi, Zhao Song et al.EMNLP Findings 2025
Dusk over the sea between two cliffs drawn in fine vertical lines