ImageNet classification with deep convolutional neural networks
Alex Krizhevsky, Ilya Sutskever et al.
0
Citations
0
Influential Citations
—
Venue
2020
Year
Uses a multi-modal Transformer model, to integrate text, layout, and image in the pre-training stage, to learn end-to-end cross-modal interaction.
Document understanding has long been a challenge because documents contain not just text but also complex layouts, images, tables, and visual cues. Traditional NLP models ignore spatial and visual information, while computer vision models miss textual semantics. LayoutLMv2 bridges this gap by jointly pre-training on text, layout, and image modalities, enabling the model to learn cross-modal interactions from scratch. This is a significant step toward truly intelligent document processing systems that can handle forms, receipts, invoices, and other visually-rich documents.
LayoutLMv2 builds on the original LayoutLM but introduces a critical change: visual information is integrated during pre-training rather than only at fine-tuning. The architecture is a multi-modal Transformer encoder that takes three types of embeddings as input.

Text Embeddings follow standard practice: WordPiece tokenization, with [CLS] and [SEP] tokens, plus token, 1D positional, and segment embeddings. The i-th text embedding is: ti = TokEmb(wi) + PosEmb1D(i) + SegEmb(si).
Visual Embeddings come from a ResNeXt-FPN CNN backbone. The page image is resized to 224×224, passed through the CNN, then average-pooled to a fixed W×H feature map. This is flattened into a sequence of visual tokens, each projected to match text embedding dimensions. A shared 1D positional embedding and a visual segment embedding [C] are added. The i-th visual embedding is: vi = Proj(VisTokEmb(I)i) + PosEmb1D(i) + SegEmb([C]).
Layout Embeddings encode bounding box coordinates from OCR. Coordinates are normalized to [0,1000] and embedded separately for x and y axes. For each token (text or visual), the layout embedding concatenates six features: xmin, xmax, ymin, ymax, width, height. The i-th layout embedding is: li = Concat(PosEmb2Dx(xmin, xmax, width), PosEmb2Dy(ymin, ymax, height)).
These three embeddings are summed and fed into a multi-modal Transformer encoder with a spatial-aware self-attention mechanism. Unlike standard self-attention which only uses absolute positions, spatial-aware attention explicitly models relative spatial relationships between tokens, crucial for understanding document layout.
The pre-training stage uses three tasks:
Pre-training uses the IIT-CDIP dataset, a large collection of scanned documents.
LayoutLMv2 is fine-tuned on six public benchmarks:
On all tasks, LayoutLMv2 achieves new state-of-the-art results, outperforming both the original LayoutLM and other multi-modal baselines. The gains are particularly notable on tasks requiring fine-grained spatial reasoning, such as form parsing and receipt extraction.
LayoutLMv2 demonstrates that joint pre-training across text, layout, and image modalities is highly effective for visually-rich document understanding. By learning cross-modal interactions from the start, the model develops a deeper understanding of document structure than models that only combine modalities at fine-tuning. The spatial-aware self-attention mechanism is a key innovation that explicitly captures relative positions, which is essential for layout-sensitive tasks. This work has practical implications for automating document processing in industries like finance, legal, and healthcare, where forms, receipts, and contracts are ubiquitous. Future work could explore extending this approach to other document types, reducing reliance on OCR, or incorporating more fine-grained visual features.
Alex Krizhevsky, Ilya Sutskever et al.
Ashish Vaswani, Noam Shazeer et al.
Douglas M. Bates, Martin Mächler et al.
Diederik P. Kingma, Jimmy Ba