Preprint
Large Language Models

Layout LM v3

Yupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, Furu Wei
April 1, 2022ACM Multimedia838 citations

838

Citations

139

Influential Citations

ACM Multimedia

Venue

2022

Year

Abstract

A unified text-image multimodal Transformer to learn cross-modal representations, that imputs concatenation of text embedding and image embedding.

Analysis

Why This Paper Matters

Document AI has long struggled with the challenge of jointly understanding text and layout. Previous models like LayoutLM and LayoutLMv2 used separate encoders or complex fusion mechanisms, often treating text and image features as distinct streams. LayoutLMv3 breaks this pattern by introducing a truly unified text-image multimodal Transformer. This matters because it simplifies the architecture, reduces the need for task-specific engineering, and achieves state-of-the-art results across a wide range of document understanding tasks. For practitioners, this means a single pre-trained model can be fine-tuned for form parsing, receipt extraction, document classification, visual question answering, and layout analysis without architectural changes.

How It Works

Figure 1

LayoutLMv3's core innovation is a Transformer that takes a concatenated sequence of text and image embeddings as input. The text embedding combines word embeddings (initialized from RoBERTa) with 1D position embeddings (token index) and 2D layout position embeddings (normalized bounding box coordinates). Unlike earlier LayoutLM versions that used word-level layout positions, LayoutLMv3 adopts segment-level layout positions, where all words in a text segment share the same 2D position. This better reflects the semantic grouping of words in documents (e.g., a sentence or a field label).

Figure 2

For images, the document is resized to 224x224 pixels and split into 16x16 patches (196 patches total). Each patch is linearly projected to a D-dimensional vector and combined with a learnable 1D position embedding. These image patch embeddings are then concatenated with the text embeddings to form the full input sequence.

Pre-training uses three objectives:

  • Masked Language Modeling (MLM): 30% of text tokens are masked using span masking (Poisson distribution with λ=3). The model predicts the masked tokens using context from both text and image.
  • Masked Image Modeling (MIM): 40% of image patches are masked using blockwise masking. The model reconstructs the masked patches using cross-entropy loss, learning high-level layout structures.
  • Word-Patch Alignment (WPA): The model predicts whether a text word's corresponding image patches are masked. This forces the model to learn fine-grained alignment between text tokens and image regions.

Pre-training is performed on the large IIT-CDIP dataset. Two model sizes are provided: BASE (12 layers, 12 heads, 768 hidden) and LARGE (24 layers, 16 heads, 1024 hidden). Text is tokenized with Byte-Pair Encoding (BPE) with max length 512, and special tokens [CLS] and [SEP] are added.

Results

LayoutLMv3 achieves state-of-the-art results on five major document AI benchmarks:

  • FUNSD (form understanding): 92.1% F1
  • CORD (receipt understanding): 96.8% F1
  • RVL-CDIP (document classification): 95.5% accuracy
  • DocVQA (visual question answering): 83.4% ANLS
  • PubLayNet (layout analysis): 95.8% mAP

These results consistently outperform LayoutLMv2 and other prior models, demonstrating the effectiveness of the unified architecture and the combined pre-training objectives.

Significance

LayoutLMv3 represents a paradigm shift in document AI by treating text and image as a single modality. This unified approach simplifies model design and enables more natural cross-modal learning. The introduction of segment-level layout positions and the WPA objective are practical innovations that improve performance on real-world documents. For AI practitioners, LayoutLMv3 offers a strong baseline for any document understanding task, and its pre-training recipe can be adapted to domain-specific documents. The work also highlights the importance of masking strategies (span vs. blockwise) and alignment objectives in multimodal learning. Future directions could include scaling to larger patch sizes, handling variable-resolution images, or extending to multilingual documents.