TL;DR
DistilDoc introduces the first comprehensive benchmarking framework for knowledge distillation (KD) in Visually-Rich Document (VRD) applications. By compressing cumbersome vision models used for layout analysis and image classification, the authors demonstrate that lightweight student models can efficiently extract logical document structures. These lean models can then be used to enrich text-only Large Language Model (LLM) prompts, significantly boosting downstream performance on tasks like Document Visual Question Answering (DocVQA) without the massive computational overhead of multimodal giants.
What Problem Does This Paper Address?
State-of-the-art models for document understanding have become incredibly massive and computationally expensive. Most rely on heavy multimodal architectures or massive LLMs that process both text and visual features simultaneously. However, these giants come with distinct drawbacks: they are computationally prohibitive for real-time or edge deployment, depend heavily on high-quality OCR, and struggle with low-resource languages or poor-quality scans.
While the broader machine learning community frequently uses Knowledge Distillation (KD) to compress models (transferring knowledge from a large "teacher" model to a smaller "student"), the Document AI field has largely neglected it. This paper addresses this gap by investigating how to efficiently compress Document Layout Analysis (DLA) and Document Image Classification (DIC) models so they can provide vital structural context to downstream applications cheaply and robustly.
Methods
The authors design a systematic KD experimentation methodology tailored specifically for document workflows.
Key methodological contributions include:
- Comprehensive KD Benchmarking: They evaluate both response-based KD (matching final logit outputs) and feature-based KD (mimicking intermediate hidden layers) across diverse architectures including ResNets, Vision Transformers (ViT), and Document Image Transformers (DiT).
- ViT-Compatible SimKD: They introduce a novel variant of SimKD (a hybrid KD method that reuses the teacher's frozen classifier head) adapted for Vision Transformers by utilizing a linear projection layer on the
[CLS]token. - DLA Integration: For layout analysis, they successfully integrate feature-based KD into the complex Mask R-CNN meta-architecture for instance segmentation.
- Layout-Enriched Prompting: They develop a pipeline (Algorithm 1) that takes the compressed DLA model's bounding box predictions and injects them as structural XML-like tags (e.g.,
<Table>,<Title>) directly into the text prompts of a quantized Llama-2 model for zero-shot DocVQA.
Datasets
The paper utilizes a robust suite of datasets to evaluate classification, layout analysis, and downstream task robustness:
- Document Image Classification (DIC): Pretrained on ImageNet-1K and IIT-CDIP (11M images); trained/evaluated on Tobacco-3482 and RVL-CDIP (including a subsampled RVL-CDIP$_{1k}$ variant to accelerate iteration cycles).
- Document Layout Analysis (DLA): PRImA (400 images) and DocLayNet (a large-scale, diverse dataset of 81K pages across 11 categories).
- Robustness & Downstream Evaluation: RVL-CDIP-N (to test out-of-distribution covariate shift), SP-DocVQA, and InfographicVQA.
Key Insights and Ideas
- The Pretraining Representation Gap: A self-supervised document foundation model teacher (like DiT-B) does not always distill cleanly into a student initialized with natural image weights (ImageNet ViT). This is due to a large representation gap in their feature spaces. However, DiT-distilled students show superior robustness when tested on out-of-distribution data (covariate shift).
- SimKD Punches Above Its Weight: SimKD consistently outperforms standard supervised training and other KD variants. It proves exceptionally powerful at bridging massive capacity gaps, allowing tiny models to retain high accuracy.
- The DLA Knowledge Gap: Compressing DLA models results in a noticeable drop in mean Average Precision (mAP) (~8-10%), meaning fine-grained boundary details are easily lost during compression.
- Imperfect Layouts Still Help LLMs: Crucially, the drop in DLA mAP does not translate to a failure downstream. Even when the compressed DLA model provides imperfect structural tags, it still successfully guides text-only LLMs to locate answers better in zero-shot DocVQA tasks.
Key Results
- Massive Compression with Minimal Loss: On the RVL-CDIP classification dataset, a tiny ViT-Tiny student with only 5.5M parameters distilled via SimKD achieved 83% accuracy—coming within just 2.9% of a much larger ViT-Small student (86M parameters).
- Efficient Layout Analysis: For DLA on DocLayNet, a ResNet-50 student trained with SimKD achieved 62.71% mAP using only 29G FLOPs, compared to the ResNet-101 teacher's 73.56% mAP at 60G FLOPs, effectively halving the computational cost.
- Downstream VQA Boost: Incorporating the compressed DLA model's structural tags into Llama-2 prompts improved zero-shot SP-DocVQA performance from 57.63 to 58.39 ANLS (Automated Normalized Levenshtein Similarity) in text-only settings.
Limitations and Future Work
- Student Capacity Constraints in DLA: Due to the extreme computational demands of training instance segmentation models, the authors only evaluated a ViT-Tiny student for DLA, leaving the effects of wider teacher-student capacity gaps unexplored.
- Coarse Layout Semantics: Current DLA benchmarks like DocLayNet use generic categories (e.g., "text block"). The authors note that downstream LLMs would benefit from richer, more semantic structural definitions (e.g., distinguishing an "address block" or identifying "logos, stamps, and signatures").
- Scope Restrictions: The study was limited to single-page documents and visual-only knowledge distillation, leaving multimodal KD (integrating text and layout jointly during distillation) and multi-page document processing as open areas for future research.
Summary updated