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

TL;DR

Fine-tuning large language models (LLMs) to generate spreadsheet formulas from natural language is heavily restricted by a lack of high-quality parallel data. This paper demonstrates that using an LLM to synthetically generate and then rigorously validate training data via automated surrogate tasks—like cross-language code generation—significantly boosts downstream formula-generation accuracy while cutting training times by up to 73%. Surprisingly, filtering out complex but noisy examples actually improves a model's ability to solve highly complex problems post-fine-tuning.

What Problem Does This Paper Address?

While writing advanced spreadsheet formulas (like those in Excel) is notoriously challenging for everyday users, building an AI assistant to translate natural language (NL) queries into formulas ("NL-to-Formula") is equally difficult. Public spreadsheet repositories contain plenty of tables and formulas, but they completely lack the corresponding natural language descriptions needed to train a model.

To bypass expensive human annotation, researchers often use LLMs to synthetically generate these NL descriptions. However, these synthetic descriptions are frequently inaccurate, vague, or misaligned with the actual formula. Since recent AI research emphasizes "quality over quantity," the authors address a critical question: How can we automatically validate and filter synthetic NL data to maximize fine-tuning performance without relying on human oversight?

Methods

The authors propose using GPT-4 to validate synthetically generated NL descriptions ($\hat{U}$) against their original tables ($T$) and formulas ($F$). They introduce three distinct LLM-based surrogate validation strategies:

  1. Output Prediction ($V_O$): The validator LLM is given the table and the synthetic NL description, and is asked to directly compute the resulting column values. If these predicted values match the true formula's output row-by-row, the data point is accepted.
  2. Alternate Code Generation ($V_P$): The LLM translates the synthetic NL description into an equivalent Python (Pandas) program. This program is executed on the table, and its output is compared to the Excel formula's output.
  3. Classification ($V_C$): The LLM acts as a direct judge, performing a binary classification ("Yes"/"No") on whether the NL query accurately captures the essence of the formula's execution.
Figure 1: Overview of different validators implemented on top of GPT-4 represented by (a) VO: This validator directly computes F(T) from ( ˆU, T); (b) VP : Validator predicts python program P from ( ˆU, T) to compare P(T) with F(T); (c) VC: Validator directly classifies ˆU based on input ( ˆU, T, F).

Datasets

  • Training & Validation Data: The authors mined 7,833 training and 422 validation (table, formula) pairs from a large public corpus of Excel workbooks. GPT-4 was then used to generate the initial raw synthetic NL descriptions for these pairs.
  • Testing Data: Evaluation was conducted on SOFSET, a benchmark consisting of real-world spreadsheet formula tasks sourced from StackOverflow. The authors filtered this dataset down to 139 tasks matching their derived-column criteria.

Key Insights and Ideas

  • The Complexity Paradox: Automated validation often filters out highly complex formulas because the validator LLMs struggle to execute or translate them correctly. However, fine-tuning models on this simpler, cleaner dataset actually enhanced their ability to solve more complex problems at test time compared to training on the full, noisy raw dataset.
  • Knowledge Recovery: Even though certain advanced Excel functions were entirely eliminated from the training set during the validation phase, fine-tuned models still successfully used them during testing. This indicates that high-quality synthetic data helps the model unlock its pre-trained capabilities rather than forcing it to memorize flawed examples.
  • Venn Overlap: The three validators filter data quite differently. As seen in the dataset analysis, the Alternate Code Generation ($V_P$) approach strikes the best balance between strict execution matching and maintaining a diverse vocabulary of functions.

Key Results

The authors evaluated two open-weight models (Phi-2, Mistral-7B-Instruct) and two closed-weight models (GPT-3.5-Turbo, GPT-4) using the pass@5 metric:

  • Substantial Accuracy Gains: Fine-tuning on validated data consistently beat the unvalidated "raw" baseline. Notably, GPT-4 fine-tuned on Python-validated ($V_P$) data achieved a score of 0.41 compared to 0.32 on raw data—a 28% relative improvement.
  • Drastic Training Speedups: Because validation filters out low-quality data, the training sets were significantly smaller. This cut training times by 23% to 48% for the $V_P$ validator, and up to 73% for the ultra-strict $V_O$ validator.
  • Python Translation Wins: The Alternate Code Generation ($V_P$) validator emerged as the top performer for 3 out of the 4 models, proving that leveraging an LLM's strong coding capabilities (like Python generation) is an excellent proxy for verifying natural language accuracy.
Figure 4: Comparison of correctly solved cases on mod- els fine-tuned with different validation subsets based on (a) Number of unique functions (b) Average number of function calls (c) Average operator count of formulas

Limitations and Future Work

  • Data Loss vs. Correction: The current framework simply discards data points that fail validation. The authors note that future work should focus on correcting faulty synthetic text rather than throwing it away to preserve dataset size.
  • Distribution Mismatch: The training data (mined Excel sheets) differed structurally from the test data (StackOverflow queries), which occasionally led to optimization anomalies.
  • Scope Constraints: The study was limited to English queries and single, well-structured tables. Expanding these validation techniques to multi-table relational databases and multilingual environments remains an open area of research.

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