Introduction
Multimodal Large Language Models (MLLMs) have made significant strides in general image understanding, yet they frequently falter when faced with "text-rich" documents such as dense PDFs, complex tables, and scientific charts. The primary hurdle is the structural gap between raw visual perception and the logical layout of a document. DocMark introduces a novel framework that teaches models to bridge this gap by using markup languages as an intermediate reasoning step.
The Hallucination Problem
Current fine-tuning paradigms often train models on simple Question-Answer pairs. This encourages models to map pixels directly to answers, bypassing a deep structural understanding of the document. Consequently, models often "hallucinate"—generating plausible-sounding but factually incorrect answers based on visual patterns rather than precise data extraction. This is particularly evident in charts and tables where spatial relationships are critical.
The DocMark Framework
DocMark addresses this by introducing an Adaptive Markup Language Generation pipeline. Instead of jumping straight to an answer, the model performs a two-step "Chain-of-Thought" (CoT) process:
- Context Extraction: The model identifies the most relevant part of the document and converts it into a structured markup language (e.g., Markdown for tables or JSON for charts).
- Grounded Reasoning: The model uses this intermediate "rationale" alongside the original image to derive the final answer.
Adaptive Structural Representation
A key innovation of DocMark is its adaptivity. The model is not hard-coded to a single format; rather, it learns to select the most appropriate markup language based on the document's content. This includes Markdown for tabular data, JSON for statistical charts, LaTeX for mathematical formulas, HTML for web layouts, and TikZ for geometric diagrams. By forcing the model to output the relevant context first, the task of "finding the data" is effectively disentangled from "calculating the answer."
Data and Training
To support this capability, the researchers developed two large-scale datasets:
- DocMark-Pile (3.8M pairs): A pretraining dataset designed to teach models how to parse diverse document types into six distinct markup formats.
- DocMark-Instruct (624k annotations): A fine-tuning dataset containing annotations that follow the two-round CoT format, using teacher models (like GPT-3.5) to generate intermediate rationales based on ground-truth text.
Performance and Insights
Evaluations across benchmarks like DocVQA, ChartQA, and MathVision demonstrate that DocMark significantly outperforms baseline models. For instance, DocMark-8B (built on InternVL2) achieved a score of 84.2 on ChartQA, surpassing the standard InternVL2-8B. The inclusion of TikZ and LaTeX data also led to a significant jump in MathVision scores, proving that structural understanding directly aids complex scientific reasoning.
Conclusion
By using markup languages as a bridge between vision and text, DocMark provides a scalable path toward more reliable document understanding. While the intermediate generation step increases inference tokens, the gains in accuracy and the reduction in hallucinations represent a significant step forward for MLLMs in professional, academic, and scientific domains.
Summary updated