用轻量强化学习生成更准的SQL,不依赖复杂标注。
CogniSQL-R1-Zero: Lightweight Reinforced Reasoning for Efficient SQL Generation
- 基于执行正确性设计轻量奖励信号,直接优化最终目标。
- 在BIRD基准上超越多个大模型,7B小模型达顶尖水平。
- 适合追求高效、可解释文本转SQL研究者使用。
将自然语言转化为SQL(Text-to-SQL)是语言理解与结构化数据访问的核心挑战。尽管大语言模型提升了生成流畅性,但复杂查询的准确性和可执行性仍难保障。我们提出CogniSQL-R1-Zero,一种基于强化学习的轻量级框架,通过执行正确性与格式合规性构建奖励信号,避免中间监督、混合流水线和复杂奖励设计,实现稳定学习并更好对齐可执行程序的目标。该方法在Text2SQL基准BIRD上达到当前最优执行准确率,优于SFT CodeS-7B、DeepSeek-Coder 236B和Mistral 123B等监督与指令微调模型,且仅基于7B规模的骨干模型训练。实验表明,其可在4块NVIDIA A100 GPU(每块40GB显存)上完成训练。为推动高效、可解释的Text-to-SQL研究,我们发布两个数据集:(i) 5,024条不同上下文长度的推理轨迹;(ii) 36,356条弱监督查询语料,每条标注六种语义多样的推理路径。
原文摘要 · Abstract (English)
Translating natural language into SQL (Text-to-SQL) remains a core challenge at the intersection of language understanding and structured data access. Although large language models (LLMs) have improved fluency, generating correct and executable SQL, especially for complex queries, continues to be challenging. We introduce CogniSQL-R1-Zero, a reinforcement learning (RL) framework and model that produces accurate SQL using a lightweight reward signal based on execution correctness and format-tag compliance. By avoiding intermediate supervision, hybrid pipelines and complex reward shaping, our method encourages stable learning and stronger alignment with the ultimate task objective-producing executable programs. CogniSQL-R1-Zero achieves state-of-the-art execution accuracy on Text2SQL benchmark; BIRD bench, outperforming prior supervised and instruction-tuned baselines including SFT CodeS-7B, DeepSeek-Coder 236B, and Mistral 123B-despite being trained on a significantly smaller 7B backbone. This result underscores the scalability and efficiency of our RL-based approach when trained on just four NVIDIA A100 GPUs (40 GB VRAM each). To support further research in efficient and interpretable Text-to-SQL modeling, we release two curated datasets: (i) a collection of 5,024 reasoning traces with varying context lengths, and (ii) a positive-sampled corpus of 36,356 corpus of weakly supervised queries, each annotated with six semantically diverse reasoning paths. Together, these contributions advance scalable, execution-aligned Text-to-SQL generation.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。