Visually Guided Generative Text-Layout Pre-training for Document Intelligence

Zhiming Mao, Haoli Bai, Lu Hou, Lifeng Shang, Xin Jiang, Qun Liu, Kam-Fai Wong

Abstract

Visual Document Understanding (VDU) traditionally relies on external OCR engines, which can introduce cascading errors and ignore spatial context. This paper presents ViTLP (Visually guided generative Text-Layout Pre-training), a novel generative model that integrates text recognition and layout understanding directly from document images. ViTLP introduces a hierarchical decoding strategy to improve token efficiency and a multi-segment training scheme to handle documents of arbitrary length. Our evaluations show that ViTLP achieves state-of-the-art performance across various VDU benchmarks, including information extraction and visual question answering, while providing interpretable visual grounding for its outputs.

1. Introduction

The field of Visual Document Understanding (VDU) involves teaching machines to interpret complex documents like forms, receipts, and reports. Historically, this has required a two-step pipeline: an external OCR engine extracts text and coordinates, followed by a model that processes this structured data. However, this approach is brittle; OCR errors propagate through the system, and the separation of text from its visual context can lead to a loss of critical layout information.

Recent "OCR-free" models attempt to map images directly to text, but they often struggle with complex spatial structures and are limited by the fixed context windows of standard Transformers. ViTLP addresses these challenges by treating layout as a primary component of the generative process, functioning as a "native OCR" and reasoning engine capable of processing long, text-heavy documents without losing spatial context.

Overview of the ViTLP framework, illustrating the transition from document images to unified text-layout outputs across various tasks.

2. Methodology

ViTLP's architecture consists of a Vision Transformer (ViT) encoder to process the input image and a Causal Transformer decoder to generate interleaved text and layout sequences. Two primary innovations drive its efficiency:

2.1 Hierarchical Text-Layout Generation

Standard generative models that output both text and bounding boxes are often "token-inefficient," requiring multiple tokens per word to represent coordinates. ViTLP employs a global-to-local approach. The main decoder generates word tokens and a generic [LOC] token. A specialized, lightweight "Local Layout Head" then predicts precise coordinates from the hidden state associated with the [LOC] token. This hierarchical strategy achieves a compression ratio of approximately 0.48 compared to flattened sequences, allowing the model to process more information within a single pass.

The ViTLP architecture, highlighting the hierarchical decoding process between the Global LM Head and the Local Layout Head.

2.2 Multi-segment Pre-training

To overcome the context window limitations of Transformers, ViTLP utilizes a multi-segment training scheme. Documents are divided into segments, where the "suffix" tokens of a preceding segment serve as a "prefix prompt" for the next. This allows the model to maintain context across segments, enabling the processing of documents of arbitrary length without the need for complex modifications like sparse attention.

3. Experiments and Results

ViTLP was pre-trained on a large-scale dataset comprising 11 million scanned images from IIT-CDIP and 2 million synthetic documents from SynthDog, supplemented by diverse datasets like PubLayNet and SciTSR.

The model demonstrates superior performance across standard VDU benchmarks:

  • Information Extraction: ViTLP achieved a 95.59% F1 score on CORD and 87.61% on FUNSD, significantly outperforming generative baselines like DONUT.
  • OCR Performance: On the SROIE benchmark, ViTLP's text localization and recognition capabilities rivaled specialized OCR engines.
  • Document Classification: The model reached 95.36% accuracy on RVL-CDIP, matching the performance of complex discriminative models that rely on pre-processed OCR.

4. Discussion and Conclusion

A key advantage of ViTLP is its ability to provide "visual rationales." By generating coordinates alongside semantic answers, the model offers interpretable grounding, allowing users to verify the source of extracted information. Furthermore, the results suggest that modeling layout is not merely a secondary task but a fundamental component that enhances semantic extraction.

While ViTLP is currently limited by the resolution of its ViT encoder and primarily focuses on single-page documents, it represents a significant step toward unified, efficient, and interpretable document intelligence. Future work will focus on scaling the model parameters and extending its capabilities to high-resolution, multi-page document processing.

Summary updated

BibTeX
@inproceedings{mao2024visually,
  author = {Zhiming Mao and Haoli Bai and Lu Hou and Lifeng Shang and Xin Jiang and Qun Liu and Kam-Fai Wong},
  title = {{Visually Guided Generative Text-Layout Pre-training for Document Intelligence}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.naacl-long.264},
}
Figure