Fast-StrucTexT: An Efficient Hourglass Transformer with Modality-guided Dynamic Token Merge for Document Understanding

Mingliang Zhai, Yulin Li, Xiameng Qin, Chen Yi, Qunyi Xie, Chengquan Zhang, Kun Yao, Yuwei Wu, Yunde Jia

Abstract

Transformers achieve promising performance in document understanding because of their high effectiveness and still suffer from quadratic computational complexity dependency on the sequence length. General efficient transformers are challenging to be directly adapted to model document. They are unable to handle the layout representation in documents, e.g. word, line and paragraph, on different granularity levels and seem hard to achieve a good trade-off between efficiency and performance. To tackle the concerns, we propose Fast-StrucTexT, an efficient multi-modal framework based on the StrucTexT algorithm with an hourglass transformer architecture, for visual document understanding. Specifically, we design a modality-guided dynamic token merging block to make the model learn multi-granularity representation and prunes redundant tokens. Additionally, we present a multi-modal interaction module called Symmetry Cross-Attention (SCA) to consider multi-modal fusion and efficiently guide the token mergence. The SCA allows one modality input as query to calculate cross attention with another modality in a dual phase. Extensive experiments on FUNSD, SROIE, and CORD datasets demonstrate that our model achieves the state-of-the-art performance and almost 1.9x faster inference time than the state-of-the-art methods.

Introduction

Visually Rich Document Understanding (VRDU)—the task of extracting information from forms, receipts, and invoices—is computationally demanding. While Transformer-based models have set new benchmarks in this field, their quadratic computational complexity relative to sequence length remains a significant bottleneck for real-time applications. Existing "efficient" Transformers often struggle with documents because they fail to account for the multi-granularity nature of layouts, where information is organized into words, lines, and paragraphs. Fast-StrucTexT addresses these challenges by introducing an hourglass architecture that dynamically prunes redundant tokens using cross-modal guidance.

Methods

Fast-StrucTexT introduces three core innovations to balance efficiency and accuracy:

  1. Hourglass Transformer Architecture: The model utilizes "Merging-Blocks" (M-Blocks) to progressively compress sequence length in the middle layers and "Extension-Blocks" (E-Blocks) to restore it. This "hourglass" shape allows the model to perform heavy computation on a condensed representation while maintaining token-level granularity for final predictions via skip-connections.
  2. Modality-guided Dynamic Token Merging: Instead of simple pooling, the model uses visual layout features to guide the merging of text tokens. By identifying tokens that belong to the same semantic or visual unit (e.g., words in a single address line), the model can prune redundancy effectively without losing critical detail.
  3. Symmetry Cross-Attention (SCA): To facilitate this guidance, the authors developed SCA, a dual-path module where text and vision modalities query each other. This ensures that the token merging process is informed by a deep, multi-modal understanding of the document's structure.
Visualization of word-segment correlation illustrating how tokens are merged based on semantic and layout units.

Key Results

The model was pre-trained on the massive IIT-CDIP dataset (11 million scanned pages) and evaluated on several standard VRDU benchmarks, including FUNSD, SROIE, and CORD.

Comparison of Speed (FPS) vs. F-score (%) on the FUNSD dataset. Fast-StrucTexT (Ours) demonstrates a superior trade-off compared to models like LayoutLMv3 and DocFormer.
  • Efficiency: Fast-StrucTexT achieved an inference speed of 94.64 FPS, making it roughly 1.9× faster than the original StrucTexT and significantly outperforming LayoutLMv3 in throughput.
  • Accuracy: On the FUNSD entity labeling task, it achieved a 90.35% F1 score, surpassing LayoutLMv3 (90.29%) and DocFormer (83.34%).
  • Scalability: Ablation studies showed that as the input sequence length increases (e.g., to 8192 tokens), the FLOPs reduction reaches up to 72% compared to a vanilla Transformer.

Conclusion

Fast-StrucTexT demonstrates that document understanding can be both highly accurate and efficient by leveraging the inherent redundancy in document layouts. By using an hourglass architecture and modality-guided merging, the model achieves state-of-the-art results with significantly lower latency. Future work may explore fully adaptive sequence lengths and extending this efficiency to generative document tasks.

Summary updated

BibTeX
@inproceedings{zhai2023fast,
  author = {Mingliang Zhai and Yulin Li and Xiameng Qin and Chen Yi and Qunyi Xie and Chengquan Zhang and Kun Yao and Yuwei Wu and Yunde Jia},
  title = {{Fast-StrucTexT: An Efficient Hourglass Transformer with Modality-guided Dynamic Token Merge for Document Understanding}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  url = {https://openreview.net/forum?id=eJQZA80mc8},
}
Figure