Is Long Context All You Need? Leveraging LLM's Extended Context for NL2SQL
Yeounoh Chung, Gaurav Tarlok Kakkar, Yu Gan, Brenton Milne, Fatma Ozcan
摘要
Large Language Models (LLMs) have demonstrated impressive capabilities across a range of natural language processing tasks. In particular, improvements in reasoning abilities and the expansion of context windows have opened new avenues for leveraging these powerful models. NL2SQL is challenging in that the natural language question is inherently ambiguous, while the SQL generation requires a precise understanding of complex data schema and semantics. One approach to this semantic ambiguous problem is to provide more and sufficient contextual information.
In this work, we explore the performance and the latency tradeoffs of the extended context window (a.k.a., long context) offered by Google's state-of-the-art LLM ( gemini-1.5-pro ). We study the impact of various contextual information, including column example values, question and SQL query pairs, user-provided hints, SQL documentation, and schema. To the best of our knowledge, this is the first work to study how the extended context window and extra contextual information can help NL2SQL generation with respect to both accuracy and latency cost. We show that long context LLMs are robust and do not get lost in the extended contextual information. Additionally, our long-context NL2SQL pipeline based on Google's Gemini-pro-1.5 achieves strong performance across multiple benchmark datasets without fine-tuning or expensive self-consistency based techniques.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 5 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Self-Consistency Improves Chain of Thought Reasoning in Language Models 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Chain-of-Thought Prompting Elicits Reasoning in Large Language Models 引用了 Self-Consistency Improves Chain of Thought Reasoning in Language Models
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation 引用了 Self-Consistency Improves Chain of Thought Reasoning in Language Models
- Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation 引用了 TaBERT: Pretraining for Joint Understanding of Textual and Tabular Data
- RetrySQL: Text-to-SQL Training with Retry Data for Self-Correcting Query Generation 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- RetrySQL: Text-to-SQL Training with Retry Data for Self-Correcting Query Generation 引用了 Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
- RetrySQL: Text-to-SQL Training with Retry Data for Self-Correcting Query Generation 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- DeepEye-SQL: A Software-Engineering-Inspired Text-to-SQL Framework 引用了 Self-Consistency Improves Chain of Thought Reasoning in Language Models
- DeepEye-SQL: A Software-Engineering-Inspired Text-to-SQL Framework 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- DeepEye-SQL: A Software-Engineering-Inspired Text-to-SQL Framework 引用了 Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
- Developing and Benchmarking Verification Algorithms to Improve Text-to-SQL Generation 引用了 DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
- Developing and Benchmarking Verification Algorithms to Improve Text-to-SQL Generation 引用了 Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
- Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models 引用了 Self-Consistency Improves Chain of Thought Reasoning in Language Models
- Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
引用它的顶会 Paper5
- Agentic Context Engineering: Evolving Contexts for Self-Improving Language ModelsQizheng Zhang, Changran Hu, Shubhangi Upasani, Boyuan Ma 等ICLR 2026 · 374 次引用
- DeepEye-SQL: A Software-Engineering-Inspired Text-to-SQL FrameworkBoyan Li, Chong Chen, Zhujun Xue, Yinan Mei 等SIGMOD 2026 · 40 次引用
- Feedback by Design: Understanding and Overcoming User Feedback Barriers in Conversational AgentsNikhil Sharma, Zheng Zhang, Daniel Lee, Namita Krishnan 等CHI 2026 · 2 次引用
- RetrySQL: Text-to-SQL Training with Retry Data for Self-Correcting Query GenerationAlicja Raczkowska, Riccardo Belluzzo, Piotr Zielinski, Joanna Baran 等AAAI 2026
- Developing and Benchmarking Verification Algorithms to Improve Text-to-SQL GenerationTarfah Alrashed, Madhup Sukoon, David R. Karger, Natasha F. NoyVLDB 2026
它引用的 Paper14
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 次引用
- Self-Consistency Improves Chain of Thought Reasoning in Language ModelsXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V. Le 等ICLR 2023 · 681 次引用
- Text-to-SQL Empowered by Large Language Models: A Benchmark EvaluationDawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun 等VLDB 2024 · 609 次引用
- TaBERT: Pretraining for Joint Understanding of Textual and Tabular DataPengcheng Yin, Graham Neubig, Wen-tau Yih, Sebastian RiedelACL 2020 · 417 次引用
相关 Paper
- ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-ThoughtHanchong Zhang, Ruisheng Cao, Lu Chen, Hongshen Xu 等EMNLP Findings 2023 · 54 次引用
- Cracking Query Bottlenecks: Towards Efficiency-Oriented Text-to-SQL GenerationLi Lin, Yunfeng Shen, Lingfeng Bao, Rongxin Wu 等ISSTA 2026
- DCG-SQL: Enhancing In-Context Learning for Text-to-SQL with Deep Contextual Schema Link GraphJihyung Lee, Jin-Seop Lee, Jaehoon Lee, YunSeok Choi 等ACL 2025
- CogSQL: A Cognitive Framework for Enhancing Large Language Models in Text-to-SQL TranslationHongwei Yuan, Xiu Tang, Ke Chen, Lidan Shou 等AAAI 2025 · 12 次引用
- 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 次引用
