A Graphical Approach to Document Layout Analysis

Jilin Wang, Michael Krumdick, Baojia Tong, Hamima Halim, Maxim Sokolov, Vadym Barda, Delphine Vendryes, Chris Tanner

Abstract

Document layout analysis (DLA) is the task of detecting the distinct, semantic content within a document and correctly classifying these items into an appropriate category (e.g., text, title, figure). DLA pipelines enable users to convert documents into structured machine-readable formats that can then be used for many useful downstream tasks. Most existing state-of-the-art (SOTA) DLA models represent documents as images, discarding the rich metadata available in electronically generated PDFs. Directly leveraging this metadata, we represent each PDF page as a structured graph and frame the DLA problem as a graph segmentation and classification problem. We introduce the Graph-based Layout Analysis Model (GLAM), a lightweight graph neural network competitive with SOTA models on two challenging DLA datasets - while being an order of magnitude smaller than existing models. In particular, the 4-million parameter GLAM model outperforms the leading 140M+ parameter computer vision-based model on 5 of the 11 classes on the DocLayNet dataset. A simple ensemble of these two models achieves a new state-of-the-art on DocLayNet, increasing mAP from 76.8 to 80.8. Overall, GLAM is over 5 times more efficient than SOTA models, making GLAM a favorable engineering choice for DLA tasks.

Introduction

Document Layout Analysis (DLA) is a critical step in document processing, involving the identification and classification of semantic regions such as titles, paragraphs, tables, and figures. While current state-of-the-art (SOTA) models typically treat DLA as a computer vision (CV) task, this "pixels-only" approach is often computationally expensive and ignores the rich metadata inherent in "born-digital" PDFs. Models like LayoutLMv3 or YOLOv5 often exceed 130 million parameters, leading to high latency and operational costs.

To address these inefficiencies, we propose the Graph-based Layout Analysis Model (GLAM). By representing document pages as structured graphs, GLAM utilizes metadata such as font types, exact text locations, and character densities. This approach allows for a significantly more lightweight model that maintains high accuracy by focusing on the structural relationships between document objects.

The transformation of a document into a structured graph network for analysis.

Methodology

GLAM frames the DLA problem as a joint task of graph segmentation and node classification. The process begins with Graph Generation, where a PDF parser extracts text boxes as nodes. Each node is assigned 79 features, including spatial coordinates and font characteristics. Edges are then established between a node and its nearest neighbors across four directions, supplemented by edges following the natural reading order.

The GLAM Architecture

The core of GLAM is a Graph Neural Network (GNN) utilizing Topology Adaptive Graph (TAG) convolutional layers to process spatial relationships. To capture visual nuances not present in text metadata (such as background colors or lines), a small ResNet-18 feature extractor is integrated to provide visual context for each text box.

The GNN workflow, illustrating how node and edge embeddings are used for classification and clustering into a final document layout.

Joint Learning and Inference

The model employs a multi-task loss function to simultaneously predict node categories (e.g., "header") and edge relationships (whether an edge connects elements of the same semantic group). During inference, "negative" edges are pruned, and the remaining connected components are used to cluster text boxes into final layout segments.

Experimental Results

GLAM was evaluated on two major benchmarks: DocLayNet, a diverse dataset of 80,863 human-annotated pages, and PubLayNet, a large-scale collection of biomedical articles.

  • Performance and SOTA: On DocLayNet, an ensemble of GLAM and YOLOv5x6 achieved a new state-of-the-art mean Average Precision (mAP) of 80.8, surpassing the previous best of 76.8.
  • Efficiency: GLAM is remarkably efficient, featuring only 4 million parameters. It operates 5 times faster than YOLOv5x6 and over 60 times faster than LayoutLMv3, processing nearly 100 pages per second on a standard T4 GPU.
  • Class-Specific Accuracy: Despite its size, GLAM outperformed the 140M-parameter YOLO model on 5 of 11 DocLayNet classes, showing particular strength in identifying small, text-based elements like headers and footers.

Discussion and Conclusion

GLAM demonstrates that for text-heavy, digital documents, spatial arrangement and metadata are often more predictive than raw pixels. While graph-based models excel at structured text, they can struggle with "vision-rich" content like complex figures or tables where text is sparse. Furthermore, the model's performance is tied to the quality of the underlying PDF parser and the alignment of ground-truth data.

In conclusion, GLAM offers a highly efficient, high-performance alternative to traditional CV-based DLA models. Its complementary strengths when paired with vision models suggest that a hybrid approach—leveraging both structural metadata and visual features—is the most robust path forward for complex document understanding.

Summary updated

BibTeX
@inproceedings{wang2023graphical,
  author = {Jilin Wang and Michael Krumdick and Baojia Tong and Hamima Halim and Maxim Sokolov and Vadym Barda and Delphine Vendryes and Chris Tanner},
  title = {{A Graphical Approach to Document Layout Analysis}},
  booktitle = {ICDAR},
  year = {2023},
  url = {https://openreview.net/forum?id=ecBekCg6O3},
}
Figure