Skip to main content
QUICK REVIEW

[Paper Review] MemoRAG: Boosting Long Context Processing with Global Memory-Enhanced Retrieval Augmentation

Hongjin Qian, Zheng Liu|arXiv (Cornell University)|Sep 9, 2024
Robotics and Automated SystemsEngineering5 citations
TL;DR

MemoRAG introduces a dual-system retrieval augmentation with a long-range memory module that compresses global context into memory tokens to guide retrieval, enabling better handling of implicit and long-context queries beyond standard RAG. It demonstrates strong performance on complex UltraDomain tasks and broad domain generalization.

ABSTRACT

Processing long contexts presents a significant challenge for large language models (LLMs). While recent advancements allow LLMs to handle much longer contexts than before (e.g., 32K or 128K tokens), it is computationally expensive and can still be insufficient for many applications. Retrieval-Augmented Generation (RAG) is considered a promising strategy to address this problem. However, conventional RAG methods face inherent limitations because of two underlying requirements: 1) explicitly stated queries, and 2) well-structured knowledge. These conditions, however, do not hold in general long-context processing tasks. In this work, we propose MemoRAG, a novel RAG framework empowered by global memory-augmented retrieval. MemoRAG features a dual-system architecture. First, it employs a light but long-range system to create a global memory of the long context. Once a task is presented, it generates draft answers, providing useful clues for the retrieval tools to locate relevant information within the long context. Second, it leverages an expensive but expressive system, which generates the final answer based on the retrieved information. Building upon this fundamental framework, we realize the memory module in the form of KV compression, and reinforce its memorization and cluing capacity from the Generation quality's Feedback (a.k.a. RLGF). In our experiments, MemoRAG achieves superior performances across a variety of long-context evaluation tasks, not only complex scenarios where traditional RAG methods struggle, but also simpler ones where RAG is typically applied.

Motivation & Objective

  • Address limitations of standard RAG in handling ambiguous information needs and unstructured knowledge.
  • Propose a dual-system architecture with a long-range memory model to generate retrieval clues.
  • Enable memory-augmented retrieval to improve coverage and reasoning over large databases.
  • Showcase generalization to diverse domains via the UltraDomain benchmark.
  • Provide practical deployment guidance and open-source resources for MemoRAG.

Proposed method

  • Introduce a memory module that compresses raw input tokens into a compact global memory via memory tokens.
  • Use a light memory model to form memory tokens and a heavier generator to produce final answers based on retrieved evidence.
  • Train memory module with pre-training on long contexts and supervised fine-tuning for task-specific clue generation.
  • Represent the retrieval process as generating task-specific clues y from memory X^m, which guide conventional retrievers to fetch relevant context.
  • Allow flexible integration of retrieval methods (dense/sparse) and generators, defaulting to dense retrieval and memory-model-based generation.
  • Demonstrate compression-driven memory with equations for Q/K/V projections and memory-attention (Eqs. 3–7).

Experimental results

Research questions

  • RQ1Can MemoRAG improve retrieval quality for implicit information needs compared to standard RAG?
  • RQ2How does global memory influence retrieval across multi-hop and long-context tasks?
  • RQ3Does MemoRAG generalize across diverse domains and unstructured knowledge sources?
  • RQ4What are practical deployment limits and resource requirements for memory-augmented RAG?
  • RQ5Can memory clues preserve enough information to guide accurate final generation without overfitting to memory content?

Key findings

  • MemoRAG achieves superior performance over baselines on UltraDomain across multiple datasets and settings.
  • The memory-augmented approach enables effective handling of implicit queries and distributed evidence gathering.
  • MemoRAG shows strong domain generalization, performing well on in-domain and out-of-domain tasks, including long-context and long-book QA scenarios.
  • The system supports long context lengths (up to hundreds of thousands of tokens) via memory compression, with configurable compression ratios.
  • Two released memory models (memorag-qwen2-7b-inst and memorag-mistral-7b-inst) enable processing very long contexts and can be paired with various generators.
  • Experimental results indicate MemoRAG outperforms Full context and several baseline RAG methods on the UltraDomain benchmark.

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.