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

HGMem: Hypergraph-based Working Memory to Improve Multi-step RAG for Long-Context Complex Relational Modeling

Chulun Zhou, Chunkang Zhang, Guoxin Yu, Fandong Meng, Jie Zhou, Wai Lam, Mo Yu

TL;DR

Large language models (LLMs) struggle with complex reasoning over long texts because their "working memory" often just stores facts passively. This paper introduces HGMem, a novel hypergraph-based working memory that dynamically builds high-order correlations between facts, significantly improving LLMs' ability to understand and reason about complex, long-context information.

What Problem Does This Paper Address?

Modern LLMs are increasingly used for tasks requiring deep understanding of extensive documents, like legal case analysis or scientific literature review. Retrieval-Augmented Generation (RAG) helps by providing relevant text snippets, and multi-step RAG further enhances this by allowing LLMs to iteratively retrieve and reason. A key component of multi-step RAG is "working memory," which stores information gathered during the process. However, existing working memory systems often treat this memory as a simple, static collection of facts. This approach fails to capture the crucial high-order correlations – the complex relationships and emergent patterns – that humans naturally form when processing information. This limitation hinders LLMs' ability to perform sophisticated reasoning, especially when dealing with spatially distant but conceptually linked information within long contexts, leading to fragmented understanding and weak global sense-making.

Methods

HGMem tackles this by representing the working memory as a hypergraph. Unlike traditional graphs where edges connect only two nodes, hypergraphs use "hyperedges" that can connect an arbitrary number of nodes. This allows HGMem to model more complex, n-ary relationships.

Here's how it works:

  • Dynamic Memory Evolution: The memory isn't static. As the LLM interacts with documents, HGMem dynamically updates, inserts, and merges information.
  • Update: Existing memory points (hyperedges) are refined with new information.
  • Insert: New memory points are created for novel, relevant information.
  • Merge: This is the core innovation. HGMem intelligently merges existing memory points to form new, higher-order memory units that capture complex relationships between multiple facts. This process is guided by the LLM, which synthesizes descriptions for these new, integrated memory points.
  • Adaptive Retrieval: The system uses an adaptive strategy for retrieving evidence. When the LLM needs more information, it can choose to perform "local investigation" (focusing on specific existing memory points) or "global exploration" (searching for new information beyond the current memory). This flexibility helps the LLM gather precisely what it needs.

Datasets

The authors evaluated HGMem on several challenging benchmarks designed for global sense-making and long-context understanding:

  • Generative Sense-making QA: Curated from Longbench V2, focusing on Financial, Governmental, and Legal domains, with documents exceeding 100k tokens.
  • Long Narrative Understanding:
    • NarrativeQA: A benchmark for story question answering, emphasizing synthesis and inference beyond local text.
  • NoCha: Requires discriminating between true and false claims about English fictional books, demanding global understanding.
  • Prelude: Assesses LLMs' ability to determine if a character's prequel story is consistent with the original book, requiring deep reasoning and integration of multiple pieces of evidence.

Key Insights and Ideas

  • Hypergraphs for High-Order Correlations: The fundamental insight is that traditional graph structures are insufficient for capturing the complex, multi-way relationships present in sophisticated reasoning. Hypergraphs, by design, are better suited for this, allowing memory to evolve into richer, more expressive structures.
  • Memory as an Evolving Entity: Human working memory isn't just a database; it actively reorganizes and synthesizes information. HGMem mimics this by allowing its hypergraph memory to dynamically update, insert, and merge information, creating emergent, high-order memory points.
  • Merging is Key: The "merging" operation is highlighted as particularly crucial. It's the mechanism that actively builds these high-order correlations from primitive facts, directly addressing the limitations of static memory systems.
  • Resource Efficiency: HGMem, when powered by a strong open-source model like Qwen2.5-32B-Instruct, can match or even surpass the performance of models relying on more powerful proprietary models (like GPT-40), demonstrating the impact of effective memory architecture.

Key Results

  • Consistent Performance Gains: HGMem consistently outperformed both single-step and multi-step RAG baselines across all evaluated datasets.
  • Outperforming Stronger Models: Notably, HGMem with Qwen2.5-32B-Instruct achieved performance comparable to or better than baselines using GPT-40, showcasing its efficiency.
  • Impact of Merging: Ablation studies showed that removing the merging operation ("w/o. Merging") led to a substantially larger performance drop than removing the update operation, underscoring the critical role of high-order correlation building.
  • Sense-making Advantage: HGMem showed a significant advantage on "sense-making" queries, which require integrating multiple pieces of evidence, as evidenced by a higher average number of entities per hyperedge (Avg-N) in its memory.

Limitations and Future Work

  • Offline Graph Construction: The system relies on an initial offline graph construction. While HGMem shows resilience to variations in graph quality, its performance is still influenced by the density and quality of this initial graph.
  • Computational Cost: While HGMem's cost is comparable to other multi-step RAG methods, the paper notes that the "merging" operation, while crucial, introduces a minor computational overhead.
  • Future Work: The paper implicitly suggests that further exploration into optimizing the hypergraph structure and the dynamics of memory evolution could lead to even greater improvements. The focus on "deep research" applications like scientific literature review and legal analysis also points towards future applications in specialized domains.

Summary updated

BibTeX
@inproceedings{zhou2026hgmem,
  author = {Chulun Zhou and Chunkang Zhang and Guoxin Yu and Fandong Meng and Jie Zhou and Wai Lam and Mo Yu},
  title = {{HGMem: Hypergraph-based Working Memory to Improve Multi-step RAG for Long-Context Complex Relational Modeling}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=dvrq3GX7qL},
}
Figure