[论文解读] Augmenting Self-attention with Persistent Memory
本文提出一种全注意力层,将上下文自注意力与键值向量的持续记忆相融合,取代传统前馈子层,在字符和词级基准上实现了具竞争力的语言建模结果。
Transformer networks have lead to important progress in language modeling and machine translation. These models include two consecutive modules, a feed-forward layer and a self-attention layer. The latter allows the network to capture long term dependencies and are often regarded as the key ingredient in the success of Transformers. Building upon this intuition, we propose a new model that solely consists of attention layers. More precisely, we augment the self-attention layers with persistent memory vectors that play a similar role as the feed-forward layer. Thanks to these vectors, we can remove the feed-forward layer without degrading the performance of a transformer. Our evaluation shows the benefits brought by our model on standard character and word level language modeling benchmarks.
研究动机与目标
- 通过用持续记忆替代前馈子层来简化 Transformer 架构的动机。
- 提出一种通过注意力将上下文信息与持续记忆统一在一起的全注意力层。
- 证明持续记忆可以替代前馈组件而不损失性能。
- 在标准的字符和词级语言建模基准上进行评估,并与 Transformer 基线进行比较。
提出的方法
- 将前馈子层重新表述为一种注意力机制,并与自注意力合并。
- 引入一组持续的键值向量,作为非上下文的、全任务级的记忆。
- 构建一个全注意力层,将上下文的键/值与持续记忆的键/值连接起来。
- 对上下文向量和持续记忆向量同时应用多头注意力,并使用 AddNorm 残差连接。
- 使用相对位置编码和自适应上下文机制来处理长序列和大词汇表。
- 使用标准优化和正则化设置,在字符级和词级语言建模基准上进行训练与评估。
实验结果
研究问题
- RQ1持续记忆向量能否在 Transformer 架构中替代前馈子层且不损失性能?
- RQ2一个同时关注上下文和持续记忆的统一全注意力层是否会提升基准数据集上的语言建模性能?
- RQ3持续记忆的不同整合策略如何影响模型效果?
- RQ4在深层 Transformer 堆栈中用持续记忆替代前馈层,其计算和参数含量有何影响?
主要发现
| 模型 | 参数量 | 测试 bpc | 验证集 bpc | 测试 ppl | 验证集 ppl |
|---|---|---|---|---|---|
| All-attention network + adaptive span (Small) (enwik8) | 39M | 1.01 | |||
| All-attention network + adaptive span (Large) (enwik8) | 114M | 0.98 | |||
| All-attention network + adaptive span (Small) (text8) | 38M | 1.11 | 1.05 | 1.11 | 1.05 |
| All-attention network + adaptive span (Large) (text8) | 114M | 1.08 | 1.02 | 1.08 | 1.02 |
| All-attention network + adaptive span (Small) (WikiText-103) | 133M | 20.6 | 19.7 | 20.6 | 19.7 |
| Transformer-XL Standard (large comparison) (WikiText-103) | 257M | 18.3 | 17.7 | 18.3 | 17.7 |
- 带有持续记忆的全注意力网络在字符级基准上取得与最先进水平相近的结果,在某些设置下参数量更少。
- 在 enwik8(字符级)上,具自适应跨度的大型全注意力模型达到 0.98–1.01 bpc 的性能,常常与可比的 Transformer 基线相匹配或超越。
- 在 text8(字符级)上,小型和大型全注意力变体在参数更少的情况下与现有最佳结果相近或超越(如大型设置为 0.98–1.08 bpc)。
- 在 WikiText-103(词级)上,具自适应跨度的全注意力网络在几个困惑度点上超越了先前的小模型结果(例如比同等规模的 Transformer-XL 的最佳记录大约好 3.4 ppl)。
- 消融研究表明持续向量是必不可少的(N 约为 1024 就足够),并且对上下文和持续向量进行联合全注意力优于诸如分离注意力等替代整合方案。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。