NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

QRMeM: Unleash the Length Limitation through Question then Reflection Memory Mechanism

Bo Wang, Heyan Huang, Yixin Cao, Jiahao Ying, Wei Tang, Chong Feng

TL;DR

QRMeM (Question then Reflection Memory Mechanism) is a novel framework that helps Large Language Models (LLMs) navigate massive documents by using a dual-structured memory pool. By combining raw text segments with a query-oriented knowledge graph and an iterative "reflection" loop, it allows models to accurately pinpoint and combine information across long distances, significantly outperforming standard long-context models and retrieval methods.

What Problem Does This Paper Address?

Despite the "infinite" context windows advertised by modern LLMs, they still suffer from the "lost in the middle" phenomenon—the tendency to forget or ignore information buried in the center of a long prompt.

Current solutions generally fall into two camps: Retrieval-Augmented Generation (RAG), which uses external search to find relevant snippets, and Long-Context Models, which try to process everything at once. However, RAG often fails on complex, multi-hop questions because it relies on static indexing that doesn't adapt to the specific query. Meanwhile, processing the entire context is computationally expensive and often introduces "noise" that distracts the model. The authors identify a gap: we need a way to dynamically reorganize and logically combine relevant segments during the reasoning process.

Methods

The authors introduce QRMeM, which operates through two main phases:

  1. Dual-structure Memory Construction: The document is first split into chunks (Original Segmentation). Simultaneously, the system uses an LLM to build a Structured Memory—a knowledge graph where nodes are entities and edges are relationships. Crucially, these two structures are linked: every entity in the graph points back to the specific text segments where it appears.

    The dual-structure memory construction pipeline
  2. Reflection-based Navigation: Instead of a single search, QRMeM uses an iterative "trial-and-error" approach.

  3. Questioning: The model starts with entities found in the query.

  4. Evaluation: It attempts to answer the question using the currently selected segments.
  5. Reflection: If it can't answer, the LLM identifies why (e.g., "I have info on Person A, but I'm missing their connection to Company B").
  6. Expansion: Using this feedback, the system traverses the knowledge graph to find the next most relevant entity and its corresponding text segments.
Figure 3: Strategies for KNOWLEDGE-DIRECTED NAVIGATION in QRMEM. Navigation starts with a subgraph containing only the target entity from the question and its linked segments. The subgraph is then expanded based on the relevance of relationship edges connected to the current entity. The process will continue until the linked segments are sufficient to answer the question.

Datasets

The researchers evaluated QRMeM on two types of challenging benchmarks:

  • QuALITY: A multiple-choice question-answering (MCQ) dataset featuring long narratives (average ~5,000 tokens) that require deep comprehension.
  • Multi-Doc QA: Three datasets—HotpotQA, 2WikiMultihopQA, and MuSiQue—derived from LongBench. These require "multi-hop" reasoning, where the answer must be pieced together from multiple different documents.

Key Insights and Ideas

  • Memory Anchors: The knowledge graph acts as a set of "human-like memory anchors." Just as a person might remember a story by key characters and their interactions, QRMeM uses entities to navigate the "sea" of raw text.
  • The Power of "Why": The "Reflection" step is the secret sauce. By forcing the model to explain its failure to answer, the system generates a much more targeted search query for the next iteration than a standard similarity search ever could.
  • Synergy of Static and Structured: By keeping the original text segments (static memory) alongside the graph (structured memory), the system avoids the "information loss" that often happens when you only use summaries or compressed text. The graph is the map, but the segments are the territory.

Key Results

QRMeM demonstrated superior performance across the board, particularly on complex reasoning tasks:

  • Outperforming Long-Context Models: On the QuALITY dataset, QRMeM (using a standard 4k window) achieved 72.07% accuracy, beating GPT-3.5-16k (71.62%) and significantly outperforming Llama-2-70b-32k (57.65%).
  • Multi-Hop Excellence: On the MuSiQue dataset, which is notoriously difficult for retrievers, QRMeM achieved an F1 score of 0.2094, nearly doubling the performance of vanilla "keep-left" truncation methods.
  • Iterative Gains: The authors found that performance steadily improves with the number of "trials" or iterations. As shown in Figure 4, accuracy jumps significantly from the first to the third update before beginning to plateau.
Figure 4: Accuracy on QuALITY datasets with different max trials number.

Limitations and Future Work

While powerful, QRMeM has a few hurdles to clear:

  • Computational Cost: Building the initial knowledge graph and running multiple "reflection" iterations requires several LLM calls, which increases latency and API costs compared to simple RAG.
  • Entity Resolution: The system relies heavily on the model's ability to correctly identify and link entities. If the entity extraction is noisy, the "map" becomes unreliable.
  • Segmentation Sensitivity: How the document is initially chopped into paragraphs can affect how well the graph connects different ideas.

The authors suggest that future work will focus on making the graph updates more "local" and efficient to reduce costs, and exploring the integration of external knowledge bases to further ground the model's reasoning.

Summary updated

BibTeX
@inproceedings{wang2024qrmem,
  author = {Bo Wang and Heyan Huang and Yixin Cao and Jiahao Ying and Wei Tang and Chong Feng},
  title = {{QRMeM: Unleash the Length Limitation through Question then Reflection Memory Mechanism}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.278},
}
Figure