跳到正文
研踪PaperTrail
← 研踪 PaperTrail

arXiv:2602.00874 · v2

Sublinear Time Quantum Algorithm for Attention Approximation

首次提交 2026-02-01 03:33
版本更新 2026-11-23 12:18
雷达观测 2026-11-24 14:50
arXiv ↗PDF ↗

摘要

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\mathbf{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)Ω(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λ3+sλ2d+d)+ε−2sλd)\widetilde{O}(ε^{-1} n^{0.5} (s_λ^{3} + s_λ^{2} d + d) + ε^{-2} s_λd) time, where εε is the target accuracy and sλs_λ is the λλ-statistical dimension of the exponential kernel defined by QQ and KK. Each row query can be answered in O~(sλ2+sλd)\widetilde{O}(s_λ^2 + s_λd) time. If every row sum of AA exceeds ε∥A∥+λnε\|A\|+λ\sqrt n, then with probability 1−1/poly(n)1-1/\mathrm{poly}(n) the answers have Frobenius-norm error O(β∥D−1∥(ε∥A∥F+λn)∥V∥F)O(β\|D^{-1}\|(ε\|A\|_F+λ\sqrt n)\|V\|_F). Here β=(1−(ε∥A∥+λn)∥D−1∥)−1≥1β=(1-(ε\|A\|+λ\sqrt n)\|D^{-1}\|)^{-1}\geq 1 is close to 11 when every row sum is much larger than ε∥A∥+λnε\|A\|+λ\sqrt n. 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 sampling of the rows of VV by their squared norms, with a median over independent samples, for the multiplication with VV.

作者备注:ICLR 2026. This version corrects the main theorem: the preprocessing time, the row-query count, and the error bound, whose $λ\sqrt{n}$ term is additive and which needs large row sums and a full-rank Nystrom factor. The product with V now samples rows by squared norms, as the published leverage-score step and its boosting were invalid, and the error proof is completed

AI 论文解读

基于摘要 · 非全文审阅

此版本尚未生成 AI 解读。解读由后台任务生成并按论文版本保存,登录后共享已有结果。

版本差异

本站首次收录为 v2,暂无更早版本可对照。

观测到的版本

相邻记录可能跳过中间版本;首次发现 v2 及以上也会标为版本更新。

v2 · 2026-11-23 12:18 · 最新观测版本

Sublinear Time Quantum Algorithm for Attention Approximation

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\mathbf{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)Ω(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λ3+sλ2d+d)+ε−2sλd)\widetilde{O}(ε^{-1} n^{0.5} (s_λ^{3} + s_λ^{2} d + d) + ε^{-2} s_λd) time, where εε is the target accuracy and sλs_λ is the λλ-statistical dimension of the exponential kernel defined by QQ and KK. Each row query can be answered in O~(sλ2+sλd)\widetilde{O}(s_λ^2 + s_λd) time. If every row sum of AA exceeds ε∥A∥+λnε\|A\|+λ\sqrt n, then with probability 1−1/poly(n)1-1/\mathrm{poly}(n) the answers have Frobenius-norm error O(β∥D−1∥(ε∥A∥F+λn)∥V∥F)O(β\|D^{-1}\|(ε\|A\|_F+λ\sqrt n)\|V\|_F). Here β=(1−(ε∥A∥+λn)∥D−1∥)−1≥1β=(1-(ε\|A\|+λ\sqrt n)\|D^{-1}\|)^{-1}\geq 1 is close to 11 when every row sum is much larger than ε∥A∥+λnε\|A\|+λ\sqrt n. 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 sampling of the rows of VV by their squared norms, with a median over independent samples, for the multiplication with VV.

查看此版本解读 →查看此版本原文 ↗