Introduction
Visually Rich Document Understanding (VrDU)—the task of extracting structured information from forms, receipts, and PDFs—is a cornerstone of modern document processing. While recent multimodal Transformers like LayoutLM have made significant strides, they primarily focus on fine-grained elements: individual words and small image patches. This approach often overlooks the "forest" for the "trees," missing the high-density semantic information contained in coarse-grained structures like phrases, paragraphs, and distinct visual regions.
In this paper, the authors introduce ERNIE-mmLayout, a novel framework that prioritizes these coarse-grained elements. By modeling documents as multi-grained graphs and incorporating common-sense knowledge, the model achieves state-of-the-art performance while maintaining a significantly smaller parameter footprint than its predecessors.
The mmLayout Framework
The core innovation of mmLayout is its "sandwich" architecture, which facilitates the flow of information between different levels of granularity. The process is divided into four primary stages:
1. Document Graph Construction
The model represents a document as a complex graph consisting of four distinct node types:
- Fine-grained Text: Individual words.
- Fine-grained Visual: Small image patches.
- Coarse-grained Text: Segments or phrases.
- Coarse-grained Visual: Salient regions such as paragraphs or tables.
2. Unsupervised Salient Region Detection
To identify coarse visual regions without the need for expensive manual bounding-box labels, the authors utilize DBSCAN clustering. This algorithm groups text segments based on their physical proximity. The underlying assumption is that high-density text clusters naturally represent the most important visual blocks of a document.
3. Common Sense Enhancement
To provide the model with semantic anchors, the authors integrate an off-the-shelf NLP tool (spaCy) to detect entities such as "PERSON," "ORG," or "DATE." These entities are converted into embeddings and fused into the coarse-grained nodes, allowing the model to leverage external linguistic knowledge during the understanding process.
4. The Multi-grained Transformer
The Transformer architecture itself is designed to handle this hierarchy through three specific steps:
- Cross-grained Aggregation: Pooling fine-grained data into coarse-grained nodes.
- Coarse-grained Encoding: Modeling the relationships between large blocks and phrases to capture global context.
- Cross-grained Fusion: Merging this high-level context back into the fine-grained nodes to refine final predictions.
Experimental Results
The model was evaluated against four standard benchmarks: FUNSD (form understanding), CORD (receipt parsing), SROIE (information extraction), and DocVQA (visual question answering).
Performance and Efficiency
ERNIE-mmLayout achieved state-of-the-art (SOTA) results across all tasks:
- FUNSD: Achieved an F1 score of 86.49%, surpassing the previous SOTA by 1.3%.
- CORD & SROIE: Reached F1 scores of 97.38% and 97.91%, respectively.
- DocVQA: Achieved an ANLS score of 0.8366, demonstrating strong reasoning capabilities.
One of the most significant findings was the model's efficiency. The mmLayout-base model (approximately 236M parameters) outperformed the LayoutLMv2-large model (426M parameters) on the FUNSD dataset. This suggests that structural inductive biases—specifically the ability to understand document hierarchy—are more valuable than raw parameter count in VrDU tasks.
Key Insights
- Hierarchy as a Regularizer: Forcing the model to understand how words cluster into segments makes it more robust to OCR errors and complex layouts.
- Density as Importance: Using density-based clustering (DBSCAN) is an effective, unsupervised method for gaining layout awareness without human intervention.
- Ablation Success: Removing the "Cross-grained Aggregation" component led to a significant performance drop (from 0.8602 to 0.8276 on FUNSD), proving that the interaction between scales is the primary driver of the model's success.
Conclusion and Future Work
ERNIE-mmLayout demonstrates that multi-grained modeling is essential for capturing the consistent semantics of complex documents. While the current model relies heavily on textual layout for region detection, future iterations may incorporate more raw visual features—such as colors, lines, and textures—to further improve accuracy on image-heavy documents. Additionally, the authors aim to make the coarse-grained view adaptive to specific queries in Question Answering tasks.
Summary updated