TL;DR
SynSQL is a novel framework that uses Large Language Models (LLMs) to automatically generate realistic, minimal, and constraint-respecting synthetic databases for evaluating text-to-SQL systems. Unlike previous methods that require a "gold" SQL query to build a test suite, SynSQL generates data directly from the natural language question and the database schema, often surpassing human-curated benchmarks in evaluation reliability.
What Problem Does This Paper Address?
Evaluating text-to-SQL systems—models that translate human questions into database queries—is notoriously difficult. Current evaluation relies on static, human-curated benchmarks like Spider and BIRD. However, these benchmarks have significant "data quality" issues:
- False Negatives: A perfectly correct SQL query might return an empty set or fail because the underlying database is missing relevant rows or violates referential integrity (e.g., a foreign key pointing to a non-existent ID).
- False Positives: An incorrect SQL query might accidentally return the "right" answer because the test data is too simple or lacks edge cases.
- Cold-Start Scenarios: In real-world engineering, you often have a database schema but no actual data (due to privacy or because the system is new). How do you test your SQL generator without data?
Existing automated tools usually require the "gold" (correct) SQL query to generate test data. This creates a circular dependency: you need the answer to test if your model can find the answer.
Methods
SynSQL introduces a modular, three-agent pipeline that operates without needing the gold SQL query:
- Schema Selector: Real-world schemas are huge. This agent uses an "ensemble expansion" strategy—querying the LLM at multiple temperatures to identify core tables and columns, then expanding that set to include semantically related attributes and necessary foreign keys. This ensures the generated database is compact but complete.
- Synthesizer: This agent generates SQL
INSERTstatements. It is conditioned on the natural language question to ensure the data contains the specific entities (e.g., "Lewis Hamilton," "2009") mentioned by the user. It also includes rule-based post-processing to ensure the data types and column counts match the schema. - Critic with Iterative Refinement: A dedicated agent evaluates the generated data on a 1-10 scale across dimensions like key integrity, variety, and relevance. If the score is too low, it provides specific feedback (e.g., "Ensure all IDs in the 'schools' table exist in the 'satscores' table") to the Synthesizer for a redo.
Datasets
The authors evaluated SynSQL using three major benchmarks:
- Spider: A widely used dataset with relatively simple schemas.
- BIRD: A more challenging benchmark featuring large, complex databases with multiple joins and professional-level queries.
- Spider 2.0: A recent benchmark focused on enterprise-level workflows (Snowflake/BigQuery).
Key Insights and Ideas
- Question-Centric vs. Query-Centric: By focusing on the question rather than the gold SQL, SynSQL can be used in production environments where the "correct" SQL isn't known beforehand.
- Surpassing Human Quality: Surprisingly, SynSQL achieved a higher "Success Rate" (the gold query returning a non-empty result) on Spider than the original human-authored databases. This is because the LLM avoids the typos and missing data artifacts common in manual curation.
- Minimalism as a Feature: SynSQL generates "tiny" databases. For the BIRD benchmark, SynSQL reduced a 21MB database to just 20KB while still providing enough signal to distinguish between correct and incorrect queries. This makes manual inspection by developers much easier.
- The Agreement Rate (AR): The authors use a metric based on Cohen’s Kappa to measure how well the synthetic database's evaluation results agree with the original benchmark. High AR scores prove that synthetic data can effectively stand in for real data.
Key Results
- Spider Success Rate: SynSQL achieved 93.04%, outperforming the original human-curated data (92.55%).
- BIRD Agreement Rate: SynSQL reached a 79.23% agreement rate, significantly higher than prior automated methods like TestSuiteAccuracy (TSA).
- Robustness to Complexity: On "High Complexity" schemas in BIRD (61+ columns), SynSQL maintained a success rate of ~77%, whereas a vanilla LLM baseline plummeted to ~36%.
- Error Correction: In a fine-grained analysis of 250 BIRD questions, SynSQL "fixed" 15 evaluation errors caused by poor data quality in the original benchmark.
Limitations and Future Work
- Schema Omission: The Schema Selector occasionally misses tables needed for complex, multi-hop joins. The authors suggest that future versions could use multi-hop schema traversal to improve recall.
- LLM Hallucinations: Like all LLM-based systems, the framework is dependent on the model's ability to interpret the question correctly. If the LLM misinterprets the user's intent, the generated data will be fundamentally flawed.
- Case Sensitivity: The paper notes that mismatches between the casing in the question (e.g., "owner") and the gold query (e.g., "OWNER") still cause failures, suggesting a need for better alignment of literal values.
For more details, see the full paper: "SynSQL: Synthetic Database Generation for Robust Evaluation of Text-to-SQL Systems" (Under review at ICLR 2026).
Summary updated