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:
- 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.
- Generation & Filtering: The challenger generates pairs, which are filtered for execution validity and deduplicated using masked SQL templates to prevent diversity collapse.
- 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.
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%).
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