Sublinear Time Quantum Algorithm for Attention Approximation
Zhao Song, Jianfei Xue, Jiahao Zhang, Lichen Zhang
ICLR 2026
Abstract. Given the query, key and value matrices , the attention matrix is defined as where with applied entrywise, . The attention matrix is the backbone of modern transformers and large language models, but explicitly forming the softmax matrix incurs , 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{"o}m approximation of the exponential kernel, quantum multivariate mean estimation for computing , and quantum leverage score sampling for the multiplication with .
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperadd · history
Loading the discussion…