SheetPT: Spreadsheet Pre-training Based on Hierarchical Attention Network

Ran Jia, Qiyu Li, Zihan Xu, Xiaoyuan Jin, Lun Du, Haoyu Dong, Xiao Lv, Shi Han, Dongmei Zhang

Introduction

SheetPT is the first large-scale pre-training framework designed specifically for spreadsheets, moving beyond traditional "table-centric" models to understand entire workbooks. By introducing a novel "Coherent Chunk" structure and a hierarchical attention network, it achieves state-of-the-art results in formula prediction and structure recognition, particularly excelling at complex cross-table logic where previous models struggled.

The Challenge of Spreadsheet Understanding

While spreadsheets are the backbone of business data, they are notoriously difficult for AI to "understand." Most existing research treats spreadsheets as simple relational tables. However, real-world spreadsheets are complex: they contain multiple tables on one sheet, descriptive text outside of tables, and formulas that link distant cells.

The authors identify three core challenges:

  1. Large Input Size: A single sheet can have thousands of cells, overwhelming standard Transformer token limits.
  2. Sparse Semantics: Meaningful headers often account for only ~20% of cells, while the rest are repetitive data.
  3. Long-range Dependence: Capturing relationships between distant cells (e.g., A1 and Z100) is computationally expensive.

The SheetPT Architecture

The researchers propose SheetPT, which utilizes a Hierarchical Attention Network to process spreadsheets at three levels: tokens, cells, and "chunks."

The Hierarchical Attention Network architecture, featuring coarse-grained and fine-grained hierarchical attention layers.

Coherent Chunks

A key innovation of SheetPT is the Coherent Chunk. Instead of looking at every cell individually, the model groups homogeneous, adjacent cells (like a block of numeric data) into a single unit. This acts as a form of lossy compression that preserves semantic meaning while drastically reducing the number of units the model needs to track.

Visualization of Coherent Chunks in a spreadsheet, showing how the model identifies coarse and fine-grained structures.

Multi-Grained Attention

The model employs two types of hierarchical attention:

  • Coarse-grained: Allows chunks to "talk" to each other to obtain a global view of the sheet.
  • Fine-grained: Focuses on detailed relationships within specific rows or columns.
  • Chunk-Level Relational Attention (CLRA): Explicitly incorporates spreadsheet signals like SUM or AVERAGE functions into the attention mechanism to learn underlying calculation logic.

Experimental Setup and Results

SheetPT was pre-trained on a massive corpus of 5.85 million spreadsheets crawled from the web. The model was evaluated on formula prediction and structure recognition tasks.

  • Formula Prediction: SheetPT outperformed the previous state-of-the-art (ForTaP) by over 18% in overall accuracy.
  • The Cross-Table Breakthrough: Most impressively, while previous models had near 0% accuracy on cross-table formulas, SheetPT achieved 50.19% accuracy.
  • Structure Recognition: On the SheetSem dataset, SheetPT achieved an 87.95% Macro-F1 score, significantly outperforming tabular models like TaPas.

Key Insights

By treating the entire sheet as the input rather than just a detected table, SheetPT avoids "error accumulation" where poor table detection ruins subsequent analysis. Furthermore, the authors demonstrated that the millions of existing formulas in web-crawled spreadsheets are a goldmine for self-supervised learning, allowing the model to learn functional relationships between data points automatically.

Conclusion

SheetPT establishes a new baseline for spreadsheet AI. While currently limited by grid size (200 rows and 25 columns) and a focus on text and numbers, it serves as a foundation model for future tasks such as automated chart recommendation or financial error detection.

Summary updated

BibTeX
@inproceedings{jia2023sheetpt,
  author = {Ran Jia and Qiyu Li and Zihan Xu and Xiaoyuan Jin and Lun Du and Haoyu Dong and Xiao Lv and Shi Han and Dongmei Zhang},
  title = {{SheetPT: Spreadsheet Pre-training Based on Hierarchical Attention Network}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i11.26522},
}
Figure