DocumentNet: Bridging the Data Gap in Document Pre-training

Lijun Yu, Jin Miao, Xiaoyu Sun, Jiayi Chen, Alexander G. Hauptmann, Hanjun Dai, Wei Wei

Introduction

Visually-rich Document Entity Retrieval (VDER) is a critical task in enterprise AI, involving the extraction of structured information from documents like invoices, licenses, and forms. Despite its importance, progress has been hindered by a significant "data gap." Most real-world documents contain sensitive personally identifiable information (PII), preventing public release. Consequently, researchers have relied on small, specialized datasets or the aging IIT-CDIP collection, which lacks the diversity and scale needed for robust general-purpose models.

The DocumentNet Dataset

To address this scarcity, researchers from Google, CMU, and UVA introduced DocumentNet, a massive dataset of 30 million document images collected from the public web.

Data Collection Pipeline

The pipeline avoids privacy concerns by crawling public web images. The team curated a four-level ontology of approximately 400 document types (e.g., Financial, Legal, Business, Education). Using a joint text-image embedding space, they performed a nearest-neighbor search to find images matching these keywords. Instead of expensive human labeling, the dataset utilizes "weak labels" generated by OCR and an external text tagger for entities like dates and prices.

Comparison of DocumentNet with existing document and image datasets. DocumentNet-v2 scales to 30M samples with high-quality OCR and diverse domain coverage.

The UniFormer Architecture

Alongside the dataset, the authors proposed UniFormer, a lightweight multimodal transformer designed for efficient document understanding.

Multimodal Tokenization

UniFormer employs a novel multimodal tokenization strategy. For every text token identified by OCR, the model extracts a corresponding image crop. The final token representation is a fusion of text embeddings, 2D layout coordinates (bounding boxes), and a linear projection of the visual image crop.

Training Objectives

The model is pre-trained using three primary objectives:

  • Multimodal Masked Language Modeling (MMLM): Predicting missing words using both surrounding text and visual context.
  • Masked Crop Modeling (MCM): Reconstructing missing image patches.
  • Token Tagging (TT): Learning from the noisy, weak labels provided by the external tagger.
The UniFormer architecture and pre-training pipeline, illustrating the fusion of text, layout, and visual crop embeddings.

Key Results and Insights

UniFormer, with 115M parameters, demonstrates that massive-scale pre-training can compensate for a smaller model size. When pre-trained on DocumentNet-v2, it achieved state-of-the-art results on standard benchmarks, reaching an F1 score of 84.18 on FUNSD and 96.45 on CORD.

A significant finding is the model's few-shot performance. In low-data regimes (e.g., 2-shot settings), DocumentNet-v2 pre-training provides a substantial boost, acting as a "world model" for document structures. This suggests that the diversity captured by the 400-category ontology allows the model to generalize to new document types with minimal supervision.

Conclusion

DocumentNet and UniFormer represent a significant step toward closing the data gap in Document AI. By leveraging the public web and weak supervision, the authors have created a resource that rivals the scale of general computer vision datasets like ImageNet, specifically tailored for the complexities of visually-rich documents. Future work will focus on refining keyword selection and distinguishing between empty templates and filled-out forms to further improve real-world extraction performance.

Summary updated

BibTeX
@inproceedings{yu2023documentnet,
  author = {Lijun Yu and Jin Miao and Xiaoyu Sun and Jiayi Chen and Alexander G. Hauptmann and Hanjun Dai and Wei Wei},
  title = {{DocumentNet: Bridging the Data Gap in Document Pre-training}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-industry.66},
}
Figure