SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQL
Yue Gong, Chuan Lei, Xiao Qin, Kapil Vaidya, Balakrishnan Narayanaswamy, Tim Kraska
摘要
Text-to-SQL systems translate natural language (NL) questions into SQL queries, enabling non-technical users to interact with structured data. While large language models (LLMs) have shown promising results on the text-to-SQL task, they often produce semantically incorrect yet syntactically valid queries, with limited insight into their reliability. We propose SQLens, an end-to-end framework for fine-grained detection and correction of semantic errors in LLM-generated SQL. SQLens integrates error signals from both the underlying database and the LLM to identify potential semantic errors within SQL clauses. It further leverages these signals to guide query correction. Empirical results on two public benchmarks show that SQLens outperforms the best LLM-based self-evaluation method by 25.78% in F1 for error detection, and improves execution accuracy of out-of-the-box text-to-SQL systems by up to 20%.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinement 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinement 引用了 Teaching Large Language Models to Self-Debug
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Teaching Large Language Models to Self-Debug 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Beyond Text-to-SQL: Can LLMs Really Debug Enterprise ETL SQL? 引用了 Teaching Large Language Models to Self-Debug
引用它的顶会 Paper2
它引用的 Paper22
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
- Self-RAG: Learning to Retrieve, Generate, and Critique through Self-ReflectionAkari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil 等ICLR 2024 · 1,798 次引用
- Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 次引用
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 次引用
- LLM Evaluators Recognize and Favor Their Own GenerationsArjun Panickssery, Samuel R. Bowman, Shi FengNeurIPS 2024 · 865 次引用
相关 Paper
- SQL-Checker: Error Detection and Labeling for Text-to-SQL with Interpretability AnalysisXingyu Ma, Xin Tian, Lingxiang Wu, Xuepeng Wang 等WWW 2026
- EXPO-SQL: Execution-based Clause-level Policy Optimization for Text-to-SQLJaehoon Lee, CheolWon Na, Suyoung Bae, Jin-Seop Lee 等ACL Findings 2026 · 1 次引用
- SafeQL: Search-based Refinement for Safe and Efficient LLM-based Text-to-SQLGeonho Lee, Min-Soo KimVLDB 2026
- DAC: Decomposed Automation Correction for Text-to-SQLDingzirui Wang, Longxu Dou, Xuanliang Zhang, Qingfu Zhu 等EMNLP Findings 2025 · 5 次引用
- Structure-Guided Large Language Models for Text-to-SQL GenerationQinggang Zhang, Hao Chen, Junnan Dong, Shengyuan Chen 等ICML 2025
