An empirical study of validating synthetic data for formula generation

Usneek Singh, José Cambronero, Sumit Gulwani, Aditya Kanade, Anirudh Khatry, Vu Le, Mukul Singh, Gust Verbruggen

Introduction

Spreadsheet formulas represent a ubiquitous form of programming in the business world, yet they remain notoriously difficult for many users to author and for artificial intelligence models to master. A primary bottleneck in developing AI assistants for spreadsheets is the scarcity of high-quality datasets that pair natural language (NL) descriptions with their corresponding formulas. While raw spreadsheet files containing tables and formulas are abundant, they rarely include the intent-based descriptions (e.g., "Calculate the total tax for each row") necessary for supervised learning.

To address this data gap, researchers frequently employ Large Language Models (LLMs) to generate synthetic NL descriptions for existing formulas. However, this process introduces significant noise; if an LLM generates an inaccurate or misleading description, fine-tuning a model on such data can degrade its performance. This paper investigates an empirical approach to this problem: using LLMs not just to generate data, but to "validate" and filter it, ensuring that only high-quality synthetic examples are used for training.

Methodology: Surrogate Objectives for Validation

The authors propose three distinct "surrogate objectives" to determine whether a synthetic NL description accurately reflects the logic of a spreadsheet formula. These methods use GPT-4 as a validator to judge the quality of the generated pairs:

  1. Output Prediction ($V_O$): The validator is provided with the input table and the synthetic NL. It is then asked to predict the resulting values. If the predicted values match the actual output of the original formula, the data point is considered valid.
  2. Alternate Code Generation ($V_P$): The validator translates the NL description into a different programming language, specifically Python. This Python code is then executed on the table, and its output is compared against the original formula's output.
  3. Classification ($V_C$): This is a direct approach where the validator is shown the NL, the formula, and the table, and asked to provide a binary "Yes/No" judgment on whether the description effectively captures the essence of the formula.
Overview of the three validation surrogate objectives: Output Prediction (Vo), Alternate Code Generation (Vp), and Classification (Vc).

Experimental Setup

The researchers curated a training dataset by mining 7,833 (Table, Formula) pairs from public spreadsheet workbooks and generating synthetic NL descriptions using GPT-4. They then applied the three validation methods to create filtered subsets. To evaluate the impact of this filtering, they fine-tuned four models of varying sizes: Phi-2 (2B), Mistral-7B, GPT-3.5-Turbo, and GPT-4.

Evaluation was conducted using the SOFSET dataset, which consists of real-world spreadsheet tasks sourced from StackOverflow. The study focused on "derived-column" tasks, where a formula creates a new column based on existing data within a single table.

Key Insights

The study revealed several counter-intuitive but critical findings regarding the nature of synthetic data in model training:

  • Quality Over Quantity: Validation significantly prunes the dataset; for instance, the smallest validated set contained only about 29% of the original data. Despite this reduction in volume, models trained on these cleaner, smaller sets consistently outperformed those trained on the full, noisy dataset.
  • The Complexity Paradox: Validation tends to filter out more complex formulas because they are inherently harder for the validator to verify. However, models fine-tuned on this "simpler" but more accurate data actually demonstrated a superior ability to solve complex problems compared to models exposed to the full, unvalidated dataset.
  • Knowledge Recovery: The filtering process sometimes removed all instances of specific Excel functions (e.g., SUMIF). Remarkably, fine-tuned models were still able to use these functions correctly during evaluation. This suggests that high-quality fine-tuning helps the model better retrieve and apply latent knowledge acquired during its initial large-scale pre-training.
  • Python as a Robust Validator: The Alternate Code Generation ($V_P$) method emerged as the most effective validation strategy. Translating intent into an executable format like Python provides a rigorous check of semantic correctness that simple classification or direct output prediction may miss.

Key Results and Performance

The empirical results underscore the efficacy of the validation approach. GPT-4, when fine-tuned on data validated via the $V_P$ method, achieved a 28% improvement in evaluation scores over the base model. Furthermore, the use of validated data led to a 23% reduction in training time, as the models reached higher performance levels with fewer examples.

Performance metrics across different models and validation subsets, showing improvements in function variety and operational complexity.

These benefits were consistent across the model spectrum. For example, the performance of the smaller Phi-2 model more than doubled when moving from raw synthetic data to the $V_P$-validated subset, proving that validation is a viable strategy for enhancing both small open-weight and large closed-weight models.

Conclusion and Future Directions

This research demonstrates that LLM-based validation is a powerful tool for improving the quality of synthetic training data for spreadsheet formula generation. By filtering out noise, researchers can train more accurate models more efficiently.

Future work may explore moving beyond simple deletion to correction, where the validator attempts to fix invalid NL descriptions rather than discarding them. Additionally, expanding the scope to include multi-table lookups and unstructured spreadsheet layouts would further enhance the utility of these AI assistants in real-world business environments.

Summary updated

BibTeX
@inproceedings{singh2025empirical,
  author = {Usneek Singh and José Cambronero and Sumit Gulwani and Aditya Kanade and Anirudh Khatry and Vu Le and Mukul Singh and Gust Verbruggen},
  title = {{An empirical study of validating synthetic data for formula generation}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.findings-naacl.391},
}
Figure