通过执行反馈优化多候选SQL生成,提升复杂数据库查询准确率。
SIRIUS-SQL: Anchoring Multi-Candidate Text-to-SQL in Execution Feedback

- 用强化学习生成多样化可执行SQL,避免重复冗余。
- 根据执行结果类型精准修复,提升候选质量。
- 融合结果一致性和语法判断,适合高精度数据库查询场景。
复杂模式下的Text-to-SQL任务在单次生成中不可靠,现有系统通过生成多个SQL候选并投票纠错。但该方法存在三重缺陷:1)单一生成器产生更多候选会导致冗余增加;2)对所有非正确执行结果使用通用修正策略,未能区分运行错误、超时和空结果等不同问题;3)现有选择器仅依赖单一标准(如结果多数投票或成对比较),遗漏其他有效判别角度。本文提出SIRIUS-SQL,针对上述问题:采用难度平滑的强化学习训练SIRIUS-32B生成多样且可执行的SQL,搭配通用大模型填补专业模型遗漏;基于执行结果分类实施针对性修复,再重新进入候选池;采用置信度控制的混合选择器,结合执行结果一致性与语法结构判断,仅对接近平局的情况触发确定性结构校验。在BIRD开发集上达到75.88%准确率,在SPIDER测试集上达91.20%。其中两种通用模型组合超越Agentar-Scale-SQL,为当前最强多候选系统。
原文摘要 · Abstract (English)
Text-to-SQL on complex schemas is unreliable on a single pass, so recent systems generate multiple SQL candidates and let voting filter out errors. Yet voting alone is not enough, because the multi-candidate recipe has three coupled weaknesses: 1) sampling more from a single generator produces increasingly redundant candidates, 2) existing pipelines apply one generic correction to every non-clean execution result, while runtime errors, timeouts, and empty results each indicate a different distance from correctness, and 3) existing selectors rely on a single angle such as result-majority voting or pairwise SQL comparison, missing what other angles would have caught. We present SIRIUS-SQL, which addresses all three weaknesses. A difficulty-smoothing RL recipe trains SIRIUS-32B to generate diverse executable SQL candidates, paired with a generalist LLM that fills in gaps left by the specialist. An execution-grounded lifecycle classifies each outcome and applies targeted repair before candidates re-enter the pool. A confidence-gated hybrid selector combines execution-result agreement with pairwise SQL-form judgment, escalating only near-tied cases to a deterministic structural check. SIRIUS-SQL reaches 75.88% on BIRD dev and 91.20% on SPIDER test. Two of three generalist pairings surpass Agentar-Scale-SQL, the strongest published multi-candidate system on BIRD dev.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。