Skip to main content
QUICK REVIEW

[论文解读] On The Computational Complexity of Self-Attention

Feyza Duman Keles, Pruthuvi Mahesakya Wijewardena|arXiv (Cornell University)|Sep 11, 2022
Neural Networks and Reservoir ComputingComputer Science被引用 29
一句话总结

本文在 SETH 下证明了自注意力在多种自注意力形式中的时间复杂度的条件性二次下界,并展示了通过有限泰勒级数在多项式阶数呈指数代价的线性时间近似。

ABSTRACT

Transformer architectures have led to remarkable progress in many state-of-art applications. However, despite their successes, modern transformers rely on the self-attention mechanism, whose time- and space-complexity is quadratic in the length of the input. Several approaches have been proposed to speed up self-attention mechanisms to achieve sub-quadratic running time; however, the large majority of these works are not accompanied by rigorous error guarantees. In this work, we establish lower bounds on the computational complexity of self-attention in a number of scenarios. We prove that the time complexity of self-attention is necessarily quadratic in the input length, unless the Strong Exponential Time Hypothesis (SETH) is false. This argument holds even if the attention computation is performed only approximately, and for a variety of attention mechanisms. As a complement to our lower bounds, we show that it is indeed possible to approximate dot-product self-attention using finite Taylor series in linear-time, at the cost of having an exponential dependence on the polynomial order.

研究动机与目标

  • 推动研究变压器中自注意力的基本时间/精度权衡。
  • 建立条件性下界,表明在许多情形下需要平方级时间在 SETH 下。
  • 探索通过泰勒级数获得自注意力的上界与实际的线性时间近似。
  • 为多种自注意力变体中的困难性结果提供统一框架。

提出的方法

  • 使用来自正交向量问题(OVP)及相关问题(TVPP、BHCP、BHFP)的化简来证明基于 SETH 的下界。
  • 构造向量小工具将 OVP 实例转换为自注意力输入。
  • 分析点积和 softmax 点积自注意力,包括精确与近似(乘法/加法)情形。
  • 扩展到滑动窗口和 l2(RBF)自注意力,以展示矩形/二次型的困难性。
  • 提出多项式(泰勒)近似,以实现线性时间计算,且时间对多项式阶数呈指数依赖。
  • 给出在何种条件下可以实现线性时间计算(有限泰勒级数)。

实验结果

研究问题

  • RQ1在标准复杂性假设下,自注意力计算的输入长度是否可以低于二次复杂度?
  • RQ2近似自注意力方法在比二次时间更快的同时是否具有可证明的误差保证?
  • RQ3在基于 SETH 的困难性化简下,不同的自注意力变体(点积、softmax、滑动窗口、l2)表现如何?
  • RQ4自注意力的可行线性时间近似有哪些,它们带来哪些权衡?
  • RQ5多项式近似如何影响自注意力的时间/精度边界?

主要发现

  • 若干变体的精确和近似自注意力计算在 SETH 下条件性地是二次时间。
  • 在适当条件下,滑动窗口自注意力和 l2(RBF)自注意力继承二次下界。
  • 对 softmax 自注意力的有限泰勒级数近似可实现线性时间计算,时间对多项式阶数呈指数关系。
  • 困难性证明依赖于通过 TVPP 和 BHCP/BHFP 的 OVP 化简,及使向量小工具能实现构造。
  • 该工作强调潜在的“没有免费午餐”现象:在所有输入中,子二次且近似准确的自注意力可能并不现实。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。