Skip to main content
QUICK REVIEW

[Paper Review] Not All Memories are Created Equal: Learning to Forget by Expiring

Sainbayar Sukhbaatar, Da Young Ju|arXiv (Cornell University)|May 13, 2021
Topic ModelingComputer Science47 references5 citations
TL;DR

This paper proposes Expire-Span, a differentiable forgetting mechanism for Transformers that learns to expire irrelevant memories, enabling efficient attention over tens of thousands of timesteps. By dynamically expiring low-importance content, it achieves state-of-the-art performance on long-context tasks like character-level language modeling and frame-by-frame object tracking, while training 3x faster and using less memory than baselines.

ABSTRACT

Attention mechanisms have shown promising results in sequence modeling tasks that require long-term memory. Recent work investigated mechanisms to reduce the computational cost of preserving and storing memories. However, not all content in the past is equally important to remember. We propose Expire-Span, a method that learns to retain the most important information and expire the irrelevant information. This forgetting of memories enables Transformers to scale to attend over tens of thousands of previous timesteps efficiently, as not all states from previous timesteps are preserved. We demonstrate that Expire-Span can help models identify and retain critical information and show it can achieve strong performance on reinforcement learning tasks specifically designed to challenge this functionality. Next, we show that Expire-Span can scale to memories that are tens of thousands in size, setting a new state of the art on incredibly long context tasks such as character-level language modeling and a frame-by-frame moving objects task. Finally, we analyze the efficiency of Expire-Span compared to existing approaches and demonstrate that it trains faster and uses less memory.

Motivation & Objective

  • To address the inefficiency and scalability limits of long-context Transformers that store all past information.
  • To enable models to selectively forget irrelevant memories, mimicking human memory's ability to prioritize salient information.
  • To improve performance on long-context tasks by learning dynamic memory expiration rather than fixed compression or attention spans.
  • To reduce computational and memory overhead in long sequence modeling without sacrificing performance.

Proposed method

  • Expire-Span augments self-attention with a learnable expiration predictor that outputs a retention span for each hidden state.
  • Each memory is expired after its expiration span ends, with the process differentiable for end-to-end backpropagation.
  • Expiration is applied independently per layer, allowing different layers to specialize in different time-scales of memory retention.
  • The method enables efficient attention over tens of thousands of timesteps by discarding irrelevant information early.
  • The model is trained end-to-end with a cross-entropy loss, and the expiration mechanism is integrated into the attention computation.
  • The approach is applied to decoder-only Transformers, enabling scalable long-context modeling without fixed compression or sparse attention patterns.

Experimental results

Research questions

  • RQ1Can a learnable forgetting mechanism improve performance on long-context sequence modeling tasks?
  • RQ2How does dynamic memory expiration affect training efficiency and memory usage compared to fixed-span or compressed memory methods?
  • RQ3Can models learn to retain salient information like named entities while forgetting generic or irrelevant content?
  • RQ4To what extent does long-term memory capacity impact prediction accuracy on long-context benchmarks?
  • RQ5Does the ability to expire memories enable scaling to longer context lengths without computational blowup?

Key findings

  • Expire-Span achieved state-of-the-art performance on the Enwik8 character-level language modeling benchmark, outperforming Compressive Transformer and Adaptive-Span baselines.
  • The model trained nearly 3x faster than both Compressive Transformer and Adaptive-Span while maintaining higher accuracy.
  • With a maximum span of 64k, Expire-Span successfully trained and avoided GPU memory overflow, whereas Adaptive-Span failed at 32k.
  • The model learned to retain rare or salient entities like 'Egypt' and 'Humpty Dumpty' for long spans, while quickly expiring generic terms like 'somewhere'.
  • When inference span was reduced from 16k to 1k, accuracy dropped significantly on long-range predictions like 'Guinea coast', which was mentioned 3,584 tokens earlier.
  • Analysis showed that structural elements like section titles and newlines were retained longer, indicating layer-specific specialization in memory usage.

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.