StructuralLM: Structural Pre-training for Form Understanding

Chenliang Li, Bin Bi, Ming Yan, Wei Wang, Songfang Huang, Fei Huang, Luo Si

Abstract

StructuralLM introduces a pre-training strategy that treats document "cells" (bounding boxes from OCR) as the fundamental semantic units rather than individual words. By introducing cell-level 2D-position embeddings and a novel "Cell Position Classification" task, it achieves new state-of-the-art results on form understanding, document QA, and image classification—all without relying on computationally expensive visual features.

Introduction

While Large Language Models (LLMs) excel at processing plain text, they often struggle with Document AI tasks involving scanned forms, invoices, and tables. In these documents, the spatial layout is just as important as the text itself.

Previous state-of-the-art models like LayoutLM introduced 2D-position embeddings at the word level. However, the authors argue this is insufficient. In a form, words inside the same bounding box (a "cell") usually function as a single semantic unit (e.g., "Total Due"). If a model treats every word's position independently, it might fail to recognize that these words belong together, leading to errors in entity labeling. StructuralLM addresses this by making the model aware of cell boundaries and the global structural relationships between those cells.

Examples of document types handled by StructuralLM, showcasing complex layouts and forms.

Methodology

StructuralLM builds on the BERT architecture (specifically initialized from RoBERTa-large) but introduces three key modifications to better capture document structure:

  1. Cell-level 2D-Position Embeddings: Unlike previous models where every word has its own unique 2D coordinates, StructuralLM assigns the same 2D-position embedding to every token within a single cell. This forces the model to treat the cell as a unified semantic block.
  2. Preservation of 1D Order: To ensure the model still understands the sequence of words within a cell, it retains classic 1D-position embeddings.
  3. Cell Position Classification (CPC): This new pre-training objective divides the document image into a grid of $N$ equal-sized areas (typically a $4 \times 4$ grid). During pre-training, the 2D positions of certain cells are masked. The model must predict which of the $N$ grid areas the masked cell belongs to, based only on the surrounding text and the layout of unmasked cells.
StructuralLM architecture illustrating cell-level 2D-position embeddings and the pre-training framework.

Crucially, StructuralLM does not use raw image features (like CNN-extracted pixels) during pre-training, making it more lightweight and easier to deploy than multimodal models that require a full vision backbone.

Evaluation and Results

The model was pre-trained on the IIT-CDIP Test Collection 1.0, a massive dataset containing over 6 million scanned documents. It was evaluated on several benchmarks, achieving significant jumps over the previous SOTA (LayoutLM):

  • Form Understanding (FUNSD): Improved the F1 score from 78.95 to 85.14.
  • Document Visual QA (DocVQA): Improved the Average Normalized Levenshtein Similarity (ANLS) from 72.59 to 83.94.
  • Document Classification (RVL-CDIP): Pushed accuracy from 94.43% to 96.08%.

An ablation study confirmed that the cell-centric approach is the primary driver of success; removing cell-level layout embeddings caused the F1 score on FUNSD to drop from 0.85 to 0.80.

Discussion and Conclusion

The core innovation of StructuralLM is treating the "cell" as a semantic anchor. Grouping tokens by shared coordinates provides a powerful inductive bias that prevents the model from "breaking" entities that are physically grouped together. The CPC task acts as a "spatial jigsaw," teaching the model the "grammar" of forms—such as the typical placement of labels relative to values.

While the model performs excellently, it remains dependent on OCR quality. Errors in cell detection directly impact structural understanding. Furthermore, while text geometry is highly informative, the model currently lacks purely visual cues like logos or checkboxes. Overall, StructuralLM demonstrates that sophisticated structural modeling of text can outperform more complex multimodal models in key Document AI tasks.

Summary updated

BibTeX
@inproceedings{li2021structurallm,
  author = {Chenliang Li and Bin Bi and Ming Yan and Wei Wang and Songfang Huang and Fei Huang and Luo Si},
  title = {{StructuralLM: Structural Pre-training for Form Understanding}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  url = {https://openreview.net/forum?id=Y3he8gzfQT6},
}
Figure