Manuscript Offprint

arXiv:2609.04697

SQL-Zero: Self-Evolving Text-to-SQL

Daniel Machado Pedrozo, Julia Soares Dollis, Bryan Lincoln Marques de Oliveira, Vinicius Alboneti Aguiar, Sávio Salvarino Teles de Oliveira, Telma Woerle de Lima Soares

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Training a competitive Text-to-SQL agent usually depends on human-annotated natural-language/SQL pairs, which are expensive, domain-specific, and a bottleneck for scaling to new databases. We show it is possible to train a competitive solver with zero annotated pairs. We introduce SQL-Zero, a proposer-solver self-play in which a challenger and a solver start from the same base LLM and the only ground truth is execution against the database itself. The challenger generates SQL pairs calibrated to the solver's current difficulty (targeting "hard but solvable"), and both roles are updated with GRPO in alternating turns, with a template-level repetition penalty on the challenger to prevent diversity collapse. Training on BIRD databases with no labels, self-play improves over the zero-shot base on BIRD dev by 6.6 points at 3B and 7.3 points at 7B. It also scores higher than a matched control trained under the same recipe on human BIRD gold over the same databases, although an exact paired test does not resolve that margin. Transfer depends on scale: at 3B every iteration outperforms the base on unseen Spider databases and under lexical perturbation (Spider-Syn), where it also degrades less than the matched BIRD-gold control, whereas at 7B only the first iteration preserves transfer.

1 Introduction

Modern Text-to-SQL (T2SQL) systems are trained on collections of annotated natural-language question / gold-SQL pairs [Yu et al., 2018, Li et al., 2023]. Producing such pairs requires annotators who can read a schema and write correct SQL, and the resulting labels inherit whatever question distribution those annotators chose. Reinforcement learning with verifiable rewards (RLVR) weakens this dependence, since execution supplies a task-level reward without requiring a reference reasoning trace. Prominent T2SQL RL systems nonetheless still draw supervision from annotated data, from synthetic SFT initialization, or from both: Yao et al. [2025] initialize from an SFT model and run RL on annotated BIRD/Spider data, and Sheng and Xu [2025] train GRPO on human BIRD gold. We ask a narrower question: can execution-verified self-play improve a T2SQL solver without annotated NL-SQL training pairs?

This setting has two requirements beyond producing executable SQL. Generated tasks must remain in a learnable difficulty range: trivial tasks saturate solver groups, whereas unsolvable tasks provide no useful execution signal. They must also remain structurally diverse rather than collapse onto a few SQL templates. SQL-Zero addresses these requirements with a challenger that proposes SQL-first tasks and a solver that answers them. Database execution verifies the challenger's candidate

Preprint.

Figure

Figure 1: The SQL-Zero self-evolving framework. One base model instantiated a challenger and a solver that co-evolve: each solver rewards the next challenger with its empirical difficulty (the first challenger trains against the base solver), and each challenger provides the execution-filtered training data for its solver. Each role also inherits its own previous checkpoint, so evolution flows through the weights as well as the data.

gold SQL, a difficulty reward targets hard-but-solvable tasks, and a template-level repetition term discourages repeated proposals. The framework uses database schemas and executable instances, but never annotated NL-SQL pairs.

Under the validated OmniSQL inference pipeline, self-play improves BIRD over the same-size zero-shot base by 6.6 points at 3B and 7.3 points at 7B at the best iteration, and by 5.1 and 6.3 points already at the first. The 3B arm improves Spider test and Spider-Syn transfer at every iteration; at 7B only the first iteration preserves it, and the later two fall below the base on both transfer sets. A separate matched BIRD-gold experiment uses the official evaluator and a unified schema prompt, so its values are not mixed with the main table: all three self-play estimates exceed the human-gold control, but none of the three margins is resolved by an exact paired test. CSC-SQL-3B remains a stronger reference on BIRD and Spider test under the main pipeline; its different data, initialization, and decoding prevent attributing that gap to annotation alone. Finally, the generated and human-gold corpora occupy complementary template regions, although this descriptive observation does not identify the cause of the accuracy gain.

References (31)