Abstract
Visually-Rich Document (VRD) understanding is critical for automating tasks like invoice processing and complex table analysis. However, state-of-the-art models are often too computationally expensive for edge deployment. DistilDoc introduces a comprehensive framework to compress these models using Knowledge Distillation (KD). By transferring logical layout expertise from massive "teacher" models to lean "students," DistilDoc enables efficient document processing and enhances Large Language Model (LLM) performance on complex reasoning tasks like Document Visual Question Answering (DocVQA).
Introduction
Current VRD applications rely on heavy deep learning architectures (e.g., LayoutLM) that are memory-intensive and slow. While Large Language Models (LLMs) can process document text, they often lack awareness of logical structure—the difference between a header, a footer, or a table cell. Providing only raw text or geometric OCR coordinates limits their reasoning capabilities. DistilDoc addresses this by creating efficient models that provide logical context to LLMs without the massive overhead.
Methodology
The core of DistilDoc is Knowledge Distillation, where a small student model mimics a large, pre-trained teacher. The authors evaluated three primary KD strategies:
- Response-based: Matching the teacher's final logit predictions.
- Feature-based: Mimicking internal intermediate layer activations.
- SimKD (Hybrid): A sophisticated method that reuses the teacher's classifier for the student, adapted for Vision Transformers (ViTs) via a novel linear projection on the
[CLS]token.
The training pipeline involves multiple stages, from pre-training on massive datasets like ImageNet-1K to fine-tuning on specific document tasks.
Experimental Setup and Datasets
The framework was tested across diverse benchmarks to ensure robustness:
- Document Image Classification (DIC): Tobacco-3482 and the massive RVL-CDIP.
- Document Layout Analysis (DLA): DocLayNet (a large-scale, 11-category dataset) and PRImA.
- Robustness: RVL-CDIP-N for testing performance under covariate shift.
- Downstream Tasks: SP-DocVQA and InfographicVQA for evaluating LLM integration.
Key Insights
- Logical Context is King: For LLMs, identifying a text block as a
<Table>or<Header>is often more valuable for reasoning than precise pixel coordinates. - Self-Supervision and Robustness: Teachers trained with self-supervised objectives (like DiT) produce students that are significantly more robust to out-of-distribution documents compared to purely supervised teachers.
- The ViT Challenge: Distilling knowledge into Vision Transformers is more difficult than into CNNs due to the complex attention patterns that small students struggle to replicate.
Results
- Efficiency: A distilled ViT-Tiny student (26M parameters) achieved performance comparable to much larger models while processing 22 images per second.
- DLA Accuracy: On the DocLayNet benchmark, a ResNet-50 student distilled via SimKD reached 62.71 mAP, significantly closing the gap with the ResNet-101 teacher (73.56 mAP).
- LLM Enhancement: Injecting logical tags from a distilled DLA model into a Llama-2-7b prompt improved SP-DocVQA scores from 57.63 to 58.39 ANLS.
Conclusion
DistilDoc demonstrates that Knowledge Distillation is a viable path for deploying high-performance document understanding on resource-constrained devices. While challenges remain in distilling the regression components of bounding boxes, the framework provides a foundation for future multimodal KD research and more robust document processing.
Summary updated