Benchmarking and Improving Text-to-SQL Generation under Ambiguity
Adithya Bhaskar, Tushar Tomar, Ashutosh Sathe, Sunita Sarawagi
Abstract
Research in Text-to-SQL conversion has been largely benchmarked against datasets where each text query corresponds to one correct SQL. However, natural language queries over reallife databases frequently involve significant ambiguity about the intended SQL due to overlapping schema names and multiple confusing relationship paths. To bridge this gap, we develop a novel benchmark called AmbiQT with over 3000 examples where each text is interpretable as two plausible SQLs due to lexical and/or structural ambiguity. When faced with ambiguity, an ideal top-k decoder should generate all valid interpretations for possible disambiguation by the user (Elgohary et al., 2021; Zhong et al., 2022) . We evaluate several Text-to-SQL systems and decoding algorithms, including those employing state-of-the-art LLMs, and find them to be far from this ideal. The primary reason is that the prevalent beam search algorithm and its variants, treat SQL queries as a string and produce unhelpful token-level diversity in the top-k. We propose LogicalBeam, a new decoding algorithm that navigates the SQL logic space using a blend of plan-based template generation and constrained infilling. Counterfactually generated plans diversify templates while in-filling with a beam-search, that branches solely on schema names, provides value diversity. Log-icalBeam is up to 2.5× more effective than state-of-the-art models at generating all candidate SQLs in the top-k ranked outputs. It also enhances the top-5 Exact and Execution Match Accuracies on SPIDER and Kaggle DBQA 1 .
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext aeeb01a5-6b67-475d-9f29-fe70b99b4965Cited by top-tier papers12
- BIRD-INTERACT: Re-imagining Text-to-SQL Evaluation via Lens of Dynamic InteractionsNan Huo, Xiaohan Xu, Jinyang Li, Per Jacobsson et al.ICLR 2026 · 10 citations
- Automated Validating and Fixing of Text-to-SQL Translation with Execution ConsistencyYicun Yang, Zhaoguo Wang, Yu Xia, Zhuoran Wei et al.SIGMOD 2025 · 7 citations
- DocCGen: Document-based Controlled Code GenerationSameer Pimparkhede, Mehant Kammakomati, Srikanth Tamilselvam, Prince Kumar et al.EMNLP 2024 · 4 citations
- AmbigNLG: Addressing Task Ambiguity in Instruction for NLGAyana Niwa, Hayate IsoEMNLP 2024 · 2 citations
- Understanding, Detecting, and Repairing Real-World In-Context-Learning-Based Text-to-SQL ErrorsJiawei Shen, Chengcheng Wan, Ruoyi Qiao, Jiazhen Zou et al.FSE 2026 · 1 citation
Builds on9
- The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 citations
- RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQLHaoyang Li, Jing Zhang, Cuiping Li, Hong ChenAAAI 2023 · 343 citations
- CatSQL: Towards Real World Natural Language to SQL ApplicationsHan Fu, Chang Liu, Bin Wu, Feifei Li et al.VLDB 2023 · 79 citations
- RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL ParsersBailin Wang, Richard Shin, Xiaodong Liu, Oleksandr Polozov et al.ACL 2020 · 39 citations
Related papers
- CLEAR: A Parser-Independent Disambiguation Framework for NL2SQLMeng Zhang, Kexin Ma, Liyang Xu, Kedi Zhang et al.ICDE 2025 · 4 citations
- LinkAlign: Scalable Schema Linking for Real-World Large-Scale Multi-Database Text-to-SQLYihan Wang, Peiyu Liu, Xin YangEMNLP 2025 · 2 citations
- Reliable Answers for Recurring Questions: Boosting Text-to-SQL Accuracy with Template Constrained DecodingSmit Jivani, Sarvam Maheshwari, Sunita SarawagiSIGMOD 2026 · 1 citation
- CHASE-SQL: Multi-Path Reasoning and Preference Optimized Candidate Selection in Text-to-SQLMohammadreza Pourreza, Hailong Li, Ruoxi Sun, Yeounoh Chung et al.ICLR 2025
- TACO: A Benchmark for Open-Domain Text-to-SQL with Ambiguous and Cross-Database QueriesChao Deng, Ju Fan, Yuyu Luo, Qinliang Xue et al.VLDB 2026 · 1 citation
