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 SoaresarXiv 2026

TL;DR

SQL-Zero introduces a zero-annotation, self-evolving framework for Text-to-SQL training using a challenger-solver self-play loop. By leveraging database execution as the sole source of ground truth and optimizing via Group Relative Policy Optimization (GRPO), it eliminates the need for expensive human-annotated pairs while significantly outperforming zero-shot baselines and matched human-label controls.

What Problem Does This Paper Address?

Building reliable Text-to-SQL systems typically relies heavily on high-quality, human-annotated natural language (NL) and SQL pairs. These annotations are expensive, require domain expertise, and create a massive bottleneck when scaling to new databases. While reinforcement learning with verifiable rewards (RLVR) helps by using database execution as a feedback signal, existing methods still rely on supervised fine-tuning (SFT) initialization or human-labeled datasets.

The authors address a fundamental question: Can we train a competitive Text-to-SQL solver using zero annotated training pairs, relying purely on database execution?

Methods

The authors propose SQL-Zero, a self-play framework where two roles—a challenger (the task proposer) and a solver—co-evolve from the same base LLM (Qwen2.5-Coder).

The loop operates in alternating steps:

  1. Challenger Training: Trained via GRPO to generate SQL-first pairs calibrated to the solver's current skill level, targeting a "hard but solvable" difficulty zone.
  2. Generation & Filtering: The challenger generates pairs, which are filtered for execution validity and deduplicated using masked SQL templates to prevent diversity collapse.
  3. Solver Training: The solver is trained on these generated pairs using GRPO with a minimal three-tier execution reward (correct match, valid but mismatch, or invalid SQL).

To keep the challenger from repeating the same simple templates, a template-level repetition penalty is applied.

Figure 1: The SQL-Zero self-evolving framework. One base model instantiates 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.

Datasets

  • BIRD: The framework trains exclusively on the schemas and contents of the BIRD training databases (without using its human NL-SQL labels). Evaluation is performed in-domain on the BIRD dev set.
  • Spider test: Used to evaluate cross-domain transfer performance on completely unseen databases.
  • Spider-Syn: A variant of Spider with lexical perturbations (synonym substitutions) to test the model's robustness against phrasing changes.

Key Insights and Ideas

  • Zero Labels Can Beat Human Labels: Surprisingly, models trained purely via self-play outperformed a matched control model trained on actual human gold labels under the exact same training recipe.
  • Complementary Exploration: Analysis showed that the self-play loop does not merely reconstruct the human dataset. The generated queries and human gold queries occupied almost entirely disjoint template regions (covering less than 0.5% of each other's templates), meaning the challenger discovered alternative valid ways to explore the database schema.
  • The Necessity of Difficulty Control: For larger models (7B), naive static generation fails because the groups saturate quickly, yielding zero learning signal. A dynamic difficulty curriculum ("hard-but-solvable" gate) is essential to keep the training signal active.
  • The Scale-Transfer Paradox: Model scale alters how well self-play generalizes. The 3B model maintained or improved its transfer capabilities to unseen databases (Spider) across iterations. However, the 7B model experienced a trade-off, boosting its in-domain performance at the cost of eroding its transfer capabilities in later iterations.

Key Results

  • In-Domain Gains: Compared to the zero-shot base, SQL-Zero improved BIRD dev performance by 6.6 percentage points at the 3B scale (reaching 45.3%) and 7.3 percentage points at the 7B scale (reaching 58.4%).
  • Beating the Gold Control: At the 3B scale, SQL-Zero's best iteration (45.3%) comfortably beat the matched "Gold-BIRD-control-3B" (41.9%), which was trained on human labels.
  • Robustness: On Spider-Syn, SQL-Zero-3B achieved up to 67.0% accuracy, outperforming both its zero-shot base (56.5%) and the human-gold control (63.1%).
Table 1: Self-play improves over the zero-shot base and the same-recipe gold control on the displayed benchmarks; CSC-SQL-3B, which is trained on BIRD gold, remains stronger on BIRD and Spider test. Rows are grouped by the base model each system starts from, so every comparison within a block is same-size. Main results under the protocol in §4 (greedy@1), validated to reproduce the published BIRD and Spider-test numbers of the two reference systems within 0.9 points. BIRD dev is held-out in-domain evaluation; Spider test transfers to unseen databases. SQL-Zero uses zero NL–SQL labels. Best zero-data result per model size in bold. †Spider-Syn uses the fixed no-retrieval variant described in §4; all rows use identical inputs.

Limitations and Future Work

  • The Co-Evolution Plateau: Performance gains flatten out after the first few iterations rather than compounding indefinitely. The authors note a sharp decline in policy entropy and generation diversity in later turns.
  • Transfer Degradation at Scale: The 7B model's transfer performance on Spider sets degraded after the first iteration, indicating a tendency to overfit to the training database distribution during prolonged in-domain self-play.
  • Scope Constraints: The study was limited to single training runs, the Qwen2.5-Coder family, SQLite databases, and single-shot generation.
  • Future Directions: The authors suggest implementing an entropy floor or a KL-divergence penalty against the base model to counteract the entropy decline, alongside exploring adaptive challenger exploration strategies.

Summary updated

BibTeX
@misc{pedrozo2026sql,
  author = {Daniel Machado Pedrozo and Julia Soares Dollis and Bryan Lincoln Marques de Oliveira and Vinicius Alboneti Aguiar and Sávio Salvarino Teles de Oliveira and Telma Woerle de Lima Soares},
  title = {{SQL-Zero: Self-Evolving Text-to-SQL}},
  year = {2026},
  eprint = {2609.04697},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.04697},
}
Figure