arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2205.13401cs.LGcs.CLstat.ML
收藏

您的Transformer可能没有您期望的那么强大

Your Transformer May Not be as Powerful as You Expect

Peking University(北京大学);Zhejiang Lab(之江实验室);Microsoft Research(微软研究院);Carnegie Mellon University(卡内基梅隆大学)

Shengjie Luo, Shanda Li, Shuxin Zheng, Tie-Yan Liu, Liwei Wang, Di He

摘要:

相对位置编码(RPE),它编码任何一对标记之间的相对距离,是对原始Transformer最成功的修改之一。据我们所知,基于RPE的Transformers的理论理解在很大程度上是未探索的。在这项工作中,我们从数学上分析了基于RPE的Transformers模型是否能够近似任何连续序列到序列函数的能力。人们可能会自然地认为答案是肯定的--基于RPE的Transformers是通用函数逼近器。然而,我们提出了一个否定的结果,通过显示存在连续的序列到序列的功能,基于RPE的Transformers不能近似的神经网络是多么深和宽。一个关键原因在于,大多数RPE都被放置在softmax注意力中,总是生成正确的随机矩阵。这限制了网络捕获RPE中的位置信息并限制了其容量。为了克服这个问题,使模型更强大,我们首先提出了基于RPE的Transformers实现通用函数逼近的充分条件。在理论指导下,我们开发了一个新的注意模块,称为通用RPE为基础的(URPE)注意,它满足的条件。因此,相应的基于URPE的Transformers成为通用函数逼近器。覆盖典型架构和任务的大量实验表明,我们的模型是参数高效的,可以在广泛的应用中实现卓越的性能。该守则将在https://github.com/lsj2408/URPE上公布。

英文摘要:

Relative Positional Encoding (RPE), which encodes the relative distance between any pair of tokens, is one of the most successful modifications to the original Transformer. As far as we know, theoretical understanding of the RPE-based Transformers is largely unexplored. In this work, we mathematically analyze the power of RPE-based Transformers regarding whether the model is capable of approximating any continuous sequence-to-sequence functions. One may naturally assume the answer is in the affirmative -- RPE-based Transformers are universal function approximators. However, we present a negative result by showing there exist continuous sequence-to-sequence functions that RPE-based Transformers cannot approximate no matter how deep and wide the neural network is. One key reason lies in that most RPEs are placed in the softmax attention that always generates a right stochastic matrix. This restricts the network from capturing positional information in the RPEs and limits its capacity. To overcome the problem and make the model more powerful, we first present sufficient conditions for RPE-based Transformers to achieve universal function approximation. With the theoretical guidance, we develop a novel attention module, called Universal RPE-based (URPE) Attention, which satisfies the conditions. Therefore, the corresponding URPE-based Transformers become universal function approximators. Extensive experiments covering typical architectures and tasks demonstrate that our model is parameter-efficient and can achieve superior performance to strong baselines in a wide range of applications. The code will be made publicly available at https://github.com/lsj2408/URPE.

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

↑