Lune

ICML2024Top-tier venue

PolySketchFormer: Fast Transformers via Sketching Polynomial Kernels

Praneeth Kacham, Vahab Mirrokni, Peilin Zhong

Abstract

The quadratic time and memory complexity inherent to self-attention mechanisms, with respect to sequence length, presents a critical computational bottleneck in the training and deployment of largescale Transformer-based language models. Recent theoretical results indicate the intractability of sub-quadratic softmax attention approximation under reasonable complexity assumptions. This paper addresses this challenge by first demonstrating that polynomial attention with high degree can effectively replace softmax without sacrificing model quality. Next, we develop polynomial sketching techniques from numerical linear algebra to achieve linear-time polynomial attention with approximation guarantees. Crucially, our approach achieves this speedup without requiring the sparsification of attention matrices. We also present a block-based algorithm to apply causal masking efficiently. Combining these techniques, we provide PolySketchFormer, a practical lineartime Transformer architecture for language modeling that offers provable guarantees. We validate PolySketchFormer empirically by training language models capable of handling long contexts. These experiments utilize both synthetic and real-world datasets (PG19, Wikipedia and C4) on Google Cloud TPUs. For context lengths of 32k and GPT-2 style models, our model achieves 2x speedup in training compared to FlashAttention of the fastest configuration, with no observed degradation in quality across our experiments. 1

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

  • Big Bird: Transformers for Longer Sequences cites Reformer: The Efficient Transformer
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Big Bird: Transformers for Longer Sequences
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Reformer: The Efficient Transformer
  • FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness cites Language Models are Few-Shot Learners
  • Titans: Learning to Memorize at Test Time cites PIQA: Reasoning about Physical Commonsense in Natural Language
  • Titans: Learning to Memorize at Test Time cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Titans: Learning to Memorize at Test Time cites Gated Linear Attention Transformers with Hardware-Efficient Training
  • Titans: Learning to Memorize at Test Time cites ATLAS: Learning to Optimally Memorize the Context at Test Time
  • ATLAS: Learning to Optimally Memorize the Context at Test Time cites Titans: Learning to Memorize at Test Time
  • Log-Linear Attention cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Log-Linear Attention cites Reformer: The Efficient Transformer
  • Log-Linear Attention cites Gated Linear Attention Transformers with Hardware-Efficient Training
  • Nested Learning: The Illusion of Deep Learning Architectures cites PIQA: Reasoning about Physical Commonsense in Natural Language
  • Nested Learning: The Illusion of Deep Learning Architectures cites Titans: Learning to Memorize at Test Time
  • Nested Learning: The Illusion of Deep Learning Architectures cites Language Models are Few-Shot Learners
  • Nested Learning: The Illusion of Deep Learning Architectures cites ATLAS: Learning to Optimally Memorize the Context at Test Time
  • Gated Linear Attention Transformers with Hardware-Efficient Training cites PIQA: Reasoning about Physical Commonsense in Natural Language
  • Gated Linear Attention Transformers with Hardware-Efficient Training cites Big Bird: Transformers for Longer Sequences
  • Gated Linear Attention Transformers with Hardware-Efficient Training cites FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness
  • Gated Linear Attention Transformers with Hardware-Efficient Training cites Reformer: The Efficient Transformer
  • ATLAS: Learning to Optimally Memorize the Context at Test Time cites PIQA: Reasoning about Physical Commonsense in Natural Language
  • ATLAS: Learning to Optimally Memorize the Context at Test Time cites Gated Linear Attention Transformers with Hardware-Efficient Training
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers19

  1. Gated Linear Attention Transformers with Hardware-Efficient TrainingSonglin Yang, Bailin Wang, Yikang Shen, Rameswar Panda et al.ICML 2024 · 390 citations
  2. Titans: Learning to Memorize at Test TimeAli Behrouz, Peilin Zhong, Vahab MirrokniNeurIPS 2025 · 368 citations
  3. Nested Learning: The Illusion of Deep Learning ArchitecturesAli Behrouz, Meisam Razaviyayn, Peilin Zhong, Vahab MirrokniNeurIPS 2025 · 96 citations
  4. ATLAS: Learning to Optimally Memorize the Context at Test TimeAli Behrouz, Zeman Li, Praneeth Kacham, Majid Daliri et al.ICML 2026 · 57 citations
  5. Log-Linear AttentionHan Guo, Songlin Yang, Tarushii Goel, Eric P. Xing et al.ICLR 2026 · 41 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. Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie et al.NeurIPS 2020 · 3,159 citations
  4. PIQA: Reasoning about Physical Commonsense in Natural LanguageYonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao et al.AAAI 2020 · 2,916 citations
  5. Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 citations

Related papers

  1. Lizard: An Efficient Linearization Framework for Large Language ModelsChien Van Nguyen, Huy Huu Nguyen, Ruiyi Zhang, Hanieh Deilamsalehy et al.ACL 2026 · 8 citations
  2. Transformer Quality in Linear TimeWeizhe Hua, Zihang Dai, Hanxiao Liu, Quoc V. LeICML 2022 · 335 citations
  3. The Expressibility of Polynomial based Attention SchemeZhao Song, Chongxi Wang, Guangyi Xu, Junze YinKDD 2025
  4. 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
  5. Fast Attention Over Long Sequences With Dynamic Sparse Flash AttentionMatteo Pagliardini, Daniele Paliotta, Martin Jaggi, François FleuretNeurIPS 2023 · 26 citations
Dusk over the sea between two cliffs drawn in fine vertical lines