NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ClusterTabNet: Supervised clustering method for table detection and table structure recognition

Marek Polewczyk, Marco Spinaci · DOI

Introduction

Extracting structured data from tables in documents is a foundational challenge in document analysis. Traditionally, modern approaches have treated this as a computer vision task, specifically an object detection problem. These methods typically feed high-resolution document images into heavy architectures like DETR or Faster R-CNN to predict bounding boxes for tables, rows, and cells.

However, this "vision-first" paradigm introduces significant overhead. It requires models to "re-learn" spatial relationships and text layouts that OCR engines have often already processed. Furthermore, these models are computationally intensive and can be fragile when faced with skewed, rotated, or poorly aligned document images. ClusterTabNet proposes a paradigm shift: treating table detection and structure recognition as a supervised clustering problem operating directly on OCR output.

Methodology: Tables as Graphs

Instead of treating a document as a collection of pixels, ClusterTabNet views it as a graph of related words. If the OCR output (words and their spatial coordinates) is already available, the task becomes identifying which words belong together in specific structures.

The Supervised Clustering Approach

The core innovation of ClusterTabNet is the prediction of an adjacency matrix. Rather than classifying individual words into categories, the model learns to predict the relationship between every pair of words on a page. This matrix serves as a map indicating whether two words belong to the same table, row, column, or cell.

Architecture

The model architecture is designed for efficiency and precision:

  1. Input: The system takes a list of words from an OCR engine, including text content and bounding box coordinates.
  2. Embeddings: Coordinates are normalized and embedded. To capture visual nuances like cell borders or font weights, the authors optionally include small image patches for each word processed via a lightweight CNN.
  3. Transformer Encoder: A lean, 4-layer transformer encoder processes these embeddings. This allows the model to understand global spatial and semantic relationships across the entire page.
  4. Output Heads: Multiple identical "heads" predict distinct adjacency matrices for different tasks, such as table detection, row identification, and column segmentation.

Post-Processing via Connected Components

To ensure logical consistency, the model uses a connected components algorithm. This step enforces transitivity: if the model identifies that Word A is in the same row as Word B, and Word B is in the same row as Word C, then A and C are automatically clustered together. This mathematical constraint helps correct isolated prediction errors and ensures robust cluster formation.

Key Advantages

ClusterTabNet offers several distinct advantages over traditional object-detection frameworks:

  • Orientation Invariance: Because the model focuses on the relationships between words rather than absolute pixel coordinates, it is naturally agnostic to page orientation. A table tilted at a 45-degree angle maintains the same word-to-word relationships as a horizontal one.
  • Extreme Efficiency: By leveraging the pre-processing work of OCR, ClusterTabNet is significantly smaller than its competitors. It utilizes approximately 5 million parameters, a fraction of the 29 million parameters found in popular DETR-based models.
  • Scalability: Traditional classification struggles when a page contains multiple tables because there is no intrinsic feature distinguishing "Table 1" from "Table 2." By focusing on pairwise relationships, ClusterTabNet can naturally partition a page into any number of discrete table clusters.

Experimental Results

The researchers evaluated ClusterTabNet on several rigorous benchmarks, including PubTables-1M, PubTabNet, FinTabNet, and ICDAR-2019.

The results demonstrate that a smaller, relationship-focused model can outperform massive vision models:

  • Table Detection: On the PubTables-1M dataset, ClusterTabNet achieved an Average Precision (AP) of 0.989, surpassing the state-of-the-art DETR model (0.970).
  • Structure Recognition: The model achieved an AP of 0.931 for row and column recognition, outperforming many larger, retrained models.
  • Robustness: Even when trained on clean, modern documents, the model proved resilient when applied to "noisy" historical documents, such as those in the Tobacco dataset.

Limitations and Future Work

While highly effective, ClusterTabNet has constraints. Due to the $O(n^2)$ complexity of transformers relative to input length, the model is currently optimized for documents containing up to 1,000 words. For extremely dense documents, the authors suggest a sliding-window approach using overlapping segments. Additionally, because the model relies on OCR, its performance is inherently capped by the accuracy of the underlying OCR engine.

Future iterations may explore joint modeling—combining detection and recognition into a single unified head—to further streamline runtime and memory usage, potentially setting a new standard for lightweight, high-accuracy document intelligence.

Summary updated

BibTeX
@inproceedings{polewczyk2024clustertabnet,
  author = {Marek Polewczyk and Marco Spinaci},
  title = {{ClusterTabNet: Supervised clustering method for table detection and table structure recognition}},
  booktitle = {ICDAR},
  year = {2024},
  url = {https://openreview.net/forum?id=aRYgd9PSSi},
}
Figure