arXiv:2510.15560cs.AIcs.DB2025-10被引 1

用加权共识竞赛机制,精准选出最合适的SQL语句。

JudgeSQL: Reasoning over SQL Candidates with Weighted Consensus Tournament

  • 构建基于推理的判别模型,通过可验证奖励强化学习训练。
  • 在BIRD基准上准确率超越现有方法,跨规模泛化能力强。
  • 适合需要高精度SQL生成与选择的复杂数据查询场景。

文本转SQL是连接自然语言理解与结构化数据访问的关键任务,但受语义模糊和复杂组合推理困扰。尽管大语言模型(LLMs)在提示、微调和强化学习驱动的SQL生成方面取得进展,测试时扩展策略暴露了新瓶颈:从多样候选集中选出正确查询。现有方法如自一致性或best-of-N解码仅提供浅层信号,易导致评分不一致、推理链脆弱,且难以捕捉相近SQL间的细微语义差异。为此,我们提出JudgeSQL,一种通过结构化推理与加权共识竞赛机制重构候选SQL选择的框架。JudgeSQL构建一个基于推理的SQL判别模型,利用可验证奖励引导强化学习,实现准确且可解释的判断。在此基础上,加权共识竞赛融合显式推理偏好与隐式生成器置信度,提升选择的可靠性和效率。在BIRD基准上的大量实验表明,JudgeSQL展现出卓越的SQL判断能力,具备良好的跨规模泛化性与对生成器能力的鲁棒性。

原文摘要 · Abstract (English)

Text-to-SQL is a pivotal task that bridges natural language understanding and structured data access, yet it remains fundamentally challenging due to semantic ambiguity and complex compositional reasoning. While large language models (LLMs) have greatly advanced SQL generation though prompting, supervised finetuning and reinforced tuning, the shift toward test-time scaling exposes a new bottleneck: selecting the correct query from a diverse candidate pool. Existing selection approaches, such as self-consistency or best-of-$N$ decoding, provide only shallow signals, making them prone to inconsistent scoring, fragile reasoning chains, and a failure to capture fine-grained semantic distinctions between closely related SQL candidates. To this end, we introduce JudgeSQL, a principled framework that redefines SQL candidate selection through structured reasoning and weighted consensus tournament mechanism. JudgeSQL develops a reasoning-based SQL judge model that distills reasoning traces with reinforcement learning guided by verifiable rewards, enabling accurate and interpretable judgments. Building on this, a weighted consensus tournament integrates explicit reasoning preferences with implicit generator confidence, yielding selections that are both more reliable and more efficient. Extensive experiments on the BIRD benchmark demonstrate that JudgeSQL exhibits superior SQL judgment capabilities and good cross-scale generalization and robustness to generator capacity.

文本转SQL推理模型SQL选择大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。