Knowing Where and What: Unified Word Block Pretraining for Document Understanding

Tao Song, Zijian Wang, Tiantian Fan, Canjie Luo, Can Huang

TL;DR

This paper introduces UTel, a novel pre-trained language model for document understanding that unifies text and layout information. UTel achieves state-of-the-art performance on various downstream tasks by introducing two new pre-training tasks and a unique 1D clipped relative position embedding, enabling it to handle arbitrary-length documents without truncation.

What Problem Does This Paper Address?

Document understanding is a challenging task because it requires processing not just the text content but also the complex visual layout of documents. Traditional NLP models excel at plain text, but struggle with the spatial arrangement of information in documents like forms, invoices, or academic papers. While recent advances have focused on multimodal approaches (text + layout + image) and self-supervised pre-training, there's a gap in truly unified pre-training that effectively learns the interplay between text semantics and spatial layout. Existing methods often treat these modalities separately or rely on image features, which can be computationally expensive. The authors aim to bridge this gap by developing a model that learns a joint representation of text and layout in a unified manner, without relying on image modalities.

Methods

UTel is built upon the BERT architecture and introduces several key innovations:

  • Unified Text and Layout Pre-training: The core idea is to train a single model that simultaneously learns from text and layout information.
  • Novel Pre-training Tasks:
    • Surrounding Word Prediction (SWP): This task trains the model to predict the content of words located in the immediate top, bottom, left, and right of a given word block. This encourages the model to understand spatial relationships and infer context from neighboring elements.
  • Contrastive Learning of Word Embeddings (CWE): This task uses dropout as a data augmentation technique to create positive pairs of word embeddings. The model learns to distinguish between different word blocks by maximizing the similarity of positive pairs and minimizing the similarity of negative pairs, focusing on the joint text-layout representation.
  • 1D Clipped Relative Position Embedding: Instead of the standard 1D absolute position embeddings, UTel uses a 1D clipped relative position embedding. This means the model learns the relative distance between tokens, but the distance is capped at a certain range (m). This has two main benefits:
  • It allows the model to process sequences of arbitrary length without needing to truncate them, as the relative positions are always within a defined range.
  • It forces the model to rely more on the text and layout modalities for understanding context, rather than solely on absolute positional information.
  • Masked Layout-Language Modeling (MLLM): This is a standard task adapted from BERT, where masked tokens are predicted using the surrounding text and layout information.

Datasets

  • Pre-training: The model is pre-trained on the IIT-CDIP Test Collection 1.0, a large dataset of scanned documents. Since layout information is missing, OCR is used to extract word blocks and their bounding boxes.
  • Fine-tuning:
    • FUNSD (Form Understanding): Used for form understanding tasks, providing scanned forms with annotations for semantic entity labeling (question, answer, header, etc.).
  • SROIE and CORD: Used for receipt understanding tasks, involving extracting specific key-value pairs from receipts.

Key Insights and Ideas

  • Layout Matters, Even Without Images: UTel demonstrates that rich document understanding can be achieved using only text and layout information, outperforming some multimodal models that incorporate image features. This suggests that the spatial arrangement of text is a powerful signal.
  • Unified Pre-training is Effective: Combining text and layout learning within a single framework, through tasks like SWP and CWE, leads to better joint representations than treating them separately.
  • Relative Positions are Key (and Capped): Replacing absolute position embeddings with clipped relative ones is a clever way to enable arbitrary-length sequence processing without sacrificing performance. The robustness of the model to the clipping range (m) is also noteworthy.
  • Pre-training Tasks Synergize: The proposed SWP and CWE tasks, when combined with MLLM, provide significant improvements, indicating that different pre-training objectives capture complementary aspects of document understanding.

Key Results

  • State-of-the-Art Performance: UTel achieves superior performance on the FUNSD dataset (form understanding) compared to previous models, including those that use image modalities. For example, UTelBASE achieves an F1 score of 90.94% on FUNSD with segment-level layout positions, outperforming LayoutLMv3BASE.
  • Competitive on Receipt Understanding: UTel also shows strong results on SROIE and CORD datasets for receipt understanding, achieving comparable or better performance than existing methods, even when compared to models using image features.
  • Efficiency: UTelBASE has fewer parameters (111M) than many comparable models, yet achieves better results.
  • Arbitrary Length Processing: The 1D clipped relative position embedding allows UTel to handle documents of any length without truncation, a significant advantage for real-world applications.

Limitations and Future Work

  • Image Modality: While UTel performs well without image features, the paper acknowledges that models like LayoutLMv3, which incorporate image modality and an image tokenizer, slightly outperform UTel on some tasks. This suggests that future work could explore integrating image features more effectively into UTel's unified framework.
  • Ablation on m: The paper shows UTel is robust to the clipping range m in the 1D clipped relative position embedding, but a very small m can lead to performance drops. Further exploration into optimal m values or adaptive clipping could be beneficial.
  • Low-Resource Scenarios: The paper demonstrates UTel's strong generalization ability with few training samples, but further research into few-shot or zero-shot learning for document understanding could be a promising direction.

Summary updated

Abstract

Due to the complex layouts of documents, it is challenging to extract information for documents. Most previous studies develop multimodal pre-trained models in a self-supervised way. In this paper, we focus on the embedding learning of word blocks containing text and layout information, and propose UTel, a language model with Unified TExt and Layout pre-training. Specifically, we propose two pre-training tasks: Surrounding Word Prediction (SWP) for the layout learning, and Contrastive learning of Word Embeddings (CWE) for identifying different word blocks. Moreover, we replace the commonly used 1D position embedding with a 1D clipped relative position embedding. In this way, the joint training of Masked Layout-Language Modeling (MLLM) and two newly proposed tasks enables the interaction between semantic and spatial features in a unified way. Additionally, the proposed UTel can process arbitrary-length sequences by removing the 1D position embedding, while maintaining competitive performance. Extensive experimental results show UTel learns better joint representations and achieves superior performance than previous methods on various downstream tasks, though requiring no image modality. Code is available at \url{https://github.com/taosong2019/UTel}.
BibTeX
@misc{song2022knowing,
  author = {Tao Song and Zijian Wang and Tiantian Fan and Canjie Luo and Can Huang},
  title = {{Knowing Where and What: Unified Word Block Pretraining for Document Understanding}},
  year = {2022},
  eprint = {2207.13979},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2207.13979},
}

Loading related content...

Figure