JudgeSQL: Reasoning over SQL Candidates with Weighted Consensus Tournament

Authors: Jiayuan Bai, Xuanguang Pan, Chongyang Tao, Shuai Ma

Abstract

Text-to-SQL is a pivotal task that bridges natural language understanding and structured data access. Recent advances in large language models, through prompting, fine-tuning, and reinforcement learning, have greatly increased the likelihood of generating correct SQL queries. However, selecting the correct SQL from multiple candidates remains challenging. Existing approaches, such as self-consistency, Best-of-N decoding, and learned scalar ranking models, rely on shallow heuristics or lack explicit reasoning, making them prone to unstable judgments and unable to capture fine-grained semantic differences between similar queries. We propose JudgeSQL, a framework that combines reasoning-based SQL evaluation with a weighted consensus tournament. 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 the generator’s execution-consistency confidence, improving both reliability and efficiency. Experiments on the BIRD benchmark demonstrate that JudgeSQL consistently outperforms prior methods, with strong generalization and robustness across model scales. The code is available at https://github.com/Jiayuan-Bai/JudgeSQL.

PDFOpen original
Find similar papers with AI

Copy this prompt into your assistant

Using Paperlist, find papers similar to "JudgeSQL: Reasoning over SQL Candidates with Weighted Consensus Tournament" (id: 239681, EMNLP 2026).
set up https://paperlist.ai/SKILL.md

MCP setupCLI