RingSQL生成高质量文本到SQL数据,解决强化学习训练中数据稀缺问题。
RingSQL: Schema-Independent Synthetic Data Generation for Text-to-SQL Reinforcement Learning
- 用通用查询模板结合LLM改写,实现无需依赖数据库结构的合成数据生成
- 在多个模型和基准上提升强化学习性能,平均准确率达69.8%
- 适合需要可靠合成数据的文本到SQL研究者与开发者
近期文本到SQL的研究进展得益于更大模型、更优数据集及新训练方法(如RLVR)。但高质量训练数据仍稀缺,而RLVR对噪声数据尤其敏感,错误数据会带来虚假奖励。人工构建成本高,现有合成方法在可靠性与可扩展性间权衡:基于模板的方法虽保证SQL正确性,但需针对特定模式设计模板且多样性不足;基于大模型的方法可扩展性强,却缺乏质量保障。本文提出RingSQL,一种融合无模式查询模板与大模型自然语言改写的混合框架。通过以完整模板问题为基础生成问题,确保在各种查询复杂度下保持问题-查询一致性,这是纯大模型方法无法实现的。RingSQL生成的数据集是唯一能在所有测试模型架构与基准上提升RLVR训练表现的合成数据集,平均准确率达69.8%,优于次佳合成数据集2.1个百分点,并超越Spider和BIRD中的真人标注数据。代码与数据已开源。
原文摘要 · Abstract (English)
Recent advances in text-to-SQL have been driven by larger models, better datasets, and new training methods like RLVR. However, progress remains limited by scarce high-quality training data, a problem RLVR is especially sensitive to since noisy data can produce spurious rewards. Manual data creation is expensive, and existing synthetic methods trade off reliability for scalability: template-based approaches guarantee correct SQL but need schema-specific templates and lack diversity, while LLM-based generation scales easily but lacks quality guarantees. We introduce RingSQL, a hybrid framework for generating question-SQL pairs that combines schema-independent query templates with LLM-based paraphrasing of natural language questions. By grounding question generation in complete template questions, RingSQL preserves question-query correctness across all levels of query complexity, a property purely LLM-based methods fail to maintain. RingSQL also produces the only synthetic dataset that improves RLVR training performance across all tested model architectures and benchmarks, achieving 69.8% average accuracy and surpassing both the next-best synthetic dataset by 2.1% and human-annotated data from Spider and BIRD. Code and data are available at https://github.com/nu-c3lab/RingSQL.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。