TL;DR
PaVeRL-SQL is a novel framework that combines partial-match rewards and verbal reinforcement learning (RL) to significantly improve the execution accuracy of Text-to-SQL models on complex, industry-scale databases. By introducing dense reward signals and two flexible pipelines—one gradient-free for large API-based models and one optimized via Group Relative Policy Optimization (GRPO) for smaller on-premises models—it achieves state-of-the-art results on challenging benchmarks like Spider 2.0.
What Problem Does This Paper Address?
While Text-to-SQL systems perform well on simple academic benchmarks, they frequently break down when deployed in production environments. Real-world enterprise databases introduce massive schemas, complex multi-way joins, nested subqueries, and diverse SQL dialects.
Standard Supervised Fine-Tuning (SFT) often leads to memorization rather than generalization, making models fragile under distribution shifts. Reinforcement learning with execution feedback offers a path toward self-improvement, but it suffers from reward sparsity: traditional metrics provide a binary 0/1 (success/failure) signal based on exact execution matches. If a model gets a complex query 90% right but misses a single column, it receives a reward of 0, making the RL training process highly unstable and sample-inefficient.
Methods
PaVeRL-SQL introduces two distinct pipelines tailored to different deployment constraints, underpinned by a new Partial-Match Reward mechanism.
1. Verbal RL Pipeline (For Large/Closed-Source LLMs)
Designed for scenarios where training an in-house model is too costly or restricted, this is a gradient-free "generate-and-judge" workflow that approximates group-relative selection:
- Sampling: The backbone LLM samples SQL candidates until it collects $K=10$ unique, executable queries.
- Judging: The same LLM acts as a judge, scoring the candidates based on how well they answer the prompt. The highest-scoring query is selected as the final output.
2. Chain-of-Thought (CoT) RL Pipeline (For Small/On-Premises Models)
For applications requiring strict data privacy and low latency, the authors fine-tune a smaller, open-source model (OmniSQL-7B) using Group Relative Policy Optimization (GRPO). Key innovations include:
- Partial-Match Reward Shaping: Instead of binary feedback, the reward function incorporates Fractional Execution Accuracy ($EX_f$), which measures the proportion of columns in the generated result table that match the ground truth. This provides a continuous, dense gradient signal.
- Two-Stage GRPO Schedule: A cost-effective training schedule that warms up with a standard learning rate decay, identifies the best checkpoint, and restarts stage two from that peak with adjusted rates to ensure rapid convergence within a modest budget ($\le 20$ epochs).
Datasets
The framework was trained and evaluated using several prominent Text-to-SQL datasets:
- Spider & Spider 2.0 (SQLite): Spider 2.0 focuses heavily on enterprise-level complexity and realistic schema configurations.
- BIRD: A large-scale database grounded text-to-SQL benchmark.
- SynSQL10K: A balanced 10,000-sample subset drawn from the SynSQL-2.5M dataset to ensure general-purpose capability.
Key Insights and Ideas
- Dense Rewards Stabilize RL: Transitioning from binary execution matching to column-level fractional matching ($EX_f$) dramatically smooths the optimization landscape. Non-negative, graded rewards prevent the policy confusion common in standard sparse-reward setups.
- Gradient-Free Group Selection Works: The Verbal RL pipeline demonstrates that LLMs can effectively self-correct and rank their own outputs using groupwise preference prompting, serving as a powerful zero-shot alternative to full RL training.
- Cross-Dialect Knowledge Transfer: Reasoning is dialect-agnostic. By mixing a data-rich dialect (SQLite) with a low-resource dialect (MySQL) during CoT RL training, the model learns underlying relational logic that transfers seamlessly, boosting performance on the scarce dialect without degrading the rich one.
Key Results
- Spider 2.0 State-of-the-Art: On the industrial-grade Spider2.0-SQLite benchmark, the Verbal RL pipeline (using GPT-5 mini) achieved an execution accuracy of 37.0%, outperforming the previous best framework (CHESS) by 7.4%. The compact CoT RL pipeline outperformed its baseline by 1.4%.
- Massive Dialect Gains: Implementing mixed-dialect CoT RL training led to a 3× improvement in execution accuracy on a low-resource, proprietary MySQL test set, demonstrating robust cross-dialect generalization.
- Sample Efficiency: The two-stage GRPO training schedule successfully converged within 20 epochs, significantly lowering the compute barrier for training specialized on-premise reasoning models.
Limitations and Future Work
Despite its success, the authors note a few limitations:
- Execution Environment Dependency: The framework requires a live, secure database sandbox to validate query executability during both training and inference.
- LLM Judge Biases: The Verbal RL pipeline remains susceptible to inherent biases within the backbone model acting as the judge.
- Future Directions: The team plans to extend the reward function beyond column-level matching to include tuple-set comparisons and strict constraint satisfaction. They also aim to adapt PaVeRL-SQL to handle multi-turn conversational database interactions.
Summary updated