Introduction
Visually-rich Document Understanding (VrDU) is a critical field for automating the processing of receipts, forms, and other structured documents. Traditional models often rely on a "global 1D position" encoding, which assumes a linear reading order. However, this approach struggles with complex multi-column layouts or OCR errors that disrupt the sequence. Researchers at Ant Group have introduced LayoutMask, a multi-modal pre-training framework designed to strengthen the interaction between text and layout by intentionally removing the "crutch" of global reading order.
Methodology
LayoutMask shifts the focus from sequential reading to spatial understanding through three key innovations.
Architecture Overview
The model architecture integrates text and layout information using a Transformer-based backbone with a spatial-aware self-attention mechanism. It introduces two primary pre-training tasks: Masked Language Modeling (MLM) and a novel Masked Position Modeling (MPM).
Local 1D Position Encoding
Unlike previous models that number tokens sequentially across an entire page (e.g., 1 to 512), LayoutMask utilizes local 1D positions. In this scheme, the position counter restarts at "1" for every individual text segment. This forces the model to rely on 2D coordinates and semantic context to infer the global structure, making it significantly more robust to segment-level ordering errors.
Layout-Aware Masking (LAM) and Masked Position Modeling (MPM)
Standard masking often ignores the structural boundaries of text segments. LayoutMask introduces Layout-Aware Masking (LAM), which prioritizes masking the first and last words of segments to encourage the model to learn cross-segment relationships. Additionally, Masked Position Modeling (MPM) requires the model to predict the missing 2D bounding boxes of masked tokens, further tightening the coupling between text and spatial layout.
Experimental Evaluation
The model was pre-trained on a subset of 10 million document pages from the IIT-CDIP collection and evaluated on four major benchmarks:
- FUNSD: Form understanding and spatial layout.
- CORD: Receipt post-OCR parsing.
- SROIE: Information extraction from receipts.
- RVL-CDIP: Document image classification.
Results and Discussion
LayoutMask achieved state-of-the-art (SOTA) performance across several benchmarks. Notably, it reached an F1 score of 93.20% on FUNSD, surpassing previous leaders like ERNIE-Layout and significantly outperforming LayoutLMv3. It also demonstrated high accuracy on CORD (97.19%) and SROIE (97.27%).
A key finding is the model's robustness to "segment swaps." By removing global 1D positions, LayoutMask maintains performance even when OCR engines detect text blocks out of order—a scenario where traditional models typically fail. Furthermore, despite lacking a raw image modality, LayoutMask outperformed several "Text+Layout+Image" models on entity extraction, suggesting that structural text relationships are often more critical than visual pixels for these tasks.
Conclusion
LayoutMask demonstrates that removing the "shortcut" of global reading order forces multi-modal models to develop a deeper, more robust understanding of document layouts. While it currently lacks an image modality—limiting its performance on purely visual classification tasks like RVL-CDIP—its success in structured text extraction marks a significant advancement in document AI. Future work may explore integrating lightweight visual features to create a more comprehensive multi-modal understanding.
Summary updated