Sublinear Time Quantum Algorithm for Attention Approximation
Zhao Song, Jianfei Xue, Jiahao Zhang, Lichen Zhang
Abstract
Given the query, key and value matrices , the attention module is defined as where with applied entrywise, . The attention module is the backbone of modern transformers and large language models, but explicitly forming the softmax matrix incurs time, motivating numerous approximation schemes that reduce runtime to via sparsity or low-rank factorization. We propose a quantum data structure that approximates any row of using only row queries to . Our algorithm preprocesses these matrices in time, where is the target accuracy, is the -statistical dimension of the exponential kernel defined by and , and measures the row distortion of that is at most , the stable rank of . Each row query can be answered in time. To our knowledge, this is the first quantum data structure that approximates rows of the attention matrix in sublinear time with respect to . Our approach relies on a quantum Nyström approximation of the exponential kernel, quantum multivariate mean estimation for computing , and quantum leverage score sampling for the multiplication with .
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 67e362e5-454e-4e44-8f6e-37243cbc06cfCited by top-tier papers1
Ask how each one uses itBuilds on34
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- 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
- Informer: Beyond Efficient Transformer for Long Sequence Time-Series ForecastingHaoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang et al.AAAI 2021 · 7,289 citations
- Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie et al.NeurIPS 2020 · 3,159 citations
- Reformer: The Efficient TransformerNikita Kitaev, Lukasz Kaiser, Anselm LevskayaICLR 2020 · 2,878 citations
Related papers
- Fast Attention Requires Bounded EntriesJosh Alman, Zhao SongNeurIPS 2023 · 115 citations
- MonarchAttention: Zero-Shot Conversion to Fast, Hardware-Aware Structured AttentionCan Yaras, Alec S. Xu, Pierre Abillama, Changwoo Lee et al.NeurIPS 2025 · 5 citations
- LevAttention: Time, Space and Streaming Efficient Algorithm for Heavy AttentionsRavindran Kannan, Chiranjib Bhattacharyya, Praneeth Kacham, David P. WoodruffICLR 2025
- Algorithm and Hardness for Dynamic Attention Maintenance in Large Language ModelsJan van den Brand, Zhao Song, Tianyi ZhouICML 2024 · 35 citations
- Rethinking Attention with PerformersKrzysztof Marcin Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song et al.ICLR 2021 · 122 citations
