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

亚二次时间Transformer替代方案的根本局限性

Fundamental Limitations on Subquadratic Alternatives to Transformers

Columbia University(哥伦比亚大学)

Josh Alman, Hantao Yu

AI总结:

本文证明,在细粒度复杂性理论猜想下,任何亚二次时间的Transformer替代方案(如Mamba)都无法执行文档相似性任务,而Transformer可完成该任务,其二次时间不可避免。

摘要:

Transformer架构被广泛部署在许多流行且具有影响力的大型语言模型中。其核心是用于计算成对标记之间相关性的注意力机制。执行注意力计算所需的时间与输入大小呈二次方关系,并且已成为Transformer操作的时间瓶颈。为了规避这一问题,研究人员采用了多种方法,包括设计启发式算法以更快地执行注意力计算,以及提出可以更快计算的注意力机制替代方案。例如,诸如Mamba之类的状态空间模型被设计为用几乎线性的时间替代方案来取代注意力。在本文中,我们证明了任何此类方法都无法执行Transformer能够执行的重要任务(假设细粒度复杂性理论中的一个流行猜想)。我们专注于文档相似性任务,其中给定许多文档作为输入,并希望找到一对(近似)最相似的文档。我们证明了Transformer能够执行此任务,并且证明了任何算法都无法在真正的亚二次时间内执行此任务。因此,任何可以在亚二次时间内评估的模型——无论是由于亚二次时间的注意力启发式算法、像Mamba这样更快的注意力替代方案,还是任何其他原因——都无法执行此任务。换句话说,为了执行(隐式或显式地)涉及文档相似性的任务,人们不妨使用Transformer,并且无法避免其二次方运行时间。

英文摘要:

The Transformer architecture is widely deployed in many popular and impactful Large Language Models. At its core is the attention mechanism for calculating correlations between pairs of tokens. Performing an attention computation takes quadratic time in the input size, and had become the time bottleneck for transformer operations. In order to circumvent this, researchers have used a variety of approaches, including designing heuristic algorithms for performing attention computations faster, and proposing alternatives to the attention mechanism which can be computed more quickly. For instance, state space models such as Mamba were designed to replace attention with an almost linear time alternative. In this paper, we prove that any such approach cannot perform important tasks that Transformer is able to perform (assuming a popular conjecture from fine-grained complexity theory). We focus on document similarity tasks, where one is given as input many documents and would like to find a pair which is (approximately) the most similar. We prove that Transformer is able to perform this task, and we prove that this task cannot be performed in truly subquadratic time by any algorithm. Thus, any model which can be evaluated in subquadratic time - whether because of subquadratic-time heuristics for attention, faster attention replacements like Mamba, or any other reason - cannot perform this task. In other words, in order to perform tasks that (implicitly or explicitly) involve document similarity, one may as well use Transformer and cannot avoid its quadratic running time.

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

↑