[论文解读] Learning to Encode Position for Transformer with Continuous Dynamical Model
本文提出 FLOATER,一种用于 Transformer 的基于流的连续动力学位置编码器,使位置编码具有可学习、数据驱动且参数高效的特性,在机器翻译、语言理解与问答任务上提升性能。
We introduce a new way of learning to encode position information for non-recurrent models, such as Transformer models. Unlike RNN and LSTM, which contain inductive bias by loading the input tokens sequentially, non-recurrent models are less sensitive to position. The main reason is that position information among input units is not inherently encoded, i.e., the models are permutation equivalent; this problem justifies why all of the existing models are accompanied by a sinusoidal encoding/embedding layer at the input. However, this solution has clear limitations: the sinusoidal encoding is not flexible enough as it is manually designed and does not contain any learnable parameters, whereas the position embedding restricts the maximum length of input sequences. It is thus desirable to design a new position layer that contains learnable parameters to adjust to different datasets and different architectures. At the same time, we would also like the encodings to extrapolate in accordance with the variable length of inputs. In our proposed solution, we borrow from the recent Neural ODE approach, which may be viewed as a versatile continuous version of a ResNet. This model is capable of modeling many kinds of dynamical systems. We model the evolution of encoded results along position index by such a dynamical system, thereby overcoming the above limitations of existing methods. We evaluate our new position layers on a variety of neural machine translation and language understanding tasks, the experimental results show consistent improvements over the baselines.
研究动机与目标
- 在非循环 Transformer 中激发对可学习、可归纳的位置信息编码的需求。
- 提出 FLOATER,一种用于生成位置信息编码的连续动力学系统。
- 确保 FLOATER 数据驱动、参数高效且与标准 Transformer 架构兼容。
- 展示 FLOATER 在机器翻译、语言理解与问答基准上的改进。
提出的方法
- 将位置信息编码建模为由神经网络 h(t, p(t); θ_h) 驱动的连续动力学系统 p(t) 。
- 通过固定 Δt 对 p(i) 在越来越大的 t_i 处进行评估离散化,得到每个标记的位置信息向量。
- 在 Transformer 块之间共享动力学 h(·),以减少参数量,同时允许每个块有不同的初始 p(0)。
- 当 h(·)=0 时,FLOATER 退化为原始正弦编码,以实现向后兼容。
- 可选地在所有 Transformer 块注入动态编码,以提升性能。
- 通过从预训练 Transformer 初始化并进行微调,提供暖启动策略。
实验结果
研究问题
- RQ1一个用于位置信息编码的连续动力学系统,是否能够在固定的正弦编码或逐层嵌入之上提供可归纳、数据驱动且参数高效的改进?
- RQ2与基线相比,FLOATER 在神经机器翻译、语言理解和问答任务中的表现如何?
- RQ3在所有块应用 FLOATER 与仅在输入块应用的影响有何不同?
- RQ4FLOATER 与预训练 Transformer 模型的兼容性如何,暖启动训练如何影响性能?
主要发现
| 模型 | BLEU(↑) | 参数数量(↓) |
|---|---|---|
| FLOATER | 28.57 | 526.3K |
| 1 层 RNN + 标量 | 27.99 | 263.2K |
| 2 层 RNN + 标量 | 28.16 | 526.3K |
| 1 层 RNN + 向量 | 27.99 | 1,050.0K |
- FLOATER 在MT、GLUE、RACE 与 SQuAD 任务上对基线表现出持续改进。
- 在所有 Transformer 块中使用 FLOATER 的表现优于仅在输入块使用时。
- FLOATER 与 Vanilla Transformer 兼容,当 h(·)=0 时退化为正弦编码,支持从预训练模型进行暖启动。
- 在 WMT En-De 上,FLOATER 的 BLEU 为 28.57,参数量为 526.3K,超越了若干不同参数预算的基于 RNN 的编码器。
- FLOATER 展现出归纳行为,在训练时未见过的较长序列上表现良好,尤其在 MT 场景。
- 训练 FLOATER 会产生额外开销,但通过暖启动和参数共享策略,可以将开销控制在适度水平(约 20–30%);推理阶段通过存储位置偏置来避免额外开销。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。