High-Performance Transformers for Table Structure Recognition Need Early Convolutions

Shengyun Peng, Seongmin Lee, Xiaojing Wang, Rajarajeswari Balasubramaniyan, Duen Horng Chau

TL;DR

Table Structure Recognition (TSR) models traditionally rely on heavy CNN backbones, while pure Vision Transformers (ViTs) with linear projections suffer severe performance drops. This paper demonstrates that a lightweight "convolutional stem" (ConvStem) strikes the perfect balance—matching state-of-the-art CNN performance while cutting computational costs (MACs) nearly in half and reducing model parameters.

What Problem Does This Paper Address?

Table Structure Recognition (TSR) converts images of tables into machine-readable formats like HTML or LaTeX. Current state-of-the-art models typically use a hybrid architecture: a heavy convolutional neural network (CNN) backbone (like ResNet) as a visual encoder, paired with a Transformer textual decoder.

While effective, this hybrid setup has a major bottleneck. The complex CNN encoder accounts for nearly half of the total model parameters, significantly slowing down both training and inference. Naturally, one might wonder: why not swap the heavy CNN for a simple linear projection layer, just like a standard Vision Transformer (ViT)?

The authors show that doing so causes a massive performance drop (~6 percentage points overall, and ~8 percentage points on complex tables). This paper investigates why pure linear projections fail at TSR and proposes a lightweight alternative that doesn't sacrifice accuracy.

Methods

The authors evaluate three visual encoder options within an image-to-text TSR pipeline:

  1. Standard CNN Backbone: ResNet-18, ResNet-34, and ResNet-50 baselines.
  2. Linear Projection: A vanilla ViT-style encoder that flattens image patches directly into a sequence.
  3. Convolutional Stem (ConvStem): The proposed lightweight alternative. Instead of dozens of CNN layers, ConvStem uses a minimal stack of five stride-2, $3 \times 3$ convolutions, followed by a single $1 \times 1$ convolution to match the transformer's feature dimension.

The extracted visual features from these encoders are then fed into a standard four-layer Transformer decoder to autoregressively generate HTML table tags.

Figure 1: Using convolutional stem (ConvStem) in a visual encoder for table structure recognition (TSR) achieves performance comparable to that of a CNN backbone while significantly reducing model complexity. The CNN backbone is performant with large RF but exhibits high model com- plexity. Linear projection is the simplest but suffers in terms of performance due to limited RF and sequence length. In contrast, ConvStem strikes an optimal balance between two crucial factors for high-performance TSR: a higher receptive field (RF) ratio and a longer sequence length. We illustrate each visual encoder option’s RF (zoomed in) and compute its RF ratio. Using the image features extracted from the visual encoder, a textual decoder then generates tokens representing the table.

Datasets

The models were trained and evaluated on PubTabNet, one of the largest publicly available TSR datasets containing approximately 509,000 annotated tabular images. Performance is measured using the Tree-Edit-Distance-Based Similarity (TEDS) score, which converts HTML tags into a tree structure to compute structural accuracy.

Key Insights and Ideas

  • The RF Ratio vs. Sequence Length Tradeoff: High-performance TSR requires a delicate balance between two factors: a high Receptive Field (RF) ratio (how much of the table the model can "see" at once) and a long sequence length ($N$, the context length available to the transformer).
  • The Linear Projection Bottleneck: In a standard linear projection, the RF ratio and sequence length are inversely correlated. To get a larger receptive field, you must use larger image patches, which inherently shortens the sequence length. This restriction caps its performance.
  • Decoupling with ConvStem: Early convolutions inject a crucial inductive bias (locality). ConvStem successfully decouples the RF ratio from the sequence length. It achieves a medium-sized receptive field to capture ample context while maintaining a long sequence length for the subsequent transformer decoder.

Key Results

  • Bridging the Performance Gap: On the PubTabNet dataset, ConvStem achieved an overall TEDS score of 96.53%, slightly outperforming the ResNet-18 baseline (96.45%) and drastically beating the Linear Projection baseline (90.45%).
  • Efficiency Gains: ConvStem reduced the model's computational complexity (MACs) by 19.86G (from 42.22G down to 22.36G) and shaved off 4.62M parameters compared to ResNet-18.
  • Qualitative Superiority: Attention map visualizations revealed that ResNet-18 frequently miscounts columns in complex spanning cells, and Linear Projection exhibits scattered attention. ConvStem distributes attention evenly across complex structures, leading to perfect table reconstructions.
Cross-attention maps comparing ResNet-18, LinearProj-28, and ConvStem across different decoding steps.

Limitations and Future Work

While the paper does not include a dedicated limitations section, the authors note that simplifying the visual encoder is a crucial stepping stone for Self-Supervised Learning (SSL) in document layout analysis. Because linear projections struggle with the structural complexities of tables, ConvStem provides a lightweight, highly performant visual processor that could unlock effective SSL pre-training strategies for table representation learning in the future.

Summary updated

Abstract

Table structure recognition (TSR) aims to convert tabular images into a machine-readable format, where a visual encoder extracts image features and a textual decoder generates table-representing tokens. Existing approaches use classic convolutional neural network (CNN) backbones for the visual encoder and transformers for the textual decoder. However, this hybrid CNN-Transformer architecture introduces a complex visual encoder that accounts for nearly half of the total model parameters, markedly reduces both training and inference speed, and hinders the potential for self-supervised learning in TSR. In this work, we design a lightweight visual encoder for TSR without sacrificing expressive power. We discover that a convolutional stem can match classic CNN backbone performance, with a much simpler model. The convolutional stem strikes an optimal balance between two crucial factors for high-performance TSR: a higher receptive field (RF) ratio and a longer sequence length. This allows it to "see" an appropriate portion of the table and "store" the complex table structure within sufficient context length for the subsequent transformer. We conducted reproducible ablation studies and open-sourced our code at https://github.com/poloclub/tsr-convstem to enhance transparency, inspire innovations, and facilitate fair comparisons in our domain as tables are a promising modality for representation learning.
BibTeX
@misc{peng2023high,
  author = {Shengyun Peng and Seongmin Lee and Xiaojing Wang and Rajarajeswari Balasubramaniyan and Duen Horng Chau},
  title = {{High-Performance Transformers for Table Structure Recognition Need Early Convolutions}},
  year = {2023},
  eprint = {2311.05565},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.05565},
}
Figure