# GLAM: A Graphical Approach to Document Layout Analysis

> Research notes on GLAM, a lightweight graph neural network that frames document layout analysis as graph segmentation and node classification on parsed PDF metadata, achieving competitive results with 35x fewer parameters than vision-based SOTA.

- Authors: Hunter Heidenreich
- Published: 2026-03-14
- Updated: 2026-03-15
- Paper: Preprint (arXiv) <https://arxiv.org/abs/2308.02051>
- Paper: Published (ICDAR 2023) <https://doi.org/10.1007/978-3-031-41734-4_4>
- Source: Bevaya Labs, <https://labs.bevaya.ai/>

---


## TL;DR

GLAM (Graph-based Layout Analysis Model) represents PDF pages as structured graphs built from parsed text-box metadata and frames document layout analysis as joint node classification and graph segmentation. At 4M parameters, GLAM is over 35$\times$ smaller than the SOTA vision models it competes with, outperforming YOLO v5x6 on 5 of 11 DocLayNet classes. A simple ensemble of GLAM and YOLO v5x6 improved the best reported DocLayNet mAP from 76.8 to 80.8.

## What kind of paper is this?

**Dominant:** $\Psi\_{\text{Method}}$ : The headline contribution is a new problem formulation (DLA as graph segmentation + node classification on parsed PDF metadata) and a corresponding GNN architecture. Ablations, SOTA comparisons, and an efficiency analysis dominate the experimental sections.

**Secondary:** $\Psi\_{\text{Evaluation}}$ : The paper includes a detailed analysis of where graph-based methods succeed and fail relative to vision-based detectors, with per-class breakdowns and a thorough discussion of bounding-box misalignment artifacts in PubLayNet that systematically degrade parser-based approaches.

## What is the motivation?

Most DLA models treat document pages as images and apply standard object detection (Faster R-CNN, YOLO, DETR). This discards the structured metadata available in born-digital PDFs: exact character positions, font information, bounding boxes, and rendering instructions. These metadata features are both precise and cheap to extract relative to image-based inference.

Prior graph-based work in document understanding focused narrowly on table extraction or used CV-derived primitives. The authors argue that a pure-graph formulation operating on PDF-parsed text boxes can be competitive with much larger vision models while being an order of magnitude more efficient.

## What is the novelty?

### Graph Formulation

Each PDF page is parsed into text boxes (via pdfminer.six), where each box becomes a graph node with a 79-dimensional feature vector (bounding box coordinates, text length, fraction of numerical characters, font type, font size, and other heuristics). Bidirectional edges connect each node to its nearest neighbor in four cardinal directions, plus additional edges approximating reading order (top-to-bottom, left-to-right).

### Architecture

GLAM has two components:

1. **Graph Network** (~1M params): TAG convolutional layers with batch normalization, producing node embeddings. A separate edge embedding is formed by concatenating source/destination node embeddings with edge features. Two classification heads predict node class (segment type) and edge label (same-segment or not).

2. **CV Feature Extractor** (~3M params): A ResNet-18 renders the page as an image, extracts ROI-pooled visual features per text box, and fuses them with graph features via a three-layer attention encoder. This addresses the graph's blindness to non-textual visual cues (lines, colors, backgrounds).

### Training Objective

The model is trained with a weighted joint loss:

$$L = L\_{node} + \alpha L\_{edge}$$

where both terms are cross-entropy losses and $\alpha = 4$ upweights the edge classification to improve segmentation quality.

### Inference

At inference, negative edges are removed from the graph. Connected components define segments. Each segment is classified by majority vote over its constituent nodes. The bounding box is the minimum spanning box of the segment's nodes, with confidence equal to the mean class probability.

## What experiments were performed?

### Datasets

| Dataset | Pages | Classes | Annotation |
| :--- | :--- | :--- | :--- |
| DocLayNet | 80,863 | 11 | Human-drawn, text-box-snapped |
| PubLayNet | 358,353 | 5 | Auto-generated (XML/PDF matching) |

DocLayNet was the primary evaluation target due to its diverse layouts (financial reports, manuals, scientific articles, laws, patents, tenders). PubLayNet's auto-generated bounding boxes are known to misalign with underlying text boxes, imposing a hard upper bound on parser-based methods.

### Baselines

Mask R-CNN (ResNet-50, ResNet-101), Faster R-CNN (ResNet-101), YOLO v5x6, LayoutLMv3, MBC, and VSR.

### Ablations

CV feature ablation (Tables 3-4): Removing the ResNet-18 visual branch drops the GNN-only variant (GLAM-CV, ~1M params) to 59.9 mAP on DocLayNet (vs. 68.6 for full GLAM), with the largest drops on visually complex classes like formula ($-22.8$) and list item ($-15.2$). On PubLayNet (visually simple layouts), the drop is minimal ($-1.2$).

