Metasql: A Generate-Then-Rank Framework for Natural Language to SQL Translation
Yuankai Fan, Zhenying He, Tonghui Ren, Can Huang, Yinan Jing, Kai Zhang, X. Sean Wang
摘要
The Natural Language Interface to Databases (NLIDB) empowers non-technical users with database access through intuitive natural language (NL) interactions. Advanced approaches, utilizing neural sequence-to-sequence models or large-scale language models, typically employ auto-regressive decoding to generate unique SQL queries sequentially. While these translation models have greatly improved the overall translation accuracy, surpassing 70% on NLIDB benchmarks, the use of auto-regressive decoding to generate single SQL queries may result in sub-optimal outputs, potentially leading to erroneous translations. In this paper, we propose Metasql, a unified generate-then-rank framework that can be flexibly incorporated with existing NLIDBs to consistently improve their translation accuracy. Metasql introduces query metadata to control the generation of better SQL query candidates and uses learning-to-rank algorithms to retrieve globally optimized queries. Specifically, Metasql first breaks down the meaning of the given NL query into a set of possible query metadata, representing the basic concepts of the semantics. These metadata are then used as language constraints to steer the underlying translation model toward generating a set of candidate SQL queries. Finally, Metasql ranks the candidates to identify the best matching one for the given NL query. Extensive experiments are performed to study Metasql on two public NLIDB benchmarks. The results show that the performance of the translation models can be effectively improved using Metasql. In particular, applying Metasql to the published Lgesql model obtains a translation accuracy of 77.4 % on the validation set and 72.3 % on the test set of the Spider benchmark, outperforming the baseline by 2.3% and 0.3%, respectively. Moreover, applying Metasql to GpT-4 achieves translation accuracies of 68.6%, 42.0%, and 17.6 % on the three real-world complex scientific databases of Sciencebenchmark, respectively. The code for Metasql is available at https://github.com/Kaimary/MetaSQL.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 7 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL 引用了 Bridging Textual and Tabular Data for Cross-Domain Text-to-SQL Semantic Parsing
- Text2VectorSQL: Towards a Unified Interface for Vector Search and SQL Queries 引用了 RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- Text2VectorSQL: Towards a Unified Interface for Vector Search and SQL Queries 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- PURPLE: Making a Large Language Model a Better SQL Writer 引用了 RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- PURPLE: Making a Large Language Model a Better SQL Writer 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- PURPLE: Making a Large Language Model a Better SQL Writer 引用了 Bridging Textual and Tabular Data for Cross-Domain Text-to-SQL Semantic Parsing
- PURPLE: Making a Large Language Model a Better SQL Writer 引用了 Language Models are Few-Shot Learners
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction 引用了 Language Models are Few-Shot Learners
- Reliable Text-to-SQL with Adaptive Abstention 引用了 RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- Reliable Text-to-SQL with Adaptive Abstention 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- Reliable Text-to-SQL with Adaptive Abstention 引用了 Bridging Textual and Tabular Data for Cross-Domain Text-to-SQL Semantic Parsing
- Reliable Text-to-SQL with Adaptive Abstention 引用了 Language Models are Few-Shot Learners
- LearNAT: Learning NL2SQL with AST-guided Task Decomposition for Large Language Models 引用了 RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- LearNAT: Learning NL2SQL with AST-guided Task Decomposition for Large Language Models 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- The Power of Constraints in Natural Language to SQL Translation 引用了 RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
- The Power of Constraints in Natural Language to SQL Translation 引用了 PURPLE: Making a Large Language Model a Better SQL Writer
- The Power of Constraints in Natural Language to SQL Translation 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- The Power of Constraints in Natural Language to SQL Translation 引用了 Bridging Textual and Tabular Data for Cross-Domain Text-to-SQL Semantic Parsing
引用它的顶会 Paper7
- PURPLE: Making a Large Language Model a Better SQL WriterTonghui Ren, Yuankai Fan, Zhenying He, Ren Huang 等ICDE 2024 · 49 次引用
- Reliable Text-to-SQL with Adaptive AbstentionKaiwen Chen, Yueting Chen, Nick Koudas, Xiaohui YuSIGMOD 2025 · 9 次引用
- LearNAT: Learning NL2SQL with AST-guided Task Decomposition for Large Language ModelsWeibin Liao, Xin Gao, Tianyu Jia, Rihong Qiu 等ICLR 2026 · 9 次引用
- The Power of Constraints in Natural Language to SQL TranslationTonghui Ren, Chen Ke, Yuankai Fan, Yinan Jing 等VLDB 2025 · 4 次引用
- Text2VectorSQL: Towards a Unified Interface for Vector Search and SQL QueriesZhengren Wang, Dongwen Yao, Bozhou Li, Dongsheng Ma 等ICDE 2026 · 1 次引用
它引用的 Paper19
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- Approximate Nearest Neighbor Negative Contrastive Learning for Dense Text RetrievalLee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang 等ICLR 2021 · 1,547 次引用
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 次引用
- RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQLHaoyang Li, Jing Zhang, Cuiping Li, Hong ChenAAAI 2023 · 343 次引用
- Bridging Textual and Tabular Data for Cross-Domain Text-to-SQL Semantic ParsingXi Victoria Lin, Richard Socher, Caiming XiongEMNLP Findings 2020 · 186 次引用
相关 Paper
- Gar: A Generate-and-Rank Approach for Natural Language to SQL TranslationYuankai Fan, Zhenying He, Tonghui Ren, Dianjun Guo 等ICDE 2023 · 12 次引用
- MT-Teql: Evaluating and Augmenting Neural NLIDB on Real-world Linguistic and Schema VariationsPingchuan Ma, Shuai WangVLDB 2022 · 38 次引用
- ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL SystemsYi Zhang, Jan Deriu, George Katsogiannis-Meimarakis, Catherine Kosten 等VLDB 2024 · 65 次引用
- Grounding Natural Language to SQL Translation with Data-Based Self-ExplanationsYuankai Fan, Tonghui Ren, Can Huang, Zhenying He 等ICDE 2025 · 7 次引用
- NL2SQLBench: A Modular Benchmarking Framework for LLM-Enabled NL2SQL SolutionsShizheng Hou, Wenqi Pei, Nuo Chen, Quang-Trung Ta 等VLDB 2026 · 1 次引用
