Abstract
GraphReader is a novel graph-based agent system designed to overcome the "lost in the middle" phenomenon in Large Language Models (LLMs) handling long contexts. By structuring long texts into a graph of "atomic facts" and "key elements," GraphReader enables models with small context windows (e.g., 4k tokens) to outperform state-of-the-art long-context models like GPT-4-128k on tasks involving up to 256k tokens. This approach shifts the focus from expanding memory buffers to improving data organization and strategic retrieval.
Introduction
As LLMs tackle increasingly complex tasks, the "context window" has become a major bottleneck. While some models now support 128k or even 1M tokens, they often suffer from the "lost in the middle" phenomenon—the tendency to overlook information buried in the center of a long prompt.
Existing solutions generally fall into two camps:
- Model-level: Fine-tuning models with longer positional embeddings, which is computationally expensive and often fails at complex multi-hop reasoning.
- Agent-level: Using RAG (Retrieval-Augmented Generation) or hierarchical "gist" memories. However, these often treat text as isolated chunks or simple trees, failing to capture the intricate, long-range dependencies required for multi-hop questions.
Methods
GraphReader introduces a three-phase workflow to transform linear text into a navigable knowledge structure:
- Graph Construction: The text is split into chunks. An LLM extracts "atomic facts" (the smallest indivisible truths) and "key elements" (pivotal nouns, verbs, and adjectives) from each chunk. Nodes are created for each key element, and edges are formed between nodes that share elements, creating a global web of relationships.
- Graph Exploration: Upon receiving a question, the agent generates a Rational Plan. It selects Initial Nodes and uses a coarse-to-fine exploration strategy: it first reads summarized atomic facts, then invokes a
read_chunkfunction for full text if needed. It maintains a Notebook to record insights and can jump to neighboring nodes to follow "hops" in the data. - Answer Reasoning: Once sufficient information is gathered, the agent compiles its notebook entries and uses Chain-of-Thought reasoning to produce the final answer.
Key Results
The authors evaluated GraphReader on a diverse set of benchmarks, including HotpotQA, 2WikiMultihopQA, and the extremely long-context LV-Eval (HotpotWikiQA-mixup subset).
- Outperforming GPT-4: On the LV-Eval benchmark at the 256k token level, GraphReader achieved an average score of ~33%, while GPT-4-128k (with truncation) lagged at ~10%.
- Scalability: While other models (like ReadAgent or standard RAG) showed a sharp decline in performance as context length increased, GraphReader’s performance remained relatively stable across input lengths from 16k to 256k.
- Multi-hop Superiority: GraphReader consistently beat specialized baselines like LongRAG and GraphRAG on multi-hop benchmarks, demonstrating its ability to follow complex "paper trails" through the text.
Key Insights
- Structure Over Sequence: By converting text into a graph, the model bypasses linear constraints. Long-range dependencies become simple one-hop neighbors in the graph.
- The Power of Small Windows: Remarkably, GraphReader uses a 4k context window to achieve its results, suggesting that intelligence in long-context tasks comes from better data organization rather than just larger memory buffers.
- Planning is Critical: Ablation studies showed that removing the "Rational Plan" or "Initial Node Selection" led to significant performance drops (up to 18%), proving that the agent's autonomy must be guided by a structured thought process.
Conclusion
GraphReader demonstrates a significant advancement in handling long-context tasks by leveraging graph-based agentic exploration. While currently dependent on high-end LLM APIs like GPT-4 for planning and extraction, future work aims to train smaller, open-source models specifically for these tasks to reduce costs and increase efficiency.
Summary updated