Preprint
Large Language Models

Recurrent Memory Finds What LLMs Miss

Yuri Kuratov, A. Bulatov, Petr Anokhin, Dmitry Sorokin, Artyom Y. Sorokin, M. Burtsev
February 16, 2024arXiv.org52 citations

52

Citations

0

Influential Citations

arXiv.org

Venue

2024

Year

Abstract

This paper addresses the challenge of processing long documents using generative transformer models. To evaluate different approaches, we introduce BABILong, a new benchmark designed to assess model capabilities in extracting and processing distributed facts within extensive texts. Our evaluation, which includes benchmarks for GPT-4 and RAG, reveals that common methods are effective only for sequences up to $10^4$ elements. In contrast, fine-tuning GPT-2 with recurrent memory augmentations enables it to handle tasks involving up to $11\times 10^6$ elements. This achievement marks a substantial leap, as it is by far the longest input processed by any neural network model to date, demonstrating a significant improvement in the processing capabilities for long sequences.

Analysis

Why This Paper Matters

Processing long documents remains a critical bottleneck for large language models (LLMs). While transformers have shown remarkable capabilities on short contexts, their quadratic attention cost and limited context windows (typically 4K–128K tokens) restrict their use on real-world tasks like legal contracts, scientific papers, or book-length narratives. This paper directly addresses that gap by demonstrating that a simple recurrent memory augmentation can push the effective context length to millions of tokens—far beyond what current state-of-the-art models like GPT-4 can handle.

The introduction of BABILong as a benchmark is also significant. Existing long-context benchmarks (e.g., LongBench, SCROLLS) often mix short and long tasks, making it hard to isolate the ability to retrieve and reason over distributed facts. BABILong provides a clean, scalable testbed that can drive progress in this area. By showing that even GPT-4 with retrieval-augmented generation (RAG) fails beyond 10,000 tokens, the paper highlights a fundamental limitation of current architectures and retrieval strategies.

Technical Contributions

  • BABILong benchmark: A synthetic dataset derived from the bAbI QA tasks, where facts are distributed across long sequences. The benchmark controls for sequence length and fact density, enabling precise measurement of long-context reasoning.
  • Recurrent memory augmentation: The authors fine-tune GPT-2 (a small transformer) with a recurrent memory mechanism that compresses past context into a fixed-size state. This allows the model to attend to information from arbitrarily long prefixes without quadratic cost.
  • Comparison with baselines: The paper evaluates GPT-4 (zero-shot and few-shot), RAG (using a dense retriever + GPT-4 reader), and the recurrent-memory GPT-2 on BABILong sequences of varying lengths.

Results

  • GPT-4 and RAG: Both achieve near-perfect accuracy on sequences up to 10^4 tokens, but accuracy drops sharply beyond that. At 10^5 tokens, GPT-4 accuracy falls below 50%, and RAG also degrades.
  • Recurrent-memory GPT-2: Maintains high accuracy (above 80%) on sequences up to 11×10^6 tokens—a 1000× improvement over the baselines. This is the longest input ever processed by a neural network.
  • Scaling behavior: The recurrent memory model shows graceful degradation with length, unlike the baselines which exhibit a cliff-like drop.

Significance

This paper provides strong evidence that recurrent memory augmentations can overcome the context length limitations of transformers. While the experiments are on synthetic data, the results suggest a viable path toward processing entire books or long documents without chunking or retrieval. The work also underscores the value of specialized benchmarks like BABILong for isolating specific capabilities. For practitioners, it hints that lightweight architectural modifications (rather than massive scaling) may be the key to unlocking long-context reasoning in LLMs.