Papers
arxiv:2505.13271

CSC-SQL: Corrective Self-Consistency in Text-to-SQL via Reinforcement Learning

Published on May 19, 2025
Authors:
,

Abstract

CSC-SQL combines Self-Consistency and Self-Correction with reinforcement learning to improve SQL query generation from natural language.

Large language models (LLMs) have demonstrated strong capabilities in translating natural language questions about relational databases into SQL queries. In particular, test-time scaling techniques such as Self-Consistency and Self-Correction can enhance SQL generation accuracy by increasing computational effort during inference. However, these methods have notable limitations: Self-Consistency may select suboptimal outputs despite majority votes, while Self-Correction typically addresses only syntactic errors. To leverage the strengths of both approaches, we propose CSC-SQL, a novel method that integrates Self-Consistency and Self-Correction. CSC-SQL selects the two most frequently occurring outputs from parallel sampling and feeds them into a merge revision model for correction. Additionally, we employ the Group Relative Policy Optimization (GRPO) algorithm to fine-tune both the SQL generation and revision models via reinforcement learning, significantly enhancing output quality. Experimental results confirm the effectiveness and generalizability of CSC-SQL. On the BIRD development set, our 3B model achieves 65.28% execution accuracy, while the 7B model achieves 69.19%. The code will be open sourced at https://github.com/CycloneBoy/csc_sql.

Community

Sign up or log in to comment

Get this paper in your agent:

hf papers read 2505.13271
Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash

Models citing this paper 17

Browse 17 models citing this paper

Datasets citing this paper 4

Spaces citing this paper 1

Collections including this paper 1