Lune

ICLR2026Top-tier venue

Sublinear Time Quantum Algorithm for Attention Approximation

Zhao Song, Jianfei Xue, Jiahao Zhang, Lichen Zhang

2026Year
2Citations
1Top-tier citations

Abstract

Given the query, key and value matrices Q,K,V∈Rn×dQ, K, V\in \mathbb{R}^{n\times d}, the attention module is defined as Att(Q,K,V)=D−1AV\mathrm{Att}(Q, K, V)=D^{-1}AV where A=exp⁡(QK⊤/d)A=\exp(QK^\top/\sqrt{d}) with exp⁡(⋅)\exp(\cdot) applied entrywise, D=diag(A1n)D=\mathrm{diag}(A{\bf 1}_n). The attention module is the backbone of modern transformers and large language models, but explicitly forming the softmax matrix D−1AD^{-1}A incurs Ω(n2)\Omega(n^2) time, motivating numerous approximation schemes that reduce runtime to O~(nd)\widetilde O(nd) via sparsity or low-rank factorization. We propose a quantum data structure that approximates any row of Att(Q,K,V)\mathrm{Att}(Q, K, V) using only row queries to Q,K,VQ, K, V. Our algorithm preprocesses these matrices in O~(ϵ−1n0.5(sλ2.5+sλ1.5d+α0.5d))\widetilde{O}\left( \epsilon^{-1} n^{0.5} \left( s_\lambda^{2.5} + s_\lambda^{1.5} d + \alpha^{0.5} d \right) \right) time, where ϵ\epsilon is the target accuracy, sλs_\lambda is the λ\lambda-statistical dimension of the exponential kernel defined by QQ and KK, and α\alpha measures the row distortion of VV that is at most d/srank(V)d/{\rm srank}(V), the stable rank of VV. Each row query can be answered in O~(sλ2+sλd)\widetilde{O}(s_\lambda^2 + s_\lambda d) time. To our knowledge, this is the first quantum data structure that approximates rows of the attention matrix in sublinear time with respect to nn. Our approach relies on a quantum Nyström approximation of the exponential kernel, quantum multivariate mean estimation for computing DD, and quantum leverage score sampling for the multiplication with VV.

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.

Questions to start from

Your agent calls

Luneget_paper_fulltext

Ask in Lune

Free to start. No credit card required.

lune papers fulltext 67e362e5-454e-4e44-8f6e-37243cbc06cf

Cited by top-tier papers1

Ask how each one uses it

Builds on34

Related papers

Dusk over the sea between two cliffs drawn in fine vertical lines