ImageNet classification with deep convolutional neural networks
Alex Krizhevsky, Ilya Sutskever et al.
0
Citations
0
Influential Citations
—
Venue
2022
Year
Reorganizes tokens using layout information, combines text and visual embeddings, utilizes multi-modal transformers with spatial aware disentangled attention.
Understanding documents that mix text and visual elements—like invoices, receipts, forms, and scanned pages—is a critical challenge for AI systems. Traditional NLP models treat text as a flat sequence, ignoring spatial cues such as columns, tables, and headings. ERNIE-Layout tackles this by explicitly incorporating layout information into a multi-modal transformer, enabling the model to grasp the logical reading order and visual structure of documents. This matters because real-world documents are rarely linear; they rely on layout to convey meaning. By learning from both text and image patches with spatial awareness, ERNIE-Layout sets a new benchmark for document AI tasks.
ERNIE-Layout processes a document in three main stages: serialization, embedding, and multi-modal transformer encoding.
Serialization Module

Inspired by human reading habits, the model uses a Document-Parser (based on Layout-Parser) to detect document elements like paragraphs, lists, tables, and figures from OCR output. It then applies element-specific algorithms to determine the correct reading order, rearranging the token sequence accordingly.
Text Embedding

Text tokens are embedded using token embeddings, 1D position embeddings, and token type embeddings.
Visual Embedding

A Faster-RCNN backbone extracts visual features from the document image (resized to 224x224). An adaptive pooling layer converts the output into a 7x7 feature map, which is flattened into a visual sequence and projected to the same dimension as text embeddings.
Layout Embedding

Separate embedding layers for x-axis and y-axis coordinates (normalized to [0,1000]) capture spatial positions.
Ultimate Input Representation

The final input H combines text, visual, and layout embeddings.
Multi-modal Transformer

Inspired by DeBERTa's disentangled attention, ERNIE-Layout computes attention weights using separate matrices for content and relative spatial positions. This spatial-aware disentangled attention allows layout features to directly influence token interactions.
Pre-training Tasks
The model uses 24 transformer layers (1024 hidden units, 16 heads), initialized from RoBERTa-large, with a maximum text sequence length of 512 and 49 visual tokens.
ERNIE-Layout achieves state-of-the-art performance across several benchmarks:
These results demonstrate that incorporating layout knowledge and spatial-aware attention significantly improves document understanding compared to models that treat text and images separately.
ERNIE-Layout advances the field by showing that layout is not just an auxiliary feature but a core component for understanding visually-rich documents. Its serialization module and spatial-aware attention provide a principled way to integrate layout into transformer architectures. This work has practical implications for automating document processing in industries like finance, legal, and healthcare, where forms and receipts are ubiquitous. Future research could extend this approach to handle more complex layouts, multilingual documents, or real-time processing scenarios.
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