Abstract
Document Question Answering (DocQA) focuses on answering questions grounded in given documents, yet existing DocQA agents lack effective tool utilization and largely rely on closed-source models. In this work, we introduce DocDancer, an end-to-end trained open-source Doc agent. We formulate DocQA as an information-seeking problem and propose a tool-driven agent framework that explicitly models document exploration and comprehension. To enable end-to-end training of such agents, we introduce an Exploration-then-Synthesis data synthesis pipeline that addresses the scarcity of high-quality training data for DocQA. Training on the synthesized data, the trained models on two long-context document understanding benchmarks, MMLongBench-Doc and DocBench, show their effectiveness. Further analysis provides valuable insights for the agentic tool design and synthetic data.
Introduction
Answering complex questions based on long, multi-modal documents—such as financial reports or academic papers containing text, charts, and tables—remains a significant challenge for AI. Current approaches often fall short: OCR-based pipelines lose layout context, single-pass RAG systems fail at multi-step reasoning, and prompt-based agents typically require expensive, closed-source LLMs like GPT-4o.
The primary obstacle to developing capable open-source DocQA agents is the lack of high-quality, multi-hop training data. DocDancer addresses this gap by introducing an end-to-end trained agentic framework and a novel data synthesis pipeline that reverse-engineers the question-creation process.
The DocDancer Agentic Framework
DocDancer treats DocQA as an iterative information-seeking task. Instead of a complex toolkit, it employs a streamlined ReAct-style architecture with two primary tools:
- Search: A global keyword search that identifies relevant sections and provides text snippets.
- Read: A fine-grained local reading tool that uses a multimodal model to extract and synthesize information from specific document layouts (e.g., tables and charts).
The framework utilizes MinerU2.5 for high-fidelity document parsing into visually-aware XML outlines. This allows the agent to navigate and comprehend complex structures effectively.
Exploration-then-Synthesis Data Pipeline
To overcome the scarcity of human-annotated training data, DocDancer introduces an Exploration-then-Synthesis pipeline. This method reverse-engineers the QA creation process:
- Exploration Stage: An LLM agent performs a "random walk" through a document using the Search and Read tools to gather grounded evidence across multiple pages.
- Synthesis Stage: A powerful LLM analyzes the resulting exploration trajectory and generates a complex, multi-hop question that necessitates that specific path to reach the correct answer.
By fine-tuning open-source models (e.g., Qwen3-based 4B and 30B variants) on just 5,000 of these synthetic trajectories, the authors successfully instill robust agentic behaviors. During training, loss masking is applied to tool observations, ensuring the model focuses on learning the decision-making process rather than just memorizing retrieved text.
Experimental Results
DocDancer was evaluated on two rigorous benchmarks: MMLongBench-Doc (averaging 47.5 pages per document) and DocBench (spanning five real-world domains).
- State-of-the-Art Performance: The fine-tuned Qwen3-30B model achieved 54.4% Accuracy on MMLongBench-Doc, surpassing the GPT-4o-powered DocAgent (51.8%).
- Human-Level Competence: On DocBench, the 30B model matched the human baseline score of 81.2 (using an LLM-as-Judge metric).
- Efficiency: The success of the model with only 5,000 training examples highlights the high sample efficiency of the Exploration-then-Synthesis approach.
Conclusion
DocDancer demonstrates that high-quality synthetic data and a focused toolset can enable relatively small open-source models to match or exceed the performance of proprietary systems in complex DocQA tasks. Future work includes exploring reinforcement learning to further refine agentic behaviors and investigating the scaling laws of synthetic data for document understanding.
Summary updated