JudgeSQL: Reasoning over SQL Candidates with Weighted Consensus Tournament

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.
Anthology ID:
2026.emnlp-main.1880
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
42870–42888
Language:
URL:
https://aclanthology.org/2026.emnlp-main.1880/
DOI:
Bibkey:
Cite (ACL):
Jiayuan Bai, Xuanguang Pan, Chongyang Tao, and Shuai Ma. 2026. JudgeSQL: Reasoning over SQL Candidates with Weighted Consensus Tournament. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 42870–42888, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
JudgeSQL: Reasoning over SQL Candidates with Weighted Consensus Tournament (Bai et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.1880.pdf