← Latest papers
💬 NLP

Trace Only What You Need: Structure-Aware On-Demand Hypergraph Memory for Long-Document Question Answering

The paper introduces DocTrace, a multi-agent retrieval-augmented generation framework that enhances long-document question answering by combining document-structure-aware indexing, on-demand hypergraph memory for reasoning, and reusable experience graphs to achieve superior accuracy and efficiency compared to existing baselines.

Original authors: Xiangjun Zai, Xingyu Tan, Chen Chen, Xiaoyang Wang, Wenjie Zhang

Published 2026-06-10
📖 5 min read🧠 Deep dive

Original authors: Xiangjun Zai, Xingyu Tan, Chen Chen, Xiaoyang Wang, Wenjie Zhang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

The Big Problem: Finding a Needle in a Haystack (That's Also a Maze)

Imagine you have a massive library containing thousands of books (long documents). A librarian (an AI) needs to answer a specific question, like "Who adopted the main character in Chapter 12, and what happened to them in Chapter 45?"

The Old Way (Traditional AI):
The librarian tries to read the entire library at once to find the answer. This is slow, expensive, and the librarian gets confused because there's too much information.

The "Retrieval" Way (Standard RAG):
The librarian uses a search engine to find a few pages that look relevant. But here's the catch: standard search engines treat the library like a pile of loose papers. They might find the right sentence, but they miss the context. They don't know that the sentence in Chapter 12 is connected to the sentence in Chapter 45, or that the order of events matters. It's like finding two puzzle pieces but not realizing they belong to the same picture.

The "Structured" Way (Previous Attempts):
Some researchers tried to organize the library by building a giant map or a summary tree before anyone asked a question.

  • The Flaw: This is like hiring a team to map out the entire library, room by room, even if no one ever asks about the "History Section." It takes forever, costs a lot of money, and much of the map is useless for the specific question being asked.

The Solution: DocTrace (The Smart Detective Agency)

The authors propose DocTrace, a new system that acts like a team of smart detectives. Instead of mapping the whole library beforehand, they only organize what they need, exactly when they need it.

Here is how the three main "superpowers" of DocTrace work:

1. The "On-Demand" Memory (The Hypergraph)

  • The Analogy: Imagine a detective working on a case. Instead of carrying a giant filing cabinet of every fact in the world, they pull out a whiteboard. As they investigate, they write down connections on the board. If they find a clue about "Who adopted the child," they draw a line to "Chapter 12." If they later find a clue about "Chapter 45," they draw a line connecting it to the first clue.
  • What DocTrace does: It builds a Hypergraph (a complex web of connections) only for the specific question being asked. It doesn't waste time organizing the whole document. It creates a "Working Memory" that links facts together dynamically, allowing the AI to see how different parts of the story connect, even if they are far apart.

2. The "Structure-Aware" Map (The Document Tree)

  • The Analogy: A normal search engine treats a book like a flat list of words. DocTrace treats the book like a family tree or a table of contents. It knows that "Chapter 3" is inside "Part 2," and that "Paragraph 5" comes right after "Paragraph 4."
  • What DocTrace does: It builds a lightweight Tree Index that respects the original structure of the document. When the AI looks for an answer, it doesn't just look for matching words; it looks at the location. If the answer requires understanding the flow of a story, the AI knows to look at the "neighborhood" of the text (the surrounding paragraphs) rather than just isolated sentences.

3. The "Experience" Notebook (The Graph Memory)

  • The Analogy: Imagine a detective who has solved 100 similar cases. When a new case comes in that looks like the 50th case they solved, they don't start from scratch. They open their notebook, see how they solved the previous one, and say, "Oh, I know this pattern! I'll start by checking the adoption records, then check the school records."
  • What DocTrace does: It stores successful "reasoning plans" (how it broke a question down into smaller steps) in a Graph-structured Experience Memory. If a new question is structurally similar to an old one, DocTrace reuses the old plan. This saves time and makes the AI smarter over time without needing to re-learn everything.

The Team: Orchestrator and Investigators

DocTrace uses a two-person team approach:

  1. The Orchestrator (The Manager): This agent looks at the big picture. It breaks the big, scary question into smaller, manageable sub-questions. It decides which "detectives" to send where and checks if the plan is making sense.
  2. The Investigators (The Field Agents): These agents go out and fetch the specific evidence for each small sub-question. They use the "On-Demand Memory" and the "Tree Map" to find the exact facts needed.

The Results: Faster and Smarter

The paper tested DocTrace on four different datasets involving long stories and reports.

  • Performance: It beat the current best systems (like ComoRAG) by a significant margin (up to 8.85% better accuracy in some tests).
  • Efficiency: Because it doesn't waste time building a giant map of the whole document first, it is 53% cheaper (in terms of computer processing power) to run.

Summary

DocTrace is like a detective agency that doesn't waste money mapping the whole city before a crime happens. Instead, it has a smart manager who breaks the case down, field agents who build a temporary map of just the relevant streets as they investigate, and a notebook of past cases to help them solve similar mysteries faster. It uses the structure of the document (like chapters and paragraphs) to make sure the story makes sense, not just the words.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →