Skip to main content
QUICK REVIEW

[论文解读] GMAT: Global Memory Augmentation for Transformers

Ankit Gupta, Jonathan Berant|arXiv (Cornell University)|Jun 5, 2020
Parallel Computing and Optimization TechniquesComputer Science参考文献 30被引用 21
一句话总结

GMAT 在稀疏 Transformer 架构中引入了一个全局记忆模块,实现了 O(M·(L+M)) 的内存开销(其中 M ≪ L),从而高效地建模长序列。它在全局推理任务、掩码语言建模和阅读理解任务中提升了性能,同时实现了极低精度损失的序列压缩。

ABSTRACT

Transformer-based models have become ubiquitous in natural language processing thanks to their large capacity, innate parallelism and high performance. The contextualizing component of a Transformer block is the $ extit{pairwise dot-product}$ attention that has a large $Ω(L^2)$ memory requirement for length $L$ sequences, limiting its ability to process long documents. This has been the subject of substantial interest recently, where multiple approximations were proposed to reduce the quadratic memory requirement using sparse attention matrices. In this work, we propose to augment sparse Transformer blocks with a dense attention-based $ extit{global memory}$ of length $M$ ($\ll L$) which provides an aggregate global view of the entire input sequence to each position. Our augmentation has a manageable $O(M\cdot(L+M))$ memory overhead, and can be seamlessly integrated with prior sparse solutions. Moreover, global memory can also be used for sequence compression, by representing a long input sequence with the memory representations only. We empirically show that our method leads to substantial improvement on a range of tasks, including (a) synthetic tasks that require global reasoning, (b) masked language modeling, and (c) reading comprehension.

研究动机与目标

  • 解决标准自注意力机制在长序列中带来的二次方内存开销问题。
  • 克服稀疏注意力机制在捕捉长输入中全局依赖关系方面的局限性。
  • 通过紧凑的全局记忆向量表示长序列,实现高效的序列压缩。
  • 与现有稀疏注意力变体无缝集成,在不显著增加模型参数量的情况下提升性能。
  • 在需要全局推理的任务(如问答和语言建模)中展示其有效性。

提出的方法

  • 在输入序列前添加 M 个全局记忆标记,以增强稀疏 Transformer 块。
  • 在输入标记与记忆标记之间使用密集注意力,同时在输入标记之间保持稀疏注意力。
  • 允许记忆标记通过标准自注意力机制关注所有输入标记和记忆标记。
  • 引入记忆更新机制,使记忆向量在每一层通过整个序列的注意力进行更新。
  • 将最终的记忆状态用作输入序列的压缩表示,支持通过额外的 GMAT 层实现解压缩。
  • 在阅读理解任务中,将输入记忆标记替换为输入问题的前 64 个标记,以提升性能。

实验结果

研究问题

  • RQ1少量密集的全局记忆能否改善稀疏 Transformer 模型在长距离推理中的表现?
  • RQ2全局记忆在需要全局上下文聚合的任务(如问答和语言建模)中表现如何?
  • RQ3全局记忆在实现高效序列压缩方面能达到何种程度,且性能下降可忽略?
  • RQ4全局记忆能否缓解基于局部性的注意力机制在涉及非局部依赖关系任务中的失败模式?
  • RQ5当输入被置换或对抗性修改时,GMAT 与标准稀疏注意力相比表现如何?

主要发现

  • 在 HotpotQA-GS 数据集上,GMAT 将 F1 分数从 BERT 的 66.3 提升至 68.3,比较类型问题的相对提升达 6.8%。
  • 在问题重复(QR)设置下,GMAT 在 HotpotQA-GS+QR 上取得 67.4 的 F1 分数,优于基线的 66.4,证实其在长上下文推理中的有效性。
  • 在对抗性 HotpotQA 上,GMAT 将 F1 从 64.0 提升至 64.6,表明其对分布偏移具有鲁棒性。
  • 使用 GMAT 进行序列压缩实现了 8 倍的表示尺寸缩减,且在掩码语言建模和阅读理解任务中性能仅出现小幅下降。
  • 即使基线模型(512×4,0)通过问题重复增强,带有全局记忆的模型(512×4,64)仍表现更优,证明显式全局记忆的价值。
  • 将静态记忆标记替换为问题的前 64 个标记后性能提升,表明动态记忆初始化可增强推理能力。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。