arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2312.14820cs.LG
收藏

注意力有多平滑?

How Smooth Is Attention?

École Normale Supérieure PSL(巴黎高等师范学院PSL);Apple(苹果公司);CNRS(法国国家科学研究中心)

Valérie Castin, Pierre Ablin, Gabriel Peyré

AI总结:

本文详细研究了Transformer中自注意力的Lipschitz常数,证明了其在合理序列长度下以$\sqrt{n}$为紧界,并在平均场机制下给出了与$n$无关的匹配上下界,得到了预训练及随机初始化BERT和GPT-2实验的支持。

摘要:

自注意力和掩码自注意力是Transformer取得卓越成功的核心。然而,我们对注意力的数学理解,特别是对其在分析鲁棒性和表达能力时起关键作用的Lipschitz性质,仍不完整。我们在实际场景中对自注意力的Lipschitz常数进行了详细研究,探讨了序列长度$n$和层归一化对未掩码和掩码自注意力局部Lipschitz常数的影响。具体而言,我们证明对于任意紧致集中长度为$n$的输入,自注意力的Lipschitz常数在常数因子范围内以$\sqrt{n}$为界,且该界限在合理的序列长度下是紧的。当序列长度$n$过大导致前述界限不再紧时(我们称之为平均场机制),我们给出了与$n$无关的上界和匹配的下界。我们针对掩码自注意力提出的平均场框架具有新颖性,具有独立的研究价值。我们在预训练和随机初始化的BERT与GPT-2上进行的实验支持了我们的理论发现。

英文摘要:

Self-attention and masked self-attention are at the heart of Transformers' outstanding success. Still, our mathematical understanding of attention, in particular of its Lipschitz properties - which are key when it comes to analyzing robustness and expressive power - is incomplete. We provide a detailed study of the Lipschitz constant of self-attention in several practical scenarios, discussing the impact of the sequence length $n$ and layer normalization on the local Lipschitz constant of both unmasked and masked self-attention. In particular, we show that for inputs of length $n$ in any compact set, the Lipschitz constant of self-attention is bounded by $\sqrt{n}$ up to a constant factor and that this bound is tight for reasonable sequence lengths. When the sequence length $n$ is too large for the previous bound to be tight, which we refer to as the mean-field regime, we provide an upper bound and a matching lower bound which are independent of $n$. Our mean-field framework for masked self-attention is novel and of independent interest. Our experiments on pretrained and randomly initialized BERT and GPT-2 support our theoretical findings.

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

↑