VLCDoC: Vision-Language Contrastive Pre-Training Model for Cross-Modal Document Classification

Souhail Bakkali, Zuheng Ming, Mickael Coustaty, Marçal Rusiñol, Oriol Ramos TerradesarXiv 2022

TL;DR

VLCDoC is a novel vision-language pre-training framework that tackles document classification by aligning visual and textual features at the page level. By combining specialized cross-modal attention modules with a combinatorial contrastive loss, it achieves state-of-the-art performance while requiring significantly less pre-training data than competing models.

What Problem Does This Paper Address?

Document image classification is a deceptively complex task. Unlike natural images, documents are "natively multimodal," containing visual cues (figures, tables), textual content, and structural layout information. Researchers face two primary hurdles:

  1. High Intra-class Variation: Two documents of the same type (e.g., two different "memos") can look completely different.
  2. Low Inter-class Discrimination: Documents from different categories (e.g., a "letter" vs. a "report") might share very similar visual structures.

You can see these challenges illustrated in Figure 1, where samples from the same class (green borders) vary wildly, while samples from different classes (red borders) often look similar at a glance.

Figure 1: Document samples from the categories of the RVL-CDIP dataset which show the high intra-class structural variability and low inter-class discrimination between the different categories of document data. Samples from different classes are shown with a red border, while samples from the same class are shown with green border.

Existing state-of-the-art models often rely on word-level masking and massive datasets (upwards of 11 million documents) to learn these nuances. VLCDoC aims to bridge this "semantic gap" more efficiently by focusing on global, page-level interactions rather than just local word-level features.

Methods

VLCDoC uses an encoder-only transformer architecture with two main branches: a vision branch (using a ViT-B/16 backbone) and a language branch (using BERT-Base on text extracted via OCR).

The core innovation lies in how these modalities interact:

  • InterMCA (Inter-Modality Cross-Attention): This module captures high-level interactions between image regions and text sequences, essentially transferring salient information from one modality to the other.
  • IntraMSA (Intra-Modality Self-Attention): While many models focus only on cross-modal fusion, VLCDoC uses this module to ensure that similar features within the same modality stay close in the joint embedding space.
  • CrossCL (Cross-modal Contrastive Loss): The authors propose a combinatorial loss function that simultaneously aligns features within and across modalities. It works by "contracting" positive sample pairs (semantically related) while "contrasting" negative ones in a shared representation space.

Unlike models that simply concatenate features, VLCDoC uses these attention flows to learn a more integrated, semantically enriched representation.

Datasets

The authors evaluated VLCDoC on three key benchmarks:

  • RVL-CDIP: A large-scale dataset of 400,000 grayscale document images split into 16 classes (e.g., letter, form, invoice).
  • Tobacco-3482: A smaller, more challenging dataset of 3,482 images across 10 classes, used primarily for ablation studies and testing low-data regimes.
  • NIST Special Database 6: A dataset of 5,595 structured tax forms, used to test the model's generality on highly structured data.

Key Insights and Ideas

  • Page-Level > Word-Level: The authors argue that for semi-structured documents like forms or advertisements, semantic meaning relies heavily on global context. Page-level pre-training captures these global relationships better than local word-masking, which can be prone to errors if OCR or position encoding is imperfect.
  • The Importance of Intra-Modality Alignment: A key "aha moment" in the paper is the realization that cross-modal learning is more effective when you also explicitly enforce consistency within each modality. The IntraMSA module prevents the model from losing modality-specific semantic richness during the fusion process.
  • Data Efficiency: Perhaps the most significant finding is that VLCDoC achieves competitive results using only 320,000 training samples, whereas many top-tier models require 11 million. This suggests that smarter architectural interactions can compensate for smaller dataset sizes.

Key Results

VLCDoC demonstrated strong performance across the board:

  • RVL-CDIP Accuracy: The multimodal (Vision + Language) version achieved 93.19% accuracy, outperforming its own uni-modal baselines (Vision-only: 92.64%; Language-only: 91.37%).
  • Generality: In cross-dataset tests (pre-training on one dataset and testing on another), VLCDoC showed remarkable robustness, achieving 99.99% accuracy on the NIST tax form dataset.
  • Ablation Success: Removing the InterMCA and IntraMSA modules led to a significant performance drop (from ~90.9% down to ~85.7% on the Tobacco dataset), validating the necessity of these specific attention mechanisms.

Limitations and Future Work

While VLCDoC is highly effective, the authors note a few areas for improvement:

  • Missing Layout Modality: Currently, the model focuses on vision and language. The authors plan to integrate a third "layout" modality to further refine the structural understanding of documents.
  • Transformer "Hunger": The paper acknowledges that Vision Transformers (ViT) are inherently more data-hungry than traditional Convolutional Neural Networks (DCNNs). While VLCDoC reduces the data requirement compared to other transformers, it still faces challenges in extremely low-data downstream tasks where DCNNs might over-fit less.
  • Pre-text Tasks: The team aims to explore new pre-text task strategies beyond contrastive learning to further improve the "pre-train-then-fine-tune" paradigm for document AI.

Summary updated

BibTeX
@misc{bakkali2022vlcdoc,
  author = {Souhail Bakkali and Zuheng Ming and Mickael Coustaty and Marçal Rusiñol and Oriol Ramos Terrades},
  title = {{VLCDoC: Vision-Language Contrastive Pre-Training Model for Cross-Modal Document Classification}},
  year = {2022},
  eprint = {2205.12029},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.12029},
}
Figure