LayoutLLM: Layout Instruction Tuning with Large Language Models for Document Understanding

Chuwei Luo, Yufan Shen, Zhaoqing Zhu, Qi Zheng, Zhi Yu, Cong YaoCVPR 2024

Abstract

Recently, leveraging large language models (LLMs) or multimodal large language models (MLLMs) for document understanding has been proven very promising. However, previous works that employ LLMs/MLLMs for document understanding have not fully explored and utilized the document layout information, which is vital for precise document understanding. In this paper, we propose LayoutLLM, an LLM/MLLM based method for document understanding. The core of LayoutLLM is a layout instruction tuning strategy, which is specially designed to enhance the comprehension and utilization of document layouts. The proposed layout instruction tuning strategy consists of two components: Layout-aware Pre-training and Layout-aware Supervised Fine-tuning. To capture the characteristics of document layout in Layout-aware Pre-training, three groups of pretraining tasks, corresponding to document-level, region-level and segment-level information, are introduced. Furthermore, a novel module called layout chain-of-thought (LayoutCoT) is devised to enable LayoutLLM to focus on regions relevant to the question and generate accurate answers. LayoutCoT is effective for boosting the performance of document understanding. Meanwhile, it brings a certain degree of interpretability, which could facilitate manual inspection and correction. Experiments on standard benchmarks show that the proposed LayoutLLM significantly outperforms existing methods that adopt open-source 7B LLMs/MLLMs for document understanding.

Introduction

While Large Language Models (LLMs) like GPT-4 have demonstrated remarkable capabilities, they often struggle with document understanding. Documents are inherently visual and hierarchical; their meaning is derived not just from text, but from spatial structure. For instance, the interpretation of a table depends on row and column alignment, and a form's value is defined by its proximity to a specific label.

Existing Multimodal LLMs (MLLMs) typically treat documents as either a sequence of text with coordinates or as raw images. These approaches often fail to capture nuanced, multi-level relationships—from global layout down to specific segments. Furthermore, most models lack interpretability, making it difficult to diagnose whether a failure stems from misreading text or misidentifying relevant document regions.

Methodology

LayoutLLM bridges the gap between spatial document encoders and general-purpose LLMs through a specialized architecture and a two-stage instruction tuning strategy.

Architecture

The framework utilizes LayoutLMv3 as its visual and textual encoder, paired with Vicuna-7B as the reasoning engine. Two Multilayer Perceptron (MLP) projectors map document features into the LLM's embedding space, allowing the model to process both visual layout and textual content simultaneously.

Comparison of model architectures and training paradigms.

Layout Instruction Tuning

The core innovation is a two-stage training process designed to instill a "spatial grammar" in the LLM:

  1. Stage 1: Layout-aware Pre-training: The model is trained on diverse tasks across three levels: document-level (e.g., generating dense descriptions), region-level (e.g., table understanding), and segment-level (e.g., calculating distances between text blocks).
  2. Stage 2: Layout-aware Supervised Fine-tuning (SFT): This stage introduces the Layout Chain-of-Thought (LayoutCoT).

Layout Chain-of-Thought (LayoutCoT)

LayoutCoT acts as a "searchlight," guiding the model through three reasoning steps:

  • Question Analysis: Identifying the question type (e.g., "This is a table problem").
  • Relevant Area Concentration: Pinpointing the specific bounding box in the document containing the answer.
  • Answer Formation: Generating the final answer based on the identified region.
Detailed view of Layout-aware Pre-training and Supervised Fine-tuning stages.

Experimental Setup

The researchers built an extensive instruction-tuning pipeline utilizing a massive collection of public datasets:

  • Pre-training Data: 5.7 million instructions derived from datasets like PubLayNet, DocLayNet, and RVL-CDIP.
  • SFT Data: 300,000 high-quality instructions generated using GPT-3.5 Turbo based on FeTaQA.
  • Evaluation: Zero-shot testing on standard benchmarks including DocVQA, VisualMRC, FUNSD, CORD, and SROIE.

Results and Discussion

LayoutLLM sets a new benchmark for open-source 7B-parameter models in the document domain:

  • Performance: On DocVQA, LayoutLLM achieved 74.27%, outperforming prominent models like mPLUG-DocOWL (62.2%) and Qwen-VL (65.1%) by approximately 10%.
  • Ablation Studies: Removing LayoutCoT led to a significant performance drop (e.g., ~6% on FUNSD), confirming that multi-step spatial reasoning is critical.
  • Interpretability: By explicitly outputting coordinates, LayoutCoT allows for interactive correction. If the model targets the wrong region, a user can provide the correct coordinates, enabling the model to revise its answer successfully.

Conclusion

LayoutLLM demonstrates that explicitly teaching LLMs about spatial structure significantly enhances document understanding. While the model currently faces challenges with extremely complex inter-region relationships and hallucination management, its hierarchical training and LayoutCoT mechanism provide a robust foundation for future research in multimodal document intelligence.

Summary updated

BibTeX
@inproceedings{luo2024layoutllm,
  author = {Chuwei Luo and Yufan Shen and Zhaoqing Zhu and Qi Zheng and Zhi Yu and Cong Yao},
  title = {{LayoutLLM: Layout Instruction Tuning with Large Language Models for Document Understanding}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  url = {https://openreview.net/forum?id=7DWQQHa6GC},
}
Figure