证明了任何比Transformer更快的模型都无法完成文档相似性任务。
Fundamental Limitations on Subquadratic Alternatives to Transformers
- 基于细粒度复杂度理论,证明了文档相似性任务必须耗时至少二次方。
- 即使使用Mamba等线性替代方案,也无法在真正亚二次时间内完成该任务。
- 适合关注模型效率与能力边界的研究者阅读。
Transformer架构广泛应用于众多大型语言模型中,其核心是计算标记对之间的相关性注意力机制。注意力计算的时间复杂度为输入长度的平方,已成为Transformer运算的主要瓶颈。为突破此限制,研究者提出了多种方法,包括设计启发式算法加速注意力计算,或提出可更快计算的注意力替代机制(如状态空间模型Mamba)。本文证明,在一个流行的细粒度复杂度理论假设下,任何此类方法均无法完成Transformer能完成的重要任务。研究聚焦于文档相似性任务:给定多个文档,需找出一对近似最相似的文档。我们证明,Transformer能够实现此任务,而该任务无法在真正亚二次时间内被任何算法完成。因此,任何可在亚二次时间内评估的模型——无论因注意力的亚二次启发式、类似Mamba的快速替代,或其他原因——均无法完成此任务。换言之,若任务隐含或明确涉及文档相似性,则使用Transformer并接受其二次时间开销是不可避免的。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。