PURPLE: Making a Large Language Model a Better SQL Writer
Tonghui Ren, Yuankai Fan, Zhenying He, Ren Huang, Jiaqi Dai, Can Huang, Yinan Jing, Kai Zhang, Yifan Yang, X. Sean Wang
摘要
Large Language Model (LLM) techniques play an increasingly important role in Natural Language to SQL (NL2SQL) translation. LLMs trained by extensive corpora have strong natural language understanding and basic SQL generation abilities without additional tuning specific to NL2SQL tasks. Existing LLMs-based NL2SQL approaches try to improve the translation by enhancing the LLMs with an emphasis on user intention understanding. However, LLMs sometimes fail to generate appropriate SQL due to their lack of knowledge in organizing complex logical operator composition. A promising method is to input the LLMs with demonstrations, which include known NL2SQL translations from various databases. LLMs can learn to organize operator compositions from the input demonstrations for the given task. In this paper, we propose PURPLE (Pre-trained models Utilized to Retrieve Prompts for Logical Enhancement), which improves accuracy by retrieving demonstrations containing the requisite logical operator composition for the NL2SQL task on hand, thereby guiding LLMs to produce better SQL translation. PURPLE achieves a new state-of-the-art performance of 80.5% exact-set match accuracy and 87.8% execution match accuracy on the validation set of the popular NL2SQL benchmark Spider. PURPLE maintains high accuracy across diverse benchmarks, budgetary constraints, and various LLMs, showing robustness and cost-effectiveness.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 21 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- ReEx-SQL: Reasoning with Execution-Aware Reinforcement Learning for Text-to-SQL 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- ReEx-SQL: Reasoning with Execution-Aware Reinforcement Learning for Text-to-SQL 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- ReEx-SQL: Reasoning with Execution-Aware Reinforcement Learning for Text-to-SQL 引用了 Grounding Natural Language to SQL Translation with Data-Based Self-Explanations
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction 引用了 Language Models are Few-Shot Learners
- 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 引用了 Language Models are Few-Shot Learners
- Teaching Large Language Models to Self-Debug 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- OpenSQL: Data-Efficient Text-to-SQL for Open-Source LLMs via Synthesized Intermediate Supervision 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- OpenSQL: Data-Efficient Text-to-SQL for Open-Source LLMs via Synthesized Intermediate Supervision 引用了 SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learning
- OpenSQL: Data-Efficient Text-to-SQL for Open-Source LLMs via Synthesized Intermediate Supervision 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learning 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learning 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- CogSQL: A Cognitive Framework for Enhancing Large Language Models in Text-to-SQL Translation 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- CogSQL: A Cognitive Framework for Enhancing Large Language Models in Text-to-SQL Translation 引用了 Teaching Large Language Models to Self-Debug
- CogSQL: A Cognitive Framework for Enhancing Large Language Models in Text-to-SQL Translation 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Grounding Natural Language to SQL Translation with Data-Based Self-Explanations 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- Grounding Natural Language to SQL Translation with Data-Based Self-Explanations 引用了 Teaching Large Language Models to Self-Debug
- Grounding Natural Language to SQL Translation with Data-Based Self-Explanations 引用了 Language Models are Few-Shot Learners
引用它的顶会 Paper21
- SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement LearningPeixian Ma, Xialie Zhuang, Chengjin Xu, Xuhui Jiang 等NeurIPS 2025 · 94 次引用
- CogSQL: A Cognitive Framework for Enhancing Large Language Models in Text-to-SQL TranslationHongwei Yuan, Xiu Tang, Ke Chen, Lidan Shou 等AAAI 2025 · 12 次引用
- ReEx-SQL: Reasoning with Execution-Aware Reinforcement Learning for Text-to-SQLYaxun Dai, Wenxuan Xie, Xialie Zhuang, Tianyu Yang 等ACL 2026 · 8 次引用
- Grounding Natural Language to SQL Translation with Data-Based Self-ExplanationsYuankai Fan, Tonghui Ren, Can Huang, Zhenying He 等ICDE 2025 · 7 次引用
- OpenSQL: Data-Efficient Text-to-SQL for Open-Source LLMs via Synthesized Intermediate SupervisionRuilin Hu, Yuyu Luo, Guoliang Li, Shuangqiao Wu 等VLDB 2026 · 4 次引用
它引用的 Paper28
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
- BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and ComprehensionMike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad 等ACL 2020 · 1,224 次引用
- 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 次引用
相关 Paper
- The Power of Constraints in Natural Language to SQL TranslationTonghui Ren, Chen Ke, Yuankai Fan, Yinan Jing 等VLDB 2025 · 4 次引用
- Enhancing Text-to-SQL Capabilities of Large Language Models: A Study on Prompt Design StrategiesLinyong Nan, Yilun Zhao, Weijin Zou, Narutatsu Ri 等EMNLP Findings 2023 · 49 次引用
- Enhancing Text-to-SQL Parsing through Question Rewriting and Execution-Guided RefinementWenxin Mao, Ruiqi Wang, Jiyu Guo, Jichuan Zeng 等ACL Findings 2024 · 19 次引用
- Text-to-SQL Empowered by Large Language Models: A Benchmark EvaluationDawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun 等VLDB 2024 · 609 次引用
- Structure-Guided Large Language Models for Text-to-SQL GenerationQinggang Zhang, Hao Chen, Junnan Dong, Shengyuan Chen 等ICML 2025
