Abstract
Visual Document Understanding (VDU) traditionally relies on extensive human-labeled datasets, which are costly and difficult to scale. DocKD is a novel framework that distills knowledge from Large Language Models (LLMs) to train smaller, efficient VDU models. By injecting structural knowledge—such as layout information and key-value pairs—into LLM prompts, DocKD generates high-quality synthetic data. This approach enables student models to excel in "open-world" scenarios, often outperforming models trained on human-annotated data for out-of-domain tasks.
Introduction
Visual Document Understanding (VDU) involves teaching AI to interpret documents like invoices, forms, and reports. A major bottleneck in this field is the reliance on massive amounts of human-labeled data. While Large Language Models (LLMs) possess deep reasoning capabilities, they often lack spatial awareness when processing raw text from Optical Character Recognition (OCR). Naively prompting an LLM with unstructured text often results in low-quality or hallucinated annotations.
DocKD addresses this challenge by using an LLM as a "teacher" to generate a rich, structurally-aware training set for a smaller "student" model. This allows for the creation of fast, efficient models capable of handling document types they have never encountered during training, effectively solving the "open-world" generalization problem.
Methodology: The DocKD Framework
The DocKD framework utilizes three specific strategies to inject external document knowledge into the LLM teacher's prompts, ensuring the generated data is high-quality and structurally grounded:
- Layout-Aware VQA: Raw OCR text is converted into a spatially linearized "markdown" format. This helps the LLM understand the document's physical structure (e.g., tables and columns), leading to more accurate and complex Question-Answer pairs.
- Expert-Guided Entity Extraction: A specialized "expert model" is used to detect potential key-value pairs. These candidates are fed to the LLM to help it identify and name diverse entities it might otherwise overlook.
- Descriptive Classification: To improve document categorization, the LLM first generates a one-sentence description of the document. This description is then used to brainstorm diverse "positive" and "negative" class labels, preventing the model from becoming too narrow in its classification logic.
The student model, typically a DocFormerv2 architecture, is then trained on this high-quality synthetic data to perform tasks like VQA, entity extraction, and classification.
Experimental Evaluation
Datasets and Setup
The authors generated synthetic data using a 100K subset of the Industry Document Library (IDL). The resulting models were evaluated on several standard benchmarks, including DocVQA, CORD, DeepForm, and RVL-CDIP. To test "open-world" capabilities, the models were also evaluated on out-of-domain (OOD) sets such as DUDE (multi-domain VQA) and IRS-50 (tax forms).
Key Results
- VQA Performance: On the DocVQA benchmark, the DocKD-trained student achieved 81.0% ANLS, a significant improvement over the 76.9% achieved by standard distillation methods.
- Open-World Generalization: In OOD classification (IRS-50), DocKD achieved 82.0% accuracy, whereas models trained on standard supervised data struggled significantly to generalize.
- Data Efficiency: Adding DocKD-generated data to existing human-annotated sets boosted performance (e.g., from 80.6% to 83.4% ANLS on DocVQA), demonstrating that synthetic LLM knowledge effectively complements human expertise.
Insights and Discussion
The success of DocKD highlights that structure is paramount in document understanding. Linearizing OCR text into markdown significantly improved the quality of teacher-generated data. Furthermore, the results suggest that synthetic diversity is a powerful tool for generalization; student models trained on DocKD data were often better at handling unseen document types than those trained on narrow human datasets. Finally, the use of LLMs to generate negative labels for classification proved essential for building robust, discriminative models.
Limitations and Future Work
Currently, DocKD focuses on relatively structured documents like forms and tables. It has not yet been optimized for documents with complex visual elements like intricate flowcharts or dense mathematical equations. Future work may involve integrating Multimodal Large Language Models (MLLMs) directly into the distillation pipeline to handle these visually rich elements without relying on intermediate OCR or expert models. There is also potential to explore more sophisticated prompt engineering to further reduce hallucinations in synthetic data generation.
Summary updated