### Metric

COCO-style mAP at IoU thresholds [0.5:0.95].

## What are the outcomes/conclusions?

### DocLayNet Results

GLAM (4M params) achieves 68.6 overall mAP vs. 76.8 for YOLO v5x6 (140.7M params). However, GLAM outperforms all baselines on 5 of 11 classes: formula (66.6), page footer (86.2), page header (78.0), section header (79.8), and title (85.1). These are all text-dense, small-region classes where pixel-perfect bounding boxes from parsed text boxes give an advantage.

The ensemble of GLAM + YOLO v5x6 (taking the per-class best) achieves 80.8 mAP, a new SOTA at the time of publication. The complementarity is clear: GLAM excels on text-based classes while YOLO handles vision-rich classes (picture: 77.1 vs. 5.7, table: 86.3 vs. 56.3).

### PubLayNet Results

GLAM achieves 72.2 overall mAP (vs. 95.1 for LayoutLMv3 SOTA), significantly handicapped by bounding-box misalignment. At IoU 0.5 only, GLAM exceeds 90 mAP on all text classes, demonstrating that the model correctly identifies segments but cannot match misaligned ground-truth boxes at stricter thresholds.

### Efficiency

| Model | Params | GPU Inference | CPU Inference | Pages/sec (GPU) |
| :--- | :--- | :--- | :--- | :--- |
| LayoutLMv3 | 133M | 687 ms | 6,100 ms | 1.5 |
| YOLO v5x6 | 140.7M | 56 ms | 179 ms | 17.8 |
| GLAM | 4M | 10 ms | 16 ms | 98.0 |
| GLAM-CV (GNN only) | 1M | 4 ms | 9 ms | 243.9 |

All benchmarked on NVIDIA Tesla T4 (AWS G4 instance). GLAM processes ~98 pages/sec on GPU and ~64 pages/sec on CPU, making on-device deployment feasible.

### Limitations

- **No scanned document support**: GLAM requires born-digital PDFs with parseable text boxes. It cannot handle scanned documents or image-only PDFs.
- **Vision-rich classes fail**: Picture mAP is 5.7 on DocLayNet; table mAP is 56.3. Any element not well-represented by text boxes is poorly captured.
- **Parser dependency**: Performance is bounded by PDF parser quality. Different parsers produce different text boxes, and the graph construction is sensitive to this.
- **No text embeddings**: GLAM does not use any semantic text features; adding text embeddings is noted as future work.
- **PubLayNet misalignment**: The auto-generated PubLayNet annotations penalize parser-based methods systematically, making cross-method comparisons on that dataset unfair.

## Reproducibility

### Models

- GNN: TAG convolutional layers, 512-dim hidden (PubLayNet) or 1024-dim hidden (DocLayNet), scaling down by 2$\times$ per layer. Batch normalization on node features.
- CV branch: ResNet-18 backbone with ROI-average-pooling, followed by a 3-layer attention encoder.
- Total: ~4M parameters (full), ~1M (GNN only).
- No official code or weights released by the authors (Kensho Technologies).

### Algorithms

- Joint cross-entropy loss on node and edge classification with edge weight $\alpha = 4$.
- Segment inference via connected components after negative-edge removal, with majority-vote classification.
- No details reported on: optimizer, learning rate, batch size, number of epochs, warmup, gradient clipping, or augmentation.

### Data

- DocLayNet: publicly available, human-annotated, text-box-snapped ground truth. Standard train/dev/test splits (69,375 / 6,489 / 4,999).
- PubLayNet: publicly available, auto-generated annotations. Standard splits (~335K / 11K / 11K).
- Graph construction uses 79 node features extracted from parsed text boxes plus heuristic edges (nearest neighbor in four directions + reading order).

### Evaluation

- COCO-style mAP at IoU [0.5:0.95], reported per-class and overall.
- No error bars, significance tests, or multi-run statistics.
- The ensemble result (80.8 mAP) is a simple per-class max of two independent models, not a trained fusion.
- The PubLayNet comparison is acknowledged as unfair to parser-based methods due to annotation misalignment.

### Hardware

- All inference benchmarks on NVIDIA Tesla T4 (AWS G4 instance).
- Training hardware not reported. No GPU-hours, memory requirements, or training time estimates.

## BibTeX

```bibtex
@inproceedings{wang2023glam,
  title={A Graphical Approach to Document Layout Analysis},
  author={Wang, Jilin and Krumdick, Michael and Tong, Baojia and Halim, Hamima and Sokolov, Maxim and Barda, Vadym and Vendryes, Delphine and Tanner, Chris},
  booktitle={International Conference on Document Analysis and Recognition (ICDAR)},
  pages={57--75},
  year={2023},
  publisher={Springer},
  doi={10.1007/978-3-031-41734-4_4}
}
```


