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 Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
12 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Automated Validating and Fixing of Text-to-SQL Translation with Execution Consistency cites RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- Automated Validating and Fixing of Text-to-SQL Translation with Execution Consistency cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- Understanding, Detecting, and Repairing Real-World In-Context-Learning-Based Text-to-SQL Errors cites RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- Understanding, Detecting, and Repairing Real-World In-Context-Learning-Based Text-to-SQL Errors cites Natural SQL: Making SQL Easier to Infer from Natural Language Specifications
- Understanding, Detecting, and Repairing Real-World In-Context-Learning-Based Text-to-SQL Errors cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- Understanding, Detecting, and Repairing Real-World In-Context-Learning-Based Text-to-SQL Errors cites CatSQL: Towards Real World Natural Language to SQL Applications
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction cites Natural SQL: Making SQL Easier to Infer from Natural Language Specifications
- CatSQL: Towards Real World Natural Language to SQL Applications cites Natural SQL: Making SQL Easier to Infer from Natural Language Specifications
- BIRD-INTERACT: Re-imagining Text-to-SQL Evaluation via Lens of Dynamic Interactions cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
Cited 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 on12
- 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
- Natural SQL: Making SQL Easier to Infer from Natural Language SpecificationsYujian Gan, Xinyun Chen, Jinxia Xie, Matthew Purver et al.EMNLP Findings 2021 · 88 citations
- CatSQL: Towards Real World Natural Language to SQL ApplicationsHan Fu, Chang Liu, Bin Wu, Feifei Li et al.VLDB 2023 · 79 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
- Disambiguate First, Parse Later: Generating Interpretations for Ambiguity Resolution in Semantic ParsingIrina Saparina, Mirella LapataACL Findings 2025 · 4 citations
- StatBot.Swiss: Bilingual Open Data Exploration in Natural LanguageFarhad Nooralahzadeh, Yi Zhang, Ellery Smith, Sabine Maennel et al.ACL Findings 2024 · 6 citations
- Reliable Answers for Recurring Questions: Boosting Text-to-SQL Accuracy with Template Constrained DecodingSmit Jivani, Sarvam Maheshwari, Sunita SarawagiSIGMOD 2026 · 1 citation
