DocAgent: An Agentic Framework for Multi-Modal Long-Context Document Understanding

Li Sun, He Liu, Shuyue Jia, Yangfan He, Chenyu You2025

Abstract

Recent advances in large language models (LLMs) have demonstrated significant promise in document understanding and question answering. Despite the progress, existing approaches can only process short documents due to limited context length or fail to fully leverage multi-modal information. In this work, we introduce DocAgent, a multi-agent framework for long-context document understanding that imitates the human reading practice. Specifically, we first extract a structured, tree-formatted outline from documents to help agents identify relevant sections efficiently. Further, we develop an interactive reading interface that enables agents to query and retrieve various types of content dynamically. To ensure answer reliability, we introduce a reviewer agent that cross-checks responses using complementary sources and maintains a task-agnostic memory bank to facilitate knowledge sharing across tasks. We evaluate our method on two long-context document understanding benchmarks, where it bridges the gap to human-level performance by surpassing competitive baselines, while maintaining a short context length.

Introduction

Large Language Models (LLMs) have revolutionized text processing, yet they frequently struggle with massive, multi-modal documents like 100-page financial reports or legal contracts. These documents present three primary challenges: hierarchical complexity (nested sections), multi-modality (information split between text, tables, and images), and context exhaustion (the "lost in the middle" phenomenon in long prompts). Current solutions often rely on simple OCR or end-to-end vision models, both of which have significant limitations in scale and visual comprehension. DocAgent addresses these hurdles by adopting an agentic, "read-as-needed" strategy that mimics human document navigation.

The DocAgent Framework

DocAgent operates through a collaborative loop of specialized components designed to navigate and interpret complex document structures efficiently.

The DocAgent framework architecture, illustrating the interaction between the Actor Agent, Reviewer Agent, and Memory module using a tree-structured outline.

1. Outline Construction

Instead of processing a raw text dump, DocAgent parses PDFs into a hierarchical XML tree. To optimize the context window, it initially presents the agent with only headers and the first sentence of each paragraph, providing a "contextual hint" for navigation.

2. Actor Agent

Acting as the primary reader, the Actor Agent uses the outline to determine which sections require deeper inspection. It utilizes a suite of tools including search for keyword lookups, get_section_content for full text retrieval, and get_image or get_table_image for visual analysis.

3. Reviewer Agent and Memory

To mitigate hallucinations, a Reviewer Agent cross-checks the Actor’s findings against complementary evidence (e.g., verifying text-based claims against table data). When disagreements occur, a reflection module generates "learned guidelines" stored in a task-agnostic memory bank, allowing the system to improve its performance on subsequent questions within the same document.

Experimental Evaluation

The framework was rigorously tested on two benchmarks: MMLongBench-Doc (135 PDFs averaging 47.5 pages) and DocBench (229 documents with over 1,100 questions). These datasets require the integration of text, images, and charts across diverse domains such as Finance, Law, and Academia.

Key Results and Insights

DocAgent demonstrated a significant performance lead over traditional "brute-force" baselines. On DocBench, DocAgent (powered by GPT-4o) achieved 79.9% accuracy, coming within 1.3% of the human baseline (81.2%). On MMLongBench-Doc, it reached 57.3% accuracy, substantially outperforming standard OCR-based (44.9%) and page-image-based (39.0%) approaches.

Accuracy comparison across different evidence page locations, demonstrating DocAgent's robustness in long-context documents compared to OCR and image-based baselines.

Beyond raw accuracy, the framework proved highly efficient, reading only 24.2% of document pages on average. This selective reading reduced the P99 context length by 37% compared to standard methods. Furthermore, as shown in the performance analysis, DocAgent maintains high accuracy even when evidence is located deep within a document (page 40+), whereas traditional image-based models see a sharp decline in performance as document length increases.

Conclusion and Future Work

DocAgent bridges the gap to human-level document understanding by prioritizing strategy over raw data ingestion. While the multi-agent approach introduces higher latency, the gains in accuracy and context efficiency are substantial. Future work will focus on reducing interaction latency and expanding the framework's capabilities to handle non-English linguistic structures and domain-specific jargon.

Summary updated

BibTeX
@misc{sun2025docagent,
  author = {Li Sun and He Liu and Shuyue Jia and Yangfan He and Chenyu You},
  title = {{DocAgent: An Agentic Framework for Multi-Modal Long-Context Document Understanding}},
  year = {2025},
  doi = {10.18653/v1/2025.emnlp-main.893},
}
Figure