Table of Contents
Fetching ...

EvolSQL: Structure-Aware Evolution for Scalable Text-to-SQL Data Synthesis

Xuanguang Pan, Chongyang Tao, Jiayuan Bai, Jianling Gao, Zhengwei Tao, Xiansheng Zhou, Gavin Cheung, Shuai Ma

TL;DR

EvolSQL tackles the data scarcity and structural diversity challenges in Text-to-SQL by introducing a structure-aware data synthesis pipeline. It combines Exploratory Query-SQL Expansion, six atomic AST-based evolution operators with an adaptive directional strategy, execution-grounded refinement, and schema-aware deduplication, followed by Chain-of-Thought synthesis and supervised fine-tuning. The approach yields high-quality, diverse, executable SQL-question mappings, achieving strong results on BIRD and Spider with only a fraction of data compared to prior large-scale synthesis methods. The model trained with EvolSQL data demonstrates robust cross-domain generalization and substantial data efficiency, suggesting broad applicability for open-source Text-to-SQL systems and real-world database interfaces.

Abstract

Training effective Text-to-SQL models remains challenging due to the scarcity of high-quality, diverse, and structurally complex datasets. Existing methods either rely on limited human-annotated corpora, or synthesize datasets directly by simply prompting LLMs without explicit control over SQL structures, often resulting in limited structural diversity and complexity. To address this, we introduce EvolSQL, a structure-aware data synthesis framework that evolves SQL queries from seed data into richer and more semantically diverse forms. EvolSQL starts with an exploratory Query-SQL expansion to broaden question diversity and improve schema coverage, and then applies an adaptive directional evolution strategy using six atomic transformation operators derived from the SQL Abstract Syntax Tree to progressively increase query complexity across relational, predicate, aggregation, and nesting dimensions. An execution-grounded SQL refinement module and schema-aware deduplication further ensure the creation of high-quality, structurally diverse mapping pairs. Experimental results show that a 7B model fine-tuned on our data outperforms one trained on the much larger SynSQL dataset using only 1/18 of the data.

EvolSQL: Structure-Aware Evolution for Scalable Text-to-SQL Data Synthesis

TL;DR

EvolSQL tackles the data scarcity and structural diversity challenges in Text-to-SQL by introducing a structure-aware data synthesis pipeline. It combines Exploratory Query-SQL Expansion, six atomic AST-based evolution operators with an adaptive directional strategy, execution-grounded refinement, and schema-aware deduplication, followed by Chain-of-Thought synthesis and supervised fine-tuning. The approach yields high-quality, diverse, executable SQL-question mappings, achieving strong results on BIRD and Spider with only a fraction of data compared to prior large-scale synthesis methods. The model trained with EvolSQL data demonstrates robust cross-domain generalization and substantial data efficiency, suggesting broad applicability for open-source Text-to-SQL systems and real-world database interfaces.

Abstract

Training effective Text-to-SQL models remains challenging due to the scarcity of high-quality, diverse, and structurally complex datasets. Existing methods either rely on limited human-annotated corpora, or synthesize datasets directly by simply prompting LLMs without explicit control over SQL structures, often resulting in limited structural diversity and complexity. To address this, we introduce EvolSQL, a structure-aware data synthesis framework that evolves SQL queries from seed data into richer and more semantically diverse forms. EvolSQL starts with an exploratory Query-SQL expansion to broaden question diversity and improve schema coverage, and then applies an adaptive directional evolution strategy using six atomic transformation operators derived from the SQL Abstract Syntax Tree to progressively increase query complexity across relational, predicate, aggregation, and nesting dimensions. An execution-grounded SQL refinement module and schema-aware deduplication further ensure the creation of high-quality, structurally diverse mapping pairs. Experimental results show that a 7B model fine-tuned on our data outperforms one trained on the much larger SynSQL dataset using only 1/18 of the data.
Paper Structure (39 sections, 13 equations, 8 figures, 6 tables, 1 algorithm)

This paper contains 39 sections, 13 equations, 8 figures, 6 tables, 1 algorithm.

Figures (8)

  • Figure 1: Overview of the EvolSQL data synthesis pipeline.
  • Figure 2: Comparison of t-SNE visualization between original BIRD train set and EvolSQL.
  • Figure 3: Execution accuracy (%) on the BIRD development set across different difficulty levels.
  • Figure 4: Token length distributions for questions and SQL queries in Spider, BIRD, and EvolSQL datasets.
  • Figure 5: The prompt template for Exploratory Query-SQL Expansion.
  • ...and 3 more figures