PARAGRAPH2GRAPH: A GNN-based framework for layout paragraph analysis

Shu Wei, Nuo XuarXiv 2023 · DOI

Introduction

Document Layout Analysis (DLA) is the critical task of identifying and categorizing structural regions within a document, such as titles, paragraphs, tables, and figures. This process is foundational for automated document understanding. Currently, the field is dominated by two primary paradigms: Transformer-based models (e.g., LayoutLM) and Object Detection models (e.g., Faster-RCNN).

While effective, these approaches face significant hurdles. Transformer-based models are often "language-hungry," requiring specific tokenizers and massive multilingual datasets to generalize across different languages. Furthermore, their quadratic sequence length constraints make processing long documents computationally expensive. Conversely, image-based object detection models often struggle with "vague boundaries," where text boxes overlapping predicted regions lead to ambiguous labeling.

The Graph-Based Approach

Paragraph2Graph introduces a language-independent framework that reframes DLA as a graph problem rather than a natural language or computer vision task. By modeling the spatial relationships between OCR-detected text boxes using Graph Neural Networks (GNNs), the framework achieves state-of-the-art results with a significantly smaller footprint—approximately 20 million parameters—and zero reliance on language-specific semantics.

The Paragraph2Graph pipeline, showing the transformation of document layout into a sparse graph for node and edge classification.

Methodology

The Paragraph2Graph pipeline focuses on mapping document structure through several key stages:

  1. Node Definition: Each OCR-detected text box serves as a node. Features are extracted using a pre-trained ResNet backbone for visual context and combined with 2D coordinates. Notably, no text content is utilized, ensuring the model remains language-agnostic.
  2. Graph Sampling: To maintain efficiency, the model avoids a fully-connected graph. Instead, it employs a location-based search, connecting each box to its nearest neighbors in four cardinal directions to create a sparse graph.
  3. GNN Module: A Dynamic Graph CNN (DGCNN) is used to update node features, refreshing the graph structure dynamically across network layers.
  4. Edge Definition: The model incorporates "relationship proposals" and Relative Positional Encoding (ROPE) to capture reading order and spatial offsets between boxes.
  5. Task-Specific Probes: Linear layers perform node classification (identifying the box type) and edge classification (determining if two boxes belong to the same paragraph).
A detailed view of the graph representation, where text lines are nodes and spatial relationships are modeled as edges for paragraph grouping.

Key Insights and Efficiency

A primary finding of this research is that structural layout often supersedes semantics in DLA. By ignoring text content, Paragraph2Graph avoids the bottleneck of multilingual tokenization. Experiments demonstrated that a model trained on Chinese documents generalized exceptionally well to English sets, suggesting that document "grammar" is a universal structural language.

Furthermore, the model's efficiency is a major advantage for industrial deployment. While many Transformer models require hundreds of millions of parameters, Paragraph2Graph achieves competitive performance with only 19.95 million parameters.

Experimental Results

The framework was evaluated across three major benchmarks:

  • DocLayNet: On this complex dataset, the model achieved a paragraph mAP of 0.771, outperforming larger models like YOLO-v5x6.
  • PubLayNet: The model reached an mAP of 0.954 for Text and 0.913 for Titles, surpassing several heavy-duty object detection baselines.
  • FUNSD: In entity linking tasks, Paragraph2Graph outperformed LayoutLMv2 and BROS, demonstrating the superiority of spatial graph modeling for connecting related entities in scanned forms.

Conclusion and Future Work

Paragraph2Graph offers a robust, efficient, and language-agnostic solution for paragraph-level layout analysis. While it currently faces challenges with highly complex tables and figures, future work aims to explore advanced GNN architectures and visual backbone pre-training using Masked Autoencoders (MAE) to further enhance fine-grained feature capture.

Summary updated

BibTeX
@misc{wei2023paragraph,
  author = {Shu Wei and Nuo Xu},
  title = {{PARAGRAPH2GRAPH: A GNN-based framework for layout paragraph analysis}},
  year = {2023},
  eprint = {2304.11810},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.11810},
}
Figure