arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2310.04064cs.DScs.CCcs.CLcs.LGstat.ML
收藏

如何捕获高阶相关性?将矩阵Softmax注意力推广至克罗内克计算

How to Capture Higher-order Correlations? Generalizing Matrix Softmax Attention to Kronecker Computation

Columbia University(哥伦比亚大学);Adobe Research(奥多比研究院)

Josh Alman, Zhao Song

AI总结:

该研究将transformer注意力推广至可捕获高阶相关性的张量形式,证明了输入项有界时存在近线性时间算法,同时给出对应下界,揭示了项有界性与张量阶数的权衡关系。

摘要:

在经典的transformer注意力机制中,给定三个尺寸为$n \times d$的矩阵$Q, K, V$(即查询、键和值令牌),目标是计算一个新的$n \times d$矩阵$D^{-1} \exp(QK^\top) V$,其中$D = \mathrm{diag}( \exp(QK^\top) {\bf 1}_n )$。本研究针对一种可捕获三重相关性的注意力推广形式展开研究,该推广形式能够解决已被证明transformer无法处理的三重连接检测问题。\n这种推广形式的潜在弊端在于计算难度似乎更高,因为直接算法的时间复杂度为$n$的三次方。但我们证明,在有界输入项设置下(该设置在实际场景中存在,且在理论与实践领域均已有充分研究),实际上存在近线性时间算法。更确切地说,我们证明了输入项有界是快速执行广义计算的充要条件:\n• 正面结果:若输入矩阵的所有项上界为$o(\sqrt[3]{\log n})$,我们给出了以$n^{1+o(1)}$时间近似“张量型”注意力矩阵的方法。\n• 负面结果:若输入矩阵的项可达到$Ω(\sqrt[3]{\log n})$的量级,则不存在运行时间快于$n^{3-o(1)}$的算法(基于细粒度复杂度理论中的强指数时间假设)。\n我们还证明,所提出的构造、算法及下界可自然推广至更高阶张量与相关性场景。有趣的是,张量阶数越高,实现高效算法所需的项上界就越低。因此,我们的研究结果揭示了输入项有界性与可用于实现更具表达力、更高效注意力计算的张量阶数之间的天然权衡关系。

英文摘要:

In the classical transformer attention scheme, we are given three $n \times d$ size matrices $Q, K, V$ (the query, key, and value tokens), and the goal is to compute a new $n \times d$ size matrix $D^{-1} \exp(QK^\top) V$ where $D = \mathrm{diag}( \exp(QK^\top) {\bf 1}_n )$. In this work, we study a generalization of attention which captures triple-wise correlations. This generalization is able to solve problems about detecting triple-wise connections that were shown to be impossible for transformers. The potential downside of this generalization is that it appears as though computations are even more difficult, since the straightforward algorithm requires cubic time in $n$. However, we show that in the bounded-entry setting (which arises in practice, and which is well-studied in both theory and practice), there is actually a near-linear time algorithm. More precisely, we show that bounded entries are both necessary and sufficient for quickly performing generalized computations: $\bullet$ On the positive side, if all entries of the input matrices are bounded above by $o(\sqrt[3]{\log n})$ then we show how to approximate the ``tensor-type'' attention matrix in $n^{1+o(1)}$ time. $\bullet$ On the negative side, we show that if the entries of the input matrices may be as large as $Ω(\sqrt[3]{\log n})$, then there is no algorithm that runs faster than $n^{3-o(1)}$ (assuming the Strong Exponential Time Hypothesis from fine-grained complexity theory). We also show that our construction, algorithms, and lower bounds naturally generalize to higher-order tensors and correlations. Interestingly, the higher the order of the tensors, the lower the bound on the entries needs to be for an efficient algorithm. Our results thus yield a natural tradeoff between the boundedness of the entries, and order of the tensor one may use for more expressive, efficient attention computation.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