arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2106.03764cs.LG
收藏

关于自注意力矩阵的表现力

On the Expressive Power of Self-Attention Matrices

Google Brain(谷歌大脑);University of Cambridge(剑桥大学);The Alan Turing Institute(艾伦·图灵研究所)

Valerii Likhosherstov, Krzysztof Choromanski, Adrian Weller

摘要:

Transformer网络能够捕获来自许多领域(文本、图像、视频、蛋白质等)的数据模式。而对体系结构组件几乎没有改变或没有改变。我们进行了理论分析的核心组成部分负责元件之间的信号传播,即自注意力矩阵。在实践中,这个矩阵通常表现出两个属性:(1)它是稀疏的,这意味着每个令牌只关注其他令牌的一小部分;(2)它根据模块的输入动态变化。考虑到这些因素,我们提出以下问题:一个固定自注意力模块可以近似任意稀疏模式依赖于输入?这种近似所需的隐藏大小$d$有多小?我们在回答这个问题方面取得了进展,并证明了自注意力矩阵可以证明近似稀疏矩阵,其中稀疏性是在每行和每列中有界数量的非零元素。当自注意力的参数固定时,各种稀疏矩阵可以通过仅修改输入来近似。我们的证明是基于随机投影技术,并使用开创性的约翰逊-林登施特劳斯引理。我们的证明是建设性的,使我们能够提出一个算法,找到自适应输入和固定的自注意力参数,以近似一个给定的矩阵。特别是,我们表明,为了近似任何稀疏矩阵到一个给定的精度定义在保持矩阵元素的比率,$d$增长只有数学序列长度$L$(即$d = O(\log L)$)。

英文摘要:

Transformer networks are able to capture patterns in data coming from many domains (text, images, videos, proteins, etc.) with little or no change to architecture components. We perform a theoretical analysis of the core component responsible for signal propagation between elements, i.e. the self-attention matrix. In practice, this matrix typically exhibits two properties: (1) it is sparse, meaning that each token only attends to a small subset of other tokens; and (2) it changes dynamically depending on the input to the module. With these considerations in mind, we ask the following question: Can a fixed self-attention module approximate arbitrary sparse patterns depending on the input? How small is the hidden size $d$ required for such approximation? We make progress in answering this question and show that the self-attention matrix can provably approximate sparse matrices, where sparsity is in terms of a bounded number of nonzero elements in each row and column. While the parameters of self-attention are fixed, various sparse matrices can be approximated by only modifying the inputs. Our proof is based on the random projection technique and uses the seminal Johnson-Lindenstrauss lemma. Our proof is constructive, enabling us to propose an algorithm for finding adaptive inputs and fixed self-attention parameters in order to approximate a given matrix. In particular, we show that, in order to approximate any sparse matrix up to a given precision defined in terms of preserving matrix element ratios, $d$ grows only logarithmically with the sequence length $L$ (i.e. $d = O(\log L)$).

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

↑