Introduction
While code generation research has traditionally focused on professional programming languages like Python or Java, a significant portion of the global workforce relies on spreadsheet formulas (Excel, Google Sheets) for data automation. These users, often categorized as "non-programmers," face a unique challenge: translating conversational, often underspecified natural language into complex functional logic.
Existing benchmarks for spreadsheet formula generation frequently rely on synthetic data or simplified tasks that fail to capture the "naturalness gap"—the discrepancy between structured logic and how people actually seek help. To address this, researchers introduced SpreadNaLa, a dataset of 1,300 naturalistic spreadsheet formulas paired with English descriptions sourced directly from StackOverflow.
The SpreadNaLa Dataset
The SpreadNaLa dataset was curated from over 14,000 StackOverflow posts tagged with excel-formula. The authors employed aggressive filtering to remove low-quality content and performed two rounds of manual expert correction to ensure high fidelity. To prevent models from being penalized for trivial errors, specific cell references (e.g., A1) were replaced with placeholders (e.g., <cell1>) when the specific cell was not explicitly mentioned in the natural language description.
As shown in the dataset statistics, the average description length is nearly 100 words, reflecting the descriptive and often messy nature of real-world user queries compared to the relatively concise formula outputs.
Methodology
The evaluation utilized GPT-3.5 (text-davinci-003) as the core model, testing three distinct prompting and reasoning frameworks:
- Baseline: A standard 1-shot prompt for direct translation.
- Code Reviewer Reranking: A method where the model generates 10 candidates and then selects the one that best "explains" the original description by calculating $P(description | formula)$.
- Rational Speech Act (RSA) Framework: A pragmatic model that uses recursive reasoning to consider alternative descriptions, aiming to resolve ambiguity in user intent.
Performance was measured using Exact Match (EM) and Levenshtein edit distance, utilizing the openpyxl tokenizer for structural comparison.
Key Results and Analysis
The evaluation revealed that while LLMs have largely mastered spreadsheet syntax—with fewer than 1% of generated formulas being syntactically invalid—capturing the underlying logic remains a significant hurdle.
The Code Reviewer approach emerged as the most effective, achieving an Exact Match rate of 5.85% and the lowest edit distance. Interestingly, the more complex RSA framework underperformed compared to the baseline, likely due to a mismatch between the model's generated alternative descriptions and the specific linguistic style found on StackOverflow.
Discussion and Limitations
A qualitative analysis suggested that automated metrics like Exact Match may be overly pessimistic. In many instances, the model produced "correct but different" solutions—alternative formulas that achieve the same result as the human-authored gold standard but use different functions or logic. When accounting for these alternatives, the success rate for the Code Reviewer model rose to approximately 29%.
However, the study also highlighted that roughly 48% of generated formulas were fundamentally incorrect, indicating that spreadsheet formula generation is far from a solved problem. The authors note that future work should transition toward execution-based evaluation, which tests formulas against actual spreadsheet data rather than relying solely on string-based comparisons.
Conclusion
SpreadNaLa provides a challenging and realistic benchmark for the spreadsheet domain. The results underscore a critical gap in current LLM capabilities: while syntax is easily learned, the ability to navigate the ambiguity of naturalistic user descriptions and produce sound logical structures remains an open research frontier.
Summary updated