Lune

VLDB2026Top-tier venue

SQL-Factory: A Multi-Agent Framework for High-Quality and Large-Scale SQL Generation

Jiahui Li, Tongwang Wu, Yuren Mao, Yunjun Gao, Yajie Feng, Huaizhong Liu

Abstract

High quality SQL corpus is essential for intelligent databases. For example, Text-to-SQL requires SQL queries and corresponding natural language questions as training samples. However, collecting such a query corpus remains challenging in practice due to the high cost of manual annotation, which highlights the importance of automatic SQL generation. Despite recent advances, existing generation methods still face limitations in achieving both diversity and cost-effectiveness. Besides, many methods also treat all tables equally, which overlooks schema complexity and leads to under-utilization of structurally rich tables. To address these issues, this paper proposes a multi-agent framework for high-quality and large-scale SQL generation, dubbed SQL-Factory. It decomposes the generation process into three collaborative teams: the Generation Team explores diverse query structures using a powerful language model, the Expansion Team scales promising patterns via a lightweight language model, and the Management Team adaptively schedules the workflow and evaluates the quality of synthesized queries. This modular framework ensures a balanced trade-off between diversity, scalability, and generation cost. We apply SQL-Factory to four widely used benchmarks and generate over 300,000 SQL queries with less than $200 API cost. Our generated queries achieve higher diversity compared to other methods, and extensive experiments demonstrate that the generated queries significantly improve model performance in various downstream tasks.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

3 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • SQL-Exchange: Transforming SQL Queries Across Domains cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • SQL-Exchange: Transforming SQL Queries Across Domains cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • DPC: Training-Free Text-to-SQL Candidate Selection via Dual-Paradigm Consistency cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • MARS-SQL: A Multi-Agent Reinforcement Learning Framework For Text-To-SQL cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • MARS-SQL: A Multi-Agent Reinforcement Learning Framework For Text-To-SQL cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers3

  1. MARS-SQL: A Multi-Agent Reinforcement Learning Framework For Text-To-SQLHaolin Yang, Jipeng Zhang, Zhitao He, Alexander Zhou et al.ICML 2026 · 12 citations
  2. SQL-Exchange: Transforming SQL Queries Across DomainsMohammadreza Daviran, Brian Lin, Davood RafieiVLDB 2026 · 2 citations
  3. DPC: Training-Free Text-to-SQL Candidate Selection via Dual-Paradigm ConsistencyBoyan Li, Ou Ocean Kun Hei, Yue Yu, Yuyu LuoACL 2026 · 2 citations

Builds on19

  1. SimCSE: Simple Contrastive Learning of Sentence EmbeddingsTianyu Gao, Xingcheng Yao, Danqi ChenEMNLP 2021 · 2,496 citations
  2. Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 citations
  3. DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 citations
  4. Text-to-SQL Empowered by Large Language Models: A Benchmark EvaluationDawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun et al.VLDB 2024 · 609 citations
  5. MedAgents: Large Language Models as Collaborators for Zero-shot Medical ReasoningXiangru Tang, Anni Zou, Zhuosheng Zhang, Ziming Li et al.ACL Findings 2024 · 160 citations

Related papers

  1. CHASE-SQL: Multi-Path Reasoning and Preference Optimized Candidate Selection in Text-to-SQLMohammadreza Pourreza, Hailong Li, Ruoxi Sun, Yeounoh Chung et al.ICLR 2025
  2. SQL-Trail: Multi-Turn Reinforcement Learning with Interleaved Feedback for Text-to-SQLHarper Hua, Zhen Han, Zhengyuan Shen, Meng-Chieh Lee et al.ACL 2026 · 3 citations
  3. APEX-SQL: Talking to the data via Agentic Exploration for Text-to-SQLBowen Cao, Weibin Liao, Yushi Sun, Dong Fang et al.KDD 2026 · 7 citations
  4. SchemaRAG: A Schema-aware Retrieval-Augmented Generation Framework for Text-to-SQLDi Wu, Zetong Tang, Yi He, Xin LuoSIGMOD 2026 · 9 citations
  5. SQLFixAgent: Towards Semantic-Accurate Text-to-SQL Parsing via Consistency-Enhanced Multi-Agent CollaborationJipeng Cen, Jiaxin Liu, Zhixu Li, Jingjing WangAAAI 2025 · 18 citations
Dusk over the sea between two cliffs drawn in fine vertical lines