Skip to main content
QUICK REVIEW

[Paper Review] DocLLM: A layout-aware generative language model for multimodal document understanding

Dongsheng Wang, Natraj Raman|arXiv (Cornell University)|Dec 31, 2023
Handwritten Text Recognition TechniquesComputer Science9 citations
TL;DR

DocLLM extends causal LLMs with disentangled spatial attention to jointly model text and layout in visual documents, using block-infilling pre-training and instruction tuning to excel on VRDU tasks without heavy vision encoders.

ABSTRACT

Enterprise documents such as forms, invoices, receipts, reports, contracts, and other similar records, often carry rich semantics at the intersection of textual and spatial modalities. The visual cues offered by their complex layouts play a crucial role in comprehending these documents effectively. In this paper, we present DocLLM, a lightweight extension to traditional large language models (LLMs) for reasoning over visual documents, taking into account both textual semantics and spatial layout. Our model differs from existing multimodal LLMs by avoiding expensive image encoders and focuses exclusively on bounding box information to incorporate the spatial layout structure. Specifically, the cross-alignment between text and spatial modalities is captured by decomposing the attention mechanism in classical transformers to a set of disentangled matrices. Furthermore, we devise a pre-training objective that learns to infill text segments. This approach allows us to address irregular layouts and heterogeneous content frequently encountered in visual documents. The pre-trained model is fine-tuned using a large-scale instruction dataset, covering four core document intelligence tasks. We demonstrate that our solution outperforms SotA LLMs on 14 out of 16 datasets across all tasks, and generalizes well to 4 out of 5 previously unseen datasets.

Motivation & Objective

  • Motivate and address the challenge of understanding visually rich documents where layout and text semantics are intertwined.
  • Develop a lightweight model that incorporates spatial layout without a heavy vision encoder.
  • Propose a disentangled spatial attention mechanism to capture cross-modal dependencies between text and bounding-box information.
  • Introduce a block-level infilling pre-training objective to handle irregular layouts and misaligned text.
  • Fine-tune the model on instruction-tuning data spanning multiple DocAI tasks to enable robust zero-shot generalization.

Proposed method

  • Extend a causal decoder LLM with a second modality representing spatial layout via bounding boxes.
  • Implement disentangled spatial attention that computes text-to-text, text-to-spatial, spatial-to-text, and spatial-to-spatial scores with dedicated projections.
  • Introduce a block infilling pre-training objective that masks random text blocks and trains the model to reconstruct them using both preceding and following context.
  • Pre-train on IIT-CDIP and DocBank document collections totaling 3.8B tokens and 16.7M pages.
  • Instruction-tune on 16 DocAI datasets across VQA, NLI, KIE, and CLS using templates to improve zero-shot performance.
  • Compare against zero-shot and instruction-tuned baselines, focusing on layout-intensive and document understanding tasks.
Figure 1: Key elements of DocLLM . (1) Input documents contain text tokens and their bounding boxes. (2) Attention mechanism of LLMs are extended to capture dependencies between text semantics and spatial layouts. (3) Infilling text blocks is used as pre-training objective. (4) Task adaptation is pe
Figure 1: Key elements of DocLLM . (1) Input documents contain text tokens and their bounding boxes. (2) Attention mechanism of LLMs are extended to capture dependencies between text semantics and spatial layouts. (3) Infilling text blocks is used as pre-training objective. (4) Task adaptation is pe

Experimental results

Research questions

  • RQ1Can a light-weight LLM augmented with layout information via bounding boxes achieve competitive VRDU performance without a vision encoder?
  • RQ2Does disentangling spatial and textual modalities in attention improve cross-modal reasoning in visually rich documents?
  • RQ3Can block-level infilling pre-training better handle irregular layouts and misaligned text in documents?
  • RQ4How well does DocLLM generalize to unseen datasets and across core DocAI tasks after instruction tuning?

Key findings

  • DocLLM-7B achieves state-of-the-art performance on 12 of 16 datasets in the SDDS setting, outperforming several baselines including some multimodal LLMs.
  • DocLLM-7B and DocLLM-1B show strong gains over non-vision-encoder baselines and competitive results against GPT-4 OCR on multiple tasks, with GPT-4 leading in some VQA cases.
  • The model excels particularly in layout-intensive tasks such as KIE and CLS, and demonstrates good generalization to held-out datasets in STDD settings.
  • Instruction-tuning on 16 DocAI datasets improves zero-shot generalization across VQA, KIE, CLS, and NLI tasks.
  • A smaller DocLLM-1B achieves performance close to the 7B variant, indicating efficiency gains from architectural design.
Figure 2: DocLLM model architecture with disentangled spatial attention and infilling objective. left : Input document with text tokens $x_{i}$ and bounding boxes $b_{i}$ . Some text segments are randomly masked (two segments here) and the model predicts the tokens in these text segments autoregress
Figure 2: DocLLM model architecture with disentangled spatial attention and infilling objective. left : Input document with text tokens $x_{i}$ and bounding boxes $b_{i}$ . Some text segments are randomly masked (two segments here) and the model predicts the tokens in these text segments autoregress

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.