FORTAP: Using Formulae for Numerical-Reasoning-Aware Table Pretraining

Zhoujun Cheng, Haoyu Dong, Fan Cheng, Ran Jia, Pengfei Wu, Shi Han, Dongmei Zhang

Abstract

Large Language Models (LLMs) often struggle with tabular data, particularly when complex numerical reasoning is required. This paper presents FORTAP (FORmula-driven TAble Pretraining), a framework that utilizes millions of real-world spreadsheet formulas as a form of self-supervision. By treating formulas as explicit maps of numerical relationships, FORTAP learns to identify cell dependencies and mathematical operations. Our results show that FORTAP achieves state-of-the-art performance on table question answering and formula prediction benchmarks, demonstrating the power of formulas as a rich source of supervision for table understanding.

Introduction

While LLMs excel at natural language processing, their performance on tabular data remains limited by the need for spatial and numerical reasoning. Understanding a table requires more than just reading cell values; it necessitates an understanding of the relationships between them—for example, recognizing that a "Total" cell aggregates specific rows or that a "% Change" column is derived from multi-year data.

Existing approaches often rely on synthetic data or manual annotations, which are costly and frequently fail to capture the hierarchical complexity of real-world spreadsheets. FORTAP addresses this gap by leveraging the millions of formulas embedded in publicly available spreadsheets. These formulas provide "ground truth" labels for how numerical reasoning should be applied in context, offering a massive, untapped resource for pretraining.

Methodology

FORTAP is built upon the TUTA architecture, which utilizes tree-based attention to capture complex table layouts. The framework introduces three novel pretraining objectives designed to instill numerical reasoning capabilities:

  1. Numerical Reference Prediction (NRP): This task requires the model to predict which headers or cells are referenced by a given formula. This teaches the model the spatial logic of tables, such as the typical relationship between a formula and its source data in the same row or column.
  2. Numerical Calculation Prediction (NCP): Given a group of cells, the model must predict the mathematical operator (e.g., +, -, SUM, AVERAGE) used to calculate a result. This forces the model to learn the mathematical semantics of tabular data.
  3. Formula Masked Language Modeling (MLM): Similar to BERT's pretraining, FORTAP masks portions of a formula's token sequence and tasks the model with recovering them, thereby learning the "grammar" of spreadsheet logic.
The three novel pretraining objectives of FORTAP: Numerical Reference Prediction, Numerical Calculation Prediction, and Formula MLM.

Furthermore, the authors implement a table-text joint reasoning task during pretraining. By inserting formula-related prompts into the input, the model learns to align natural language queries with specific tabular structures and data points.

Datasets and Evaluation

The FORTAP model was pretrained on a corpus of 4.5 million high-quality tables containing 10.8 million formulas, crawled from public spreadsheets. The model's performance was evaluated on several key benchmarks:

  • Enron: A dataset of real-world Excel spreadsheets used for formula prediction.
  • HiTab: A benchmark for table question answering (QA) involving hierarchical web tables.
  • DeEx: A dataset for cell type classification, identifying headers, data, and derived values.

Key Results and Insights

FORTAP achieved significant improvements over previous state-of-the-art (SOTA) models across all evaluation tasks. On the Enron dataset, FORTAP reached 55.8% top-1 accuracy for formula prediction, outperforming the previous best model (TUTA) by 7.3%. In Table QA on the HiTab benchmark, the model delivered a +6.3% improvement in execution accuracy, demonstrating its superior ability to handle complex, hierarchical structures.

Overview of the FORTAP pipeline from large-scale pretraining to downstream task fine-tuning.

A key insight from the research is that headers act as semantic anchors. Predicting relationships between headers (e.g., "% Increase" referencing "2016" and "2021") proved more effective than using raw cell coordinates, allowing the model's numerical reasoning to generalize more effectively across different table layouts.

Conclusion

FORTAP demonstrates that spreadsheet formulas are a highly effective source of "free" supervision for training models in numerical reasoning. By explicitly modeling the relationships and calculations defined by formulas, FORTAP bridges the gap between text-based language models and the structured, numerical world of spreadsheets. Future work will explore expanding the model's functional scope to include logical and text-based spreadsheet functions, as well as scaling the pretraining data to further enhance performance.

Summary updated

BibTeX
@inproceedings{cheng2022fortap,
  author = {Zhoujun Cheng and Haoyu Dong and Fan Cheng and Ran Jia and Pengfei Wu and Shi Han and Dongmei Zhang},
  title = {{FORTAP: Using Formulae for Numerical-Reasoning-Aware Table Pretraining}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.acl-long.82},
}
Figure