Skip to main content
QUICK REVIEW

[Paper Review] GMAT: Global Memory Augmentation for Transformers

Ankit Gupta, Jonathan Berant|arXiv (Cornell University)|Jun 5, 2020
Parallel Computing and Optimization TechniquesComputer Science30 references21 citations
TL;DR

GMAT introduces a global memory module to sparse Transformer architectures, enabling efficient long-sequence modeling with O(M·(L+M)) memory overhead, where M ≪ L. It enhances performance on global reasoning tasks, masked language modeling, and reading comprehension, while also enabling sequence compression with minimal accuracy loss.

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.

Motivation & Objective

  • Address the quadratic memory cost of standard self-attention in Transformers for long sequences.
  • Overcome limitations of sparse attention mechanisms in capturing global dependencies across long inputs.
  • Enable efficient sequence compression by representing long sequences via compact global memory vectors.
  • Integrate seamlessly with existing sparse attention variants to improve performance without increasing model parameters significantly.
  • Demonstrate utility in tasks requiring global reasoning, such as question answering and language modeling.

Proposed method

  • Augment sparse Transformer blocks with M global memory tokens prefixed to the input sequence.
  • Use dense attention between input tokens and memory tokens, while maintaining sparse attention among input tokens.
  • Allow memory tokens to attend to all input and memory tokens using standard self-attention.
  • Introduce a memory update mechanism where memory vectors are updated via attention over the full sequence at each layer.
  • Use the final memory states as a compressed representation of the input sequence, enabling decompression via additional GMAT layers.
  • Replace input memory tokens with the first 64 tokens of the input question in reading comprehension tasks to improve performance.

Experimental results

Research questions

  • RQ1Can a small, dense global memory improve long-range reasoning in sparse Transformer models?
  • RQ2How does global memory affect performance on tasks requiring global context aggregation, such as question answering and language modeling?
  • RQ3To what extent can global memory be used for effective sequence compression with minimal performance degradation?
  • RQ4Does global memory mitigate the failure modes of locality-based attention in tasks involving non-local dependencies?
  • RQ5How does GMAT compare to standard sparse attention when the input is permuted or adversarially modified?

Key findings

  • GMAT improved F1 scores on HotpotQA-GS from 66.3 (BERT) to 68.3, with a 6.8% relative improvement on comparison-type questions.
  • In the question-repeated (QR) setting, GMAT achieved 67.4 F1 on HotpotQA-GS+QR, compared to 66.4 for the baseline, confirming its effectiveness in long-context reasoning.
  • On adversarial HotpotQA, GMAT improved F1 from 64.0 to 64.6, showing robustness to distributional shifts.
  • Sequence compression using GMAT achieved an 8× reduction in representation size with only a small drop in performance on masked language modeling and reading comprehension.
  • The model with global memory (512×4,64) outperformed the baseline (512×4,0) even when the latter was augmented with question repetition, proving the value of explicit global memory.
  • Replacing static memory tokens with the first 64 tokens of the question improved performance, indicating that dynamic memory initialization enhances reasoning capability.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.