DoPTA: Improving Document Layout Analysis using Patch-Text Alignment

Nikitha Sr, Tarun Ram Menta, Mausoom SarkararXiv 2024

TL;DR

DoPTA (Document Patch-Text Alignment) is a novel pre-training framework that infuses textual semantics directly into a visual document encoder. By using a fine-grained, IoU-guided alignment loss during training, it achieves state-of-the-art performance on document layout analysis and text detection while remaining completely OCR-free at inference time—making it up to 12x faster than existing top-tier models.

What Problem Does This Paper Address?

Visual Document Understanding (VDU) is inherently multimodal: a document's meaning comes from its text, its layout, and its visual elements (like figures or tables). Current state-of-the-art models usually fall into two camps:

  1. OCR-Based: These models extract text via OCR and then process it alongside the image. While accurate, they are slow (high latency) and suffer if the OCR engine makes a mistake.
  2. OCR-Free (Vision-Only): These models process the image directly. They are fast but often struggle with the "semantic" part of the document—they see a block of pixels but don't fully "understand" that it represents a specific type of text (like a "Question" or a "Date") because they lack a strong alignment between visual features and textual meaning.

The authors of DoPTA bridge this gap by creating a model that learns to "see" textual semantics during training so it doesn't need to "read" (OCR) them during inference.

Methods

The core innovation is a dual-objective pre-training strategy:

  • Patch-Text Alignment Loss ($L_{TP}$): This is the "secret sauce." During pre-training, the model uses an off-the-shelf OCR engine to get text and bounding boxes. It then uses a Text Encoder to process the text and a DoPTA Encoder (a Vision Transformer) to process image patches. The $L_{TP}$ loss uses the Intersection over Union (IoU) between text bounding boxes and image patches to force the model to align specific text tokens with the exact image patches they occupy.
  • Image Reconstruction Loss ($L_R$): Similar to Masked Autoencoders (MAE), the model masks out parts of the image and tries to reconstruct them. This helps the model learn about non-textual elements like lines, charts, and figures.

Crucially, after pre-training, the Text Encoder and Image Decoder are discarded. Only the DoPTA Encoder is used for downstream tasks, meaning no OCR is required at runtime.

Figure 2. Pre-training of DOPTA. Only the image encoder is required for downstream usage. Refer section Sec. 3 for details.

Datasets

  • Pre-training: The massive IIT-CDIP dataset (42 million document pages).
  • Evaluation:
    • RVL-CDIP: Document image classification.
  • PubLayNet & $D^4LA$: Document layout analysis (identifying tables, figures, titles, etc.).
  • FUNSD: Text detection and form understanding.
  • $M^6Doc$: A challenging layout detection benchmark with 76 diverse object classes.

Key Insights and Ideas

  • Fine-Grained Alignment is Essential: Global image-text alignment (like CLIP) is too coarse for documents. Because documents are dense and layout-sensitive, aligning individual text tokens to specific image patches (fine-grained) is what allows the model to capture the "semantic structure."
  • IoU as a Semantic Bridge: Using IoU to guide the contrastive loss "imbibes" the visual features with semantic knowledge. The model learns that a certain visual pattern is a "Date" or a "Question" because it was forced to align those concepts during training.
  • Efficiency Wins: DoPTA achieves better results than models with 3x more parameters (like DiT-L) and requires significantly fewer pre-training steps (250k vs. 500k+).
Figure 4. Results of DOPTA and existing SOTA document en- coder models. DOPTA outperforms other methods on multiple benchmarks, despite having less parameters, and a significantly shorter pre-training schedule. Refer to Sec. 4 for more details of individual benchmarks

Key Results

  • Speed: DoPTA operates at 9.56 FPS, which is roughly 12x faster than VGT (0.81 FPS) because it skips the expensive OCR step at inference.
  • Accuracy: It sets new state-of-the-art (SOTA) results on the challenging $D^4LA$ (70.72 mAP) and FUNSD (94.73 F1 score) benchmarks.
  • Classification: On RVL-CDIP, it outperforms all other OCR-free methods, including the much larger DiT-L model.
Comparison of speed (FPS) vs. accuracy (mAP) on the D4LA benchmark. DoPTA sits in the "High FPS, High Accuracy" sweet spot.

Qualitatively, the model shows an impressive ability to isolate individual words in a document image based purely on visual embeddings, as seen in the heatmap below:

Figure 3. Heatmap visualisation of the normalised dot product similarity of image region embeddings with the text embedding for the token ‘phosphine’ taken from DOPTAmodel. Additional qualitative results are presented in Appendix B.

Limitations and Future Work

  • Visual Similarity Confusion: The model sometimes confuses visually similar classes, such as RegionList and RegionKV (Key-Value pairs), especially when ground truth labels are ambiguous.
  • Rare Class Performance: Performance on extremely rare classes (like mathematical equations in certain datasets) remains a challenge due to data imbalance.
  • Architectural Exploration: The current work uses a standard ViT backbone. The authors suggest that moving to hierarchical architectures like SwinTransformer could further improve results for documents with very small, fine-grained details.

Summary updated

BibTeX
@misc{sr2024dopta,
  author = {Nikitha SR and Tarun Ram Menta and Mausoom Sarkar},
  title = {{DoPTA: Improving Document Layout Analysis using Patch-Text Alignment}},
  year = {2024},
  eprint = {2412.12902},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.12902},
}
Figure