Abstract
DocLLM is a lightweight, layout-aware language model designed for visually rich document understanding. It avoids expensive image encoders by using a disentangled spatial attention mechanism and a block-infilling pre-training objective. Built on open-source backbones like Llama2, it achieves state-of-the-art performance on document intelligence tasks while maintaining high computational efficiency.
Introduction: The Geometry of Meaning
Enterprise documents—such as receipts, tax forms, and insurance reports—carry meaning not just in their text, but in their spatial arrangement. A numerical value's significance changes entirely depending on its proximity to labels like "Total" or "Tax ID." Standard Large Language Models (LLMs) typically treat documents as linear text streams, often losing this critical spatial context. While multimodal models exist, they often rely on heavy vision transformers to process raw pixels, leading to high computational costs. DocLLM addresses this by making LLMs "layout-aware" using only text and bounding boxes, bypassing heavy image processing.
Architecture and Methodology
DocLLM introduces two primary innovations to the standard transformer architecture to handle document layouts effectively:
Disentangled Spatial Attention
Instead of merging spatial information into text embeddings, DocLLM decomposes the attention mechanism. It computes four distinct relationship scores: text-to-text, text-to-spatial, spatial-to-text, and spatial-to-spatial. This allows the model to independently learn how word meanings relate to their positions and the positions of other elements.
Block Infilling Objective
Document layouts are often non-linear. To capture this, DocLLM uses a pre-training objective where it learns to "fill in the blanks." It masks cohesive blocks of text (e.g., an entire address field) and trains the model to reconstruct them using both preceding and succeeding context.
Training and Datasets
The model is built upon existing open-source backbones like Falcon-1B and Llama2-7B. The training pipeline consists of large-scale pre-training followed by multi-task instruction tuning.
- Pre-training: Utilized 16.7 million document pages from IIT-CDIP and DocBank.
- Instruction Tuning: Covered 16 datasets across four core tasks: Visual Question Answering (VQA), Key Information Extraction (KIE), Natural Language Inference (NLI), and Document Classification (CLS).
- New Benchmark: The researchers introduced BuDDIE, a business document dataset for multi-task information extraction.
Key Insights
- Layout as a Proxy for Vision: For many document tasks, bounding boxes provide a sufficient proxy for visual information, allowing the model to focus on semantic-spatial relationships without the noise of raw pixels.
- Bidirectional Context: The success of block-infilling suggests that document understanding requires considering context from all directions, much like solving a puzzle.
- Efficiency: By omitting a vision encoder, DocLLM maintains a low parameter count, leading to faster processing and lower hardware requirements.
Results and Performance
DocLLM-7B was evaluated in two settings: Same Dataset, Different Splits (SDDS) and Same Tasks, Different Datasets (STDD).
- State-of-the-Art Performance: In SDDS, DocLLM outperformed existing models on 14 out of 16 datasets.
- Strong Generalization: On unseen datasets (STDD), it showed improvements of 15% to 60% over base models like Llama2-7B.
- Competitive Efficiency: Despite being vision-free, it outperformed larger multimodal models like mPLUG-DocOwl on several key extraction tasks.
Limitations and Future Work
While efficient, DocLLM cannot interpret non-textual cues like logos or checkboxes without OCR labeling. It is also limited by a 1,024-token context window and depends heavily on OCR quality. Future work aims to integrate lightweight visual features to handle charts and images while preserving architectural efficiency.
Summary updated