注意力是一种平滑三次样条
Attention is a smoothed cubic spline
AI总结:
该研究揭示Transformer中的注意力模块是平滑三次样条,证明ReLU激活下多种注意力及Transformer全组件均为三次或高阶样条,且Pierce-Birkhoff猜想成立时逆命题也成立,用样条理论阐释了Transformer的本质。
摘要:
我们揭示了一个或许重要但此前未被观察到的洞见:Transformer中的注意力模块是一种平滑三次样条。从这个角度来看,Transformer中这个神秘却关键的组件,便成为了经典逼近理论中根深蒂固的古老概念的自然延伸。更确切地说,我们证明了在ReLU激活下,注意力、掩码注意力、编码器-解码器注意力均为三次样条。由于Transformer的每个组件都由各类注意力模块(即三次样条)与前馈神经网络(即线性样条)组合构成,因此其所有组件——编码器、解码器、编码器-解码器块;多层编码器与解码器;乃至Transformer本身——均为三次或更高阶样条。若假设Pierce-Birkhoff猜想成立,那么逆命题也成立,即每个样条都是一个ReLU激活的编码器。由于样条通常仅为C²连续的,获得平滑C∞版本的一种方法是用平滑激活函数替换ReLU;而若选择SoftMax作为该激活函数,我们便得到了Vaswani等人提出的原始Transformer。这一洞见通过将Transformer完全用样条——应用数学中最知名、研究最透彻的对象之一——来表述,阐明了Transformer的本质。
英文摘要:
We highlight a perhaps important but hitherto unobserved insight: The attention module in a transformer is a smoothed cubic spline. Viewed in this manner, this mysterious but critical component of a transformer becomes a natural development of an old notion deeply entrenched in classical approximation theory. More precisely, we show that with ReLU-activation, attention, masked attention, encoder-decoder attention are all cubic splines. As every component in a transformer is constructed out of compositions of various attention modules (= cubic splines) and feed forward neural networks (= linear splines), all its components -- encoder, decoder, and encoder-decoder blocks; multilayered encoders and decoders; the transformer itself -- are cubic or higher-order splines. If we assume the Pierce-Birkhoff conjecture, then the converse also holds, i.e., every spline is a ReLU-activated encoder. Since a spline is generally just $C^2$, one way to obtain a smoothed $C^\infty$-version is by replacing ReLU with a smooth activation; and if this activation is chosen to be SoftMax, we recover the original transformer as proposed by Vaswani et al. This insight sheds light on the nature of the transformer by casting it entirely in terms of splines, one of the best known and thoroughly understood objects in applied mathematics.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。