The self-attention mechanism, at the heart of the Transformer model, is able to effectively model pairwise interactions between tokens. However, numerous recent works have shown that it is unable to perform basic tasks involving detecting triples of correlated tokens, or compositional tasks where multiple input tokens need to be referenced to generate a result. Some higher-dimensional alternatives to self-attention have been proposed to address this, including higher-order attention and Strassen attention, which can perform some of these polyadic tasks in exchange for slower, superquadratic running times. In this work, we define a vast class of generalizations of self-attention, which we call poly-attention mechanisms. Our mechanisms can incorporate arbitrary higher-order (tensor) computations as well as arbitrary relationship structures between the input tokens, and they include the aforementioned alternatives as special cases. We then systematically study their computational complexity and representational strength, including giving new algorithms and matching complexity-theoretic lower bounds on the time complexity of computing the attention matrix exactly as well as approximately, and tightly determining which polyadic tasks they can each perform. Our results give interesting trade-offs between different desiderata for these mechanisms, including a tight relationship between how expressive a mechanism is, and how large the coefficients in the model may be so that the mechanism can be approximated in almost-linear time. Notably, we give a new attention mechanism which can be computed exactly in quadratic time, and which can perform function composition for any fixed number of functions. Prior mechanisms, even for just composing two functions, could only be computed in superquadratic time, and our new lower bounds show that faster algorithms for them are not possible.


翻译:自注意力机制作为Transformer模型的核心,能够有效建模标记之间的成对交互。然而,近期大量研究表明,该机制无法执行涉及检测三个相关标记的基础任务,也无法完成需要引用多个输入标记以生成结果的组合任务。为应对这一问题,已有研究提出若干自注意力的高维替代方案,包括高阶注意力和Strassen注意力,这些方案能够执行部分多元任务,但代价是运行时间较慢且具有超二次复杂度。本文定义了一类广泛的自注意力泛化机制,称为多注意力机制。该机制能够整合任意高阶(张量)计算以及输入标记之间的任意关系结构,并将前述替代方案作为特例包含其中。我们系统研究了其计算复杂度与表示能力,包括提出新算法、给出计算注意力矩阵(精确计算与近似计算)时间复杂度的匹配下界,并严格界定了各机制可执行的多元任务范围。研究结果揭示了这些机制在不同需求间的权衡关系,特别是机制表达能力与模型系数大小之间的紧密联系——后者决定了该机制能否在近线性时间内被近似计算。值得注意的是,我们提出了一种可在二次时间内精确计算的新注意力机制,该机制能够执行任意固定数量函数的组合运算。而现有机制即使仅组合两个函数,也需要超二次时间进行计算,且我们的新下界证明对此类机制不存在更快的算法。

0
下载
关闭预览

相关内容

利用注意力机制来“动态”地生成不同连接的权重,这就是自注意力模型(Self-Attention Model). 注意力机制模仿了生物观察行为的内部过程,即一种将内部经验和外部感觉对齐从而增加部分区域的观察精细度的机制。注意力机制可以快速提取稀疏数据的重要特征,因而被广泛用于自然语言处理任务,特别是机器翻译。而自注意力机制是注意力机制的改进,其减少了对外部信息的依赖,更擅长捕捉数据或特征的内部相关性
扩散模型中的注意力机制:综述
专知会员服务
24+阅读 · 2025年4月10日
最新《注意力机制与深度学习结合》综述论文
专知会员服务
76+阅读 · 2021年6月17日
注意力机制综述
专知会员服务
210+阅读 · 2021年1月26日
注意力机制介绍,Attention Mechanism
专知会员服务
172+阅读 · 2019年10月13日
注意力机制综述(中文版)
专知
23+阅读 · 2021年1月26日
【干货】注意力机制(Attention)最新综述论文及相关源码
GAN生成式对抗网络
11+阅读 · 2018年11月16日
入门 | 什么是自注意力机制?
机器之心
17+阅读 · 2018年8月19日
干货 | NLP中的self-attention【自-注意力】机制
机器学习算法与Python学习
12+阅读 · 2018年4月11日
深度学习中的注意力机制
CSDN大数据
24+阅读 · 2017年11月2日
国家自然科学基金
17+阅读 · 2015年12月31日
国家自然科学基金
14+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
48+阅读 · 2009年12月31日
Arxiv
0+阅读 · 2月16日
Arxiv
0+阅读 · 2月12日
Arxiv
0+阅读 · 2月5日
Arxiv
0+阅读 · 1月23日
VIP会员
相关VIP内容
扩散模型中的注意力机制:综述
专知会员服务
24+阅读 · 2025年4月10日
最新《注意力机制与深度学习结合》综述论文
专知会员服务
76+阅读 · 2021年6月17日
注意力机制综述
专知会员服务
210+阅读 · 2021年1月26日
注意力机制介绍,Attention Mechanism
专知会员服务
172+阅读 · 2019年10月13日
相关基金
国家自然科学基金
17+阅读 · 2015年12月31日
国家自然科学基金
14+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
48+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员