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

从多质点动力学系统观点理解和改进Transformer

Understanding and Improving Transformer From a Multi-Particle Dynamic System Point of View

Peking University(北京大学);Microsoft Research(微软研究院);Microsoft Research Asia(微软亚洲研究院)

Yiping Lu, Zhuohan Li, Di He, Zhiqing Sun, Bin Dong, Tao Qin, Liwei Wang, Tie-Yan Liu

摘要:

Transformer体系结构广泛用于自然语言处理。尽管取得了成功,但Transformer的设计原理仍然难以捉摸。在本文中,我们提供了一个新的角度来理解的架构:我们表明,Transformer可以在数学上解释为一个数值常微分方程(ODE)求解器的对流扩散方程在多粒子动力系统。特别是,如何在一个句子中的单词被抽象到上下文通过通过层的Transformer可以被解释为近似多个粒子的运动在空间中使用Lie-Trotter分裂方案和欧拉的方法。鉴于这种ODE的观点,丰富的文献的数值分析可以引导我们在设计有效的结构以外的Transformer。作为一个例子,我们建议取代李-特罗特分裂计划的Strang-Marchuk分裂计划,一个计划,更常用的和低得多的局部截断误差。Strang-Marchuk分裂方案表明,自注意和位置前馈网络(FFN)子层不应该被同等对待。相反,在每一层中,应使用两个按位置FFN子层,并且自注意子层被放置在其间。这导致了一个全新的架构。这样的FFN-attention-FFN层是“马卡龙式的”,因此我们将具有这种新架构的网络称为马卡龙网。通过大量的实验,我们表明,Macaron网络是优于Transformer的监督和无监督学习任务。可重复的代码和预训练模型可以在https://github.com/zhuohan123/macaron-net上找到

英文摘要:

The Transformer architecture is widely used in natural language processing. Despite its success, the design principle of the Transformer remains elusive. In this paper, we provide a novel perspective towards understanding the architecture: we show that the Transformer can be mathematically interpreted as a numerical Ordinary Differential Equation (ODE) solver for a convection-diffusion equation in a multi-particle dynamic system. In particular, how words in a sentence are abstracted into contexts by passing through the layers of the Transformer can be interpreted as approximating multiple particles' movement in the space using the Lie-Trotter splitting scheme and the Euler's method. Given this ODE's perspective, the rich literature of numerical analysis can be brought to guide us in designing effective structures beyond the Transformer. As an example, we propose to replace the Lie-Trotter splitting scheme by the Strang-Marchuk splitting scheme, a scheme that is more commonly used and with much lower local truncation errors. The Strang-Marchuk splitting scheme suggests that the self-attention and position-wise feed-forward network (FFN) sub-layers should not be treated equally. Instead, in each layer, two position-wise FFN sub-layers should be used, and the self-attention sub-layer is placed in between. This leads to a brand new architecture. Such an FFN-attention-FFN layer is "Macaron-like", and thus we call the network with this new architecture the Macaron Net. Through extensive experiments, we show that the Macaron Net is superior to the Transformer on both supervised and unsupervised learning tasks. The reproducible codes and pretrained models can be found at https://github.com/zhuohan123/macaron-net

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

↑