AGRO-SQL: Agentic Group-Relative Optimization with High-Fidelity Data Synthesis

Cehua Yang, Dongyu Xiao, Junming Lin, Yuyang Song, Hanxu Yan, Shawn Guo, Wei Zhang, Jian Yang, Mingjie Tang, Bryan DaiarXiv 2025 · DOI · arXiv

Abstract

AGRO-SQL is a novel framework designed to overcome the primary bottlenecks in Text-to-SQL: data scarcity and reasoning limitations. By integrating a high-fidelity synthetic data factory with an "agentic" reinforcement learning (RL) approach, AGRO-SQL enables models to learn the underlying logic of SQL execution rather than simple pattern matching. Utilizing the stable Group Relative Policy Optimization (GRPO) algorithm and execution-verified data, the framework achieves a state-of-the-art 72.10% Execution Accuracy on the BIRD benchmark for single-model methods.

Introduction

Translating natural language into executable SQL queries (Text-to-SQL) is essential for democratizing data access. However, current Large Language Models (LLMs) struggle with two major issues: the high cost of annotated complex NL-SQL pairs and the inability to self-correct during generation. Standard Supervised Fine-Tuning (SFT) often results in models that mimic syntax without understanding execution logic, while traditional Reinforcement Learning (RL) is frequently unstable in sparse-reward SQL environments.

Methodology: The AGRO-SQL Pipeline

AGRO-SQL employs a dual-centric approach to stabilize training and improve reasoning capabilities.

1. Data-Centric: RL-Ready Iterative Synthesis

To break the "data scaling wall," the framework utilizes an iterative data factory. This process involves structural-aware synthesis through database augmentation and SQL decomposition. Crucially, the pipeline employs a Generation-as-Verification strategy, retaining only synthetic trajectories where execution results perfectly match the ground truth. This "zero-noise" approach prevents reward hacking during the RL phase.

2. Model-Centric: Agentic RL with GRPO

AGRO-SQL treats SQL generation as an agentic task where the model interacts with the database environment.

  • Diversity-Aware Cold Start: The model is initialized using high-quality interactive trajectories distilled from a teacher model.
  • Group Relative Policy Optimization (GRPO): Unlike standard PPO, GRPO refines the policy by comparing a group of generated trajectories against each other. This eliminates the need for a complex value network, significantly stabilizing training in sparse-reward environments.
The AGRO-SQL pipeline, illustrating the high-quality RL data generation factory, the GRPO training loop, and the multi-turn inference refinement process.

3. Inference-Time Strategy

At test time, the system uses a three-stage context augmentation (profiling columns, generating semantic descriptions, and dynamic pruning) followed by a multi-turn refinement loop. If an initial SQL draft fails, the agent observes the execution error and iteratively refines the query.

Experimental Results

The framework was evaluated on the Spider and BIRD (Big Bench for Large-scale Database Grounded Text-to-SQLs) benchmarks. BIRD is particularly challenging, featuring 95 large-scale databases and complex reasoning requirements.

Performance comparison of AGRO-SQL against state-of-the-art models. AGRO-SQL (72.10% on BIRD) outperforms both multi-agent frameworks and significantly larger closed-source models.

As shown in the results, AGRO-SQL (using a Qwen3-8B-Base backbone) achieved:

  • BIRD Benchmark: 72.10% Execution Accuracy (EX), setting a new state-of-the-art for single-model methods.
  • Spider Benchmark: 89.13% EX.
  • Efficiency: It significantly outperformed standard RL baselines (which averaged ~63% on BIRD), demonstrating that high-fidelity data combined with GRPO is more effective than simply increasing compute for standard RL.

Discussion and Insights

  • Execution as Ground Truth: By shifting from string-matching (SFT) to execution-matching (RL), the model internalizes SQL logic.
  • The Agentic Advantage: Treating Text-to-SQL as a multi-turn interaction (Action -> Feedback -> Correction) allows smaller models (8B parameters) to outperform much larger models that rely on one-shot generation.
  • Stability via GRPO: Relative reward comparison within groups prevents the training "explosions" common in traditional RL, making the optimization process more robust.

Limitations and Future Work

While highly effective, the approach depends on a runnable database environment for training, which may not be feasible in all production settings. Additionally, while execution equivalence ensures correct answers, it does not strictly guarantee that the SQL structure perfectly matches the user's semantic intent in every edge case. Future research will explore "execution-free" feedback signals to reduce computational overhead.

Summary updated

Abstract

The advancement of Text-to-SQL systems is currently hindered by the scarcity of high-quality training data and the limited reasoning capabilities of models in complex scenarios. In this paper, we propose a holistic framework that addresses these issues through a dual-centric approach. From a Data-Centric perspective, we construct an iterative data factory that synthesizes RL-ready data characterized by high correctness and precise semantic-logic alignment, ensured by strict verification. From a Model-Centric perspective, we introduce a novel Agentic Reinforcement Learning framework. This framework employs a Diversity-Aware Cold Start stage to initialize a robust policy, followed by Group Relative Policy Optimization (GRPO) to refine the agent's reasoning via environmental feedback. Extensive experiments on BIRD and Spider benchmarks demonstrate that our synergistic approach achieves state-of-the-art performance among single-model methods.
BibTeX
@misc{yang2025agro,
  author = {Cehua Yang and Dongyu Xiao and Junming Lin and Yuyang Song and Hanxu Yan and Shawn Guo and Wei Zhang and Jian Yang and Mingjie Tang and Bryan Dai},
  title = {{AGRO-SQL: Agentic Group-Relative Optimization with High-Fidelity Data Synthesis}},
  year = {2025},
  eprint = {2512.23366},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.23366},
}
Figure