Introduction
Zero-shot learning (ZSL) has seen significant advancements with the advent of vision-language models like CLIP. However, document image classification remains a distinct challenge. Unlike natural images where semantic meaning is derived from visual objects, documents are defined by a complex interplay of visual layout and dense textual content. Standard CLIP models often struggle with documents because they are not optimized to "read" the fine-grained text that distinguishes similar categories, such as an invoice versus a budget report.
Furthermore, the field of document ZSL has historically lacked rigorous evaluation protocols. Many studies fail to account for the bias toward "seen" classes during training, a problem typically addressed in broader computer vision research through the use of per-class accuracy and the harmonic mean in Generalized Zero-Shot Learning (GZSL).
The CICA Framework
To address these gaps, we present CICA (Content-Injected Contrastive Alignment), a lightweight framework designed to enhance CLIP’s document understanding capabilities without requiring extensive retraining of the base model. CICA introduces three primary components:
1. The Content Module
CICA incorporates a plug-and-play transformer encoder specifically designed to process "content"—text extracted from document images via Optical Character Recognition (OCR). This allows the model to explicitly leverage the semantic richness of the document's text.
2. Coupled-Contrastive Loss
A core innovation of CICA is the Coupled-Contrastive Loss. Rather than simply aligning images with textual class descriptions, CICA aligns the features produced by the Content Module with both CLIP’s image features ($L_{ic}$) and CLIP’s text features ($L_{tc}$). This dual alignment ensures that OCR-derived features are mapped into the same shared semantic space as the visual and label features, creating a unified representation of the document.
3. Late Fusion Inference
During the inference phase, the model employs a late fusion strategy. It generates two sets of prediction scores (logits): one derived from the image-to-label path and another from the content-to-label path. These scores are averaged to produce the final classification. This approach was found to be superior to early fusion (merging features before the final layer), as it preserves the distinct nuances of both visual and textual modalities.
Notably, CICA is highly efficient, adding only 3.3% more parameters to the base CLIP architecture.
Experimental Setup
The framework was evaluated using the RVL-CDIP dataset, a standard benchmark containing 400,000 grayscale images across 16 document categories. To ensure a robust evaluation, the authors introduced two new data splitting protocols:
- Sequential Splits: The 16 classes are divided into four groups, ensuring every class is evaluated as "unseen" across different folds.
- Incremental Splits: Classes are ranked by their difficulty for vanilla CLIP, and the number of unseen classes is progressively increased to test the model's scalability and robustness.
Results and Discussion
CICA demonstrated substantial performance improvements over the vanilla CLIP baseline:
- Zero-Shot Learning (ZSL): Achieved an average increase of 6.7% in top-1 accuracy for unseen classes.
- Generalized Zero-Shot Learning (GZSL): Achieved a 24% improvement in the harmonic mean (H), indicating a significantly better balance between recognizing seen and unseen classes simultaneously.
- Generalization: In incremental split tests, CICA maintained a consistent performance lead even as the task complexity increased.
Key Insights
- Mitigating Catastrophic Forgetting: Standard supervised fine-tuning on "seen" classes often degrades a model's ability to generalize to "unseen" ones. CICA’s alignment strategy effectively avoids this "fine-tuning trap."
- OCR Dependency: The quality of the OCR engine is a critical factor. Experiments showed that using docTR consistently outperformed Tesseract, suggesting that the framework's efficacy scales with the quality of text extraction.
- Modality Synergy: The success of late fusion suggests that visual layout and textual content provide complementary information that is best integrated at the decision level rather than the feature level.
Conclusion and Future Work
CICA provides a scalable and efficient method for improving zero-shot document classification by treating OCR text as a distinct, alignable modality. While the model currently relies on external OCR engines, future work could explore injecting other forms of data—such as document metadata, file headers, or structural layout information—into the same contrastive framework. Despite challenges with semantically "outlier" classes like budgets or presentations, CICA represents a significant step forward in bridging the gap between general vision-language models and specialized document understanding.
Summary updated