arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.16411cs.LGcs.AIcs.CL
收藏

高效训练张量注意力:从三次方到近线性时间

Training Tensor Attention Efficiently: From Cubic to Almost Linear Time

Department of XXX, University of YYY, Location, Country(YYY大学XXX系);School of ZZZ, Institute of WWW, Location, Country(WWW研究所ZZZ学院)

Yang Cao, Yingyu Liang, Zhenmei Shi, Zhao Song

AI总结:

本研究证明张量注意力训练的反向梯度可在几乎线性时间内计算,为高效高阶transformers训练提供了理论基础。

摘要:

张量注意力是一种多视图注意力机制,能够捕捉多种模态之间的高阶相关性,可以克服传统矩阵注意力的表示限制。然而,张量注意力的O(n³)时间复杂度对transformers中的应用构成了重大障碍,其中n是输入序列长度。在本工作中,我们证明了张量注意力训练的反向梯度可以在几乎线性时间内n^{1+o(1)}计算,这与在条目有界假设下的前向计算复杂度相同。我们为梯度提供了闭式解,并提出了一种利用多项式逼近方法和张量代数技术的快速计算方法。此外,我们通过难度分析证明了我们假设的必要性和紧性,表明略微弱化该假设会使梯度问题在真正亚立方时间内不可解。我们的理论结果确立了高效高阶transformers训练的可行性,并可能促进张量注意力架构的实际应用。

英文摘要:

Tensor Attention, a multi-view attention that is able to capture high-order correlations among multiple modalities, can overcome the representational limitations of classical matrix attention. However, the $O(n^3)$ time complexity of tensor attention poses a significant obstacle to its utilization in transformers, where $n$ is the input sequence length. In this work, we prove that the backward gradient of tensor attention training can be computed in almost linear time $n^{1+o(1)}$, the same complexity as its forward computation under the bounded entries assumption. We provide a closed-form solution for the gradient and propose a fast computation method utilizing polynomial approximation methods and tensor algebraic techniques. Furthermore, we prove the necessity and tightness of our assumption through hardness analysis, showing that slightly weakening it renders the gradient problem unsolvable in truly subcubic time. Our theoretical results establish the feasibility of efficient higher-order transformer training and may facilitate practical applications of tensor attention architectures.

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

↑