Abstract
Reasoning over structured numerical data in tables is a complex task that requires both spatial awareness and mathematical logic. While Large Language Models (LLMs) excel at text processing, they often struggle with the multi-step reasoning required for tabular data. This paper presents FORTAP (FORmula-driven TAble Pretraining), a novel framework that utilizes the millions of formulas embedded in existing spreadsheets as a "free" and massive source of supervision. By pretraining on these formulas, FORTAP learns to identify cell relationships and the calculations that connect them. Our results show that FORTAP achieves state-of-the-art performance on table question answering, formula prediction, and structure analysis, significantly bridging the gap in automated numerical reasoning.
Introduction
The ability to reason over tables is critical for many real-world applications, from financial analysis to scientific research. However, tasks such as answering "What was the percentage change in revenue between 2021 and 2022?" present a dual challenge for AI models. First, the model must perform spatial reasoning to locate the correct cells within a potentially complex layout. Second, it must perform calculational reasoning to understand the mathematical relationship (e.g., subtraction and division) required to produce the answer.
Historically, progress in this area has been hindered by the high cost and error-prone nature of manually labeling tabular datasets for numerical reasoning. FORTAP overcomes this bottleneck by recognizing that the web is already populated with millions of "labeled" examples in the form of spreadsheets. Every formula, such as =(C4-B4)/B4, serves as an explicit definition of a relationship between specific data points.
Methodology
FORTAP is built upon the TUTA architecture, a transformer-based model specifically designed for spreadsheets. TUTA utilizes "tree attention" to capture the hierarchical and non-relational structures common in complex tables, such as those with nested headers.
The core of FORTAP's innovation is its three self-supervised pretraining objectives, which are designed to teach the model different aspects of numerical reasoning:
- Numerical Reference Prediction (NRP): This objective focuses on spatial context. The model learns to predict which headers or numerical cells are referenced by a given formula. For example, it learns that a cell in a "% Increase" column is likely related to values in preceding "Year" columns.
- Numerical Calculation Prediction (NCP): This objective focuses on the logic of the calculation. Given a set of operand cells, the model must predict the operator or function (e.g.,
+,-,SUM,AVERAGE) that connects them. This decouples the "where" (references) from the "how" (calculation). - Formula Masked Language Modeling (MLM): A specialized version of MLM where parts of a formula (operators or cell references) are masked. The model must recover these missing components using the surrounding table context.
To ensure the model learns the underlying logic rather than just string patterns, the authors parsed millions of formulas into Abstract Syntax Trees (ASTs). This allows the model to process the hierarchical structure of the mathematical operations directly.
Datasets and Pretraining
The authors constructed a massive pretraining corpus by crawling 13.5 million public spreadsheet files. After cleaning and filtering, this resulted in a dataset of 4.5 million tables containing 10.8 million unique formulas. This scale of "free" supervision is unprecedented for tabular reasoning tasks.
For evaluation, the model was tested on several key benchmarks:
- Enron: A dataset of real-world spreadsheets used for formula prediction.
- HiTab: A dataset of hierarchical web tables used for complex Question Answering (QA).
- DeEx: A dataset used for cell type classification, specifically identifying headers, data, and derived values.
Key Results
FORTAP demonstrated significant improvements over previous state-of-the-art models across all evaluation metrics:
- Formula Prediction: On the Enron dataset, FORTAP achieved 55.8% top-1 accuracy, outperforming the previous best model (TUTA) by 7.3% and specialized models like TaPEx by over 12%.
- Table Question Answering: On the HiTab benchmark, FORTAP delivered a +6.3% improvement in execution accuracy. This indicates that the skills learned from formulas directly translate to better performance on human-generated questions.
- Cell Type Classification: The model was particularly adept at identifying "derived" cells—those that are calculated from other cells—showing a +6.6% boost in F1-score on the DeEx dataset.
Discussion and Limitations
The primary insight of FORTAP is that spreadsheet formulas provide a high-quality, diverse, and massive source of supervision for numerical reasoning without the need for manual labeling. By splitting the learning process into reference prediction and calculation prediction, the model develops a more robust understanding of the intent behind the numbers.
However, some limitations remain. The current implementation focuses on common arithmetic and aggregation functions. It does not yet fully exploit logical functions (like VLOOKUP) or text-manipulation functions. Additionally, due to computational constraints, the model's "view" during pretraining is often limited to cells within the same row or column, potentially missing more complex cross-table relationships.
Conclusion
FORTAP represents a major step forward in teaching AI models to understand and reason over numerical data in tables. By tapping into the vast resource of existing spreadsheet formulas, it provides a scalable way to bridge the gap between simple data retrieval and complex numerical analysis. Future work will look to expand the range of supported functions and handle even more complex table structures.
Summary updated