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

Abstract

Large Language Models (LLMs) often struggle with long-context reasoning, frequently losing track of information in the middle of extensive documents. This paper introduces QRMeM (Question then Reflection Memory Mechanism), a framework that utilizes a dual-structured memory pool—combining raw text segments with a query-oriented knowledge graph—and an iterative reflection process to navigate complex, multi-hop queries in long documents.

Introduction

While the context windows of Large Language Models (LLMs) continue to expand, simply increasing token capacity often leads to performance degradation. Models frequently suffer from the "lost in the middle" phenomenon, where they struggle to retrieve or connect information buried deep within a long text. At EMNLP 2024, researchers from the Beijing Institute of Technology proposed QRMeM, a novel framework designed to overcome these limitations by teaching LLMs to "reflect" on their information needs through a structured memory mechanism.

The Challenge of Long-Context Reasoning

Existing approaches to long-context processing generally fall into two categories: retrieval-based methods (like RAG) and memory-based methods. Retrieval-based methods often miss nuanced, multi-hop relationships between distant segments. Memory-based methods frequently rely on static summaries that may discard details necessary for specific queries. The core challenge lies in multi-hop reasoning—connecting disparate pieces of information (e.g., linking a character's introduction in Chapter 1 to their actions in Chapter 10) where the logical path is not immediately apparent to standard retrieval systems.

Methodology: The QRMeM Framework

QRMeM addresses these challenges through a two-part architecture consisting of a dual-structured memory pool and a reflection-based navigation strategy.

The QRMeM architecture overview, showing the interaction between segmented documents, the memory pool, and the two-step graph construction process.

Dual-Structured Memory Pool

  1. Long-term Static Memory: The original document is divided into raw segments, ensuring that no information is lost through compression or summarization.
  2. Structured Memory: A dynamic, query-oriented knowledge graph is constructed. Nodes represent entities, and edges represent relations extracted by the LLM. Unlike static graphs, this structure is initialized based on the specific query, focusing the model's "attention" on relevant conceptual neighborhoods.

Reflection-Based Navigation

Instead of a single-shot retrieval, QRMeM employs an iterative "Socratic" approach. The model starts with entities identified in the question and attempts to answer. If the current information is insufficient, the LLM must generate a reflection—a specific reason why it cannot yet answer (e.g., "I have identified the suspect but lack their motive mentioned in the earlier files").

The iterative reflection process where the model evaluates current information (Iter 1-3) and uses structured memory guidance to find missing segments.

This reflection acts as a diagnostic tool, guiding the system to expand its search through the structured graph to find the next most promising segment. This cycle continues until the question is answered or the context window is exhausted.

Evaluation and Datasets

The researchers evaluated QRMeM on several benchmarks designed for long-context and multi-hop reasoning:

  • QuALITY: A dataset of multiple-choice questions based on long narratives (~5,000 words).
  • Multi-Doc QA (LongBench): Including HotpotQA, 2WikiMultihopQA, and MuSiQue, which require synthesizing information across multiple Wikipedia passages.

Key Results

QRMeM demonstrated significant performance gains over both native long-context models and standard retrieval baselines:

  • QuALITY Performance: Using GPT-3.5-turbo as a backbone, QRMeM achieved 72.07% accuracy, outperforming the native 16k context window version (71.62%).
  • Multi-Hop Excellence: On the challenging MuSiQue dataset, QRMeM reached an F1 score of 0.2094, substantially higher than Vanilla LLM baselines and competing methods like MemWalker.
  • Efficiency: The reflection mechanism allowed the model to achieve high accuracy with fewer iterative requests compared to traditional sliding window approaches.

Conclusion and Future Work

QRMeM proves that structured guidance and iterative reflection can significantly enhance an LLM's ability to navigate massive documents. By treating retrieval failures as informative signals rather than dead ends, the system effectively "debugs" its own search path. Future research will focus on reducing the computational overhead of graph initialization and improving entity resolution to ensure the graph remains robust even when the text uses varied terminology for the same entities.

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