Lune

ICML2023Top-tier venue

KDEformer: Accelerating Transformers via Kernel Density Estimation

Amir Zandieh, Insu Han, Majid Daliri, Amin Karbasi

Abstract

Dot-product attention mechanism plays a crucial role in modern deep architectures (e.g., Transformer) for sequence modeling, however, naïve exact computation of this model incurs quadratic time and memory complexities in sequence length, hindering the training of long-sequence models. Critical bottlenecks are due to the computation of partition functions in the denominator of softmax function as well as the multiplication of the softmax matrix with the matrix of values. Our key observation is that the former can be reduced to a variant of the kernel density estimation (KDE) problem, and an efficient KDE solver can be further utilized to accelerate the latter via subsampling-based fast matrix products. Our proposed KDEformer can approximate the attention in sub-quadratic time with provable spectral norm bounds, while all prior results merely provide entry-wise error bounds. Empirically, we verify that KDEformer outperforms other attention approximations in terms of accuracy, memory, and runtime on various pre-trained models. On BigGAN image generation, we achieve better generative scores than the exact computation with over 4×4\times speedup. For ImageNet classification with T2T-ViT, KDEformer shows over 18×18\times speedup while the accuracy drop is less than 0.5%0.5\%.

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

  • Streaming Attention Approximation via Discrepancy Theory cites HyperAttention: Long-context Attention in Near-Linear Time
  • Big Bird: Transformers for Longer Sequences cites Reformer: The Efficient Transformer
  • How to Capture Higher-order Correlations? Generalizing Matrix Softmax Attention to Kronecker Computation cites Language Models are Few-Shot Learners
  • Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting cites Reformer: The Efficient Transformer
  • SeTformer Is What You Need for Vision and Language cites Reformer: The Efficient Transformer
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites Language Models are Few-Shot Learners
  • Subquadratic Algorithms and Hardness for Attention with Any Temperature cites Big Bird: Transformers for Longer Sequences
  • Subquadratic Algorithms and Hardness for Attention with Any Temperature cites Reformer: The Efficient Transformer
  • Subquadratic Algorithms and Hardness for Attention with Any Temperature cites Language Models are Few-Shot Learners
  • Subquadratic Algorithms and Hardness for Attention with Any Temperature cites HyperAttention: Long-context Attention in Near-Linear Time
  • HyperAttention: Long-context Attention in Near-Linear Time cites Big Bird: Transformers for Longer Sequences
  • HyperAttention: Long-context Attention in Near-Linear Time cites Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting
  • HyperAttention: Long-context Attention in Near-Linear Time cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • HyperAttention: Long-context Attention in Near-Linear Time cites Reformer: The Efficient Transformer
  • HyperAttention: Long-context Attention in Near-Linear Time 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. HyperAttention: Long-context Attention in Near-Linear TimeInsu Han, Rajesh Jayaram, Amin Karbasi, Vahab Mirrokni et al.ICLR 2024 · 104 citations
  2. How to Capture Higher-order Correlations? Generalizing Matrix Softmax Attention to Kronecker ComputationJosh Alman, Zhao SongICLR 2024 · 53 citations
  3. Streaming Attention Approximation via Discrepancy TheoryEkaterina Kochetkova, Kshiteej Sheth, Insu Han, Amir Zandieh et al.NeurIPS 2025 · 10 citations
  4. SeTformer Is What You Need for Vision and LanguagePourya Shamsolmoali, Masoumeh Zareapoor, Eric Granger, Michael FelsbergAAAI 2024 · 8 citations
  5. Subquadratic Algorithms and Hardness for Attention with Any TemperatureShreya Gupta, Boyang Huang, Barna Saha, Yinzhan Xu et al.ICLR 2026 · 5 citations

Builds on16

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  3. Informer: Beyond Efficient Transformer for Long Sequence Time-Series ForecastingHaoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang et al.AAAI 2021 · 7,289 citations
  4. Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie et al.NeurIPS 2020 · 3,159 citations
  5. Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 citations

Related papers

  1. Combiner: Full Attention Transformer with Sparse Computation CostHongyu Ren, Hanjun Dai, Zihang Dai, Mengjiao Yang et al.NeurIPS 2021 · 99 citations
  2. SOFT: Softmax-free Transformer with Linear ComplexityJiachen Lu, Jinghan Yao, Junge Zhang, Xiatian Zhu et al.NeurIPS 2021 · 232 citations
  3. PolySketchFormer: Fast Transformers via Sketching Polynomial KernelsPraneeth Kacham, Vahab Mirrokni, Peilin ZhongICML 2024 · 27 citations
  4. ELFATT: Efficient Linear Fast Attention for Vision TransformersChong Wu, Maolin Che, Renjie Xu, Zhuoheng Ran et al.ACM MM 2025 · 3 citations
  5. Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 citations
Dusk over the sea between two cliffs drawn in fine vertical lines