Text-to-SQL has emerged as a prominent research area, particularly with the rapid advancement of large language models (LLMs). By enabling users to query databases through natural language rather than SQL, this technology significantly lowers the barrier to data analysis. However, generating accurate SQL from natural language remains challenging due to ambiguity in user queries, the complexity of schema linking, limited generalization across SQL dialects, and the need for domain-specific understanding. In this study, we propose a Single-Agent Self-Refinement with Ensemble Voting (SSEV) pipeline built on PET-SQL that operates without ground-truth data, integrating self-refinement with Weighted Majority Voting (WMV) and its randomized variant (RWMA). Experimental results show that the SSEV achieves competitive performance across multiple benchmarks, attaining execution accuracies of 85.5% on Spider 1.0-Dev, 86.4% on Spider 1.0-Test, and 66.3% on BIRD-Dev. Building on insights from the SSEV pipeline, we further propose ReCAPAgent-SQL (Refinement-Critique-Act-Plan agent-based SQL framework) to address the growing complexity of enterprise databases and real-world Text-to-SQL tasks. The framework integrates multiple specialized agents for planning, external knowledge retrieval, critique, action generation, self-refinement, schema linking, and result validation, enabling iterative refinement of SQL predictions through agent collaboration. ReCAPAgent-SQL's WMA results achieve 31% execution accuracy on the first 100 queries of Spider 2.0-Lite, demonstrating significant improvements in handling real-world enterprise scenarios. Overall, our work facilitates the deployment of scalable Text-to-SQL systems in practical settings, supporting better data-driven decision-making at lower cost and with greater efficiency.


翻译:文本到SQL已成为一个重要的研究领域,特别是在大语言模型快速发展的背景下。该技术使用户能够通过自然语言而非SQL查询数据库,显著降低了数据分析的门槛。然而,由于用户查询的歧义性、模式链接的复杂性、跨SQL方言的泛化能力有限以及对领域特定理解的需求,从自然语言生成准确的SQL仍然具有挑战性。在本研究中,我们提出了一种基于PET-SQL构建的单智能体自我精炼与集成投票(SSEV)流程,该流程无需真实数据即可运行,将自我精炼与加权多数投票(WMV)及其随机化变体(RWMA)相结合。实验结果表明,SSEV在多个基准测试中取得了具有竞争力的性能,在Spider 1.0-Dev上的执行准确率达到85.5%,在Spider 1.0-Test上达到86.4%,在BIRD-Dev上达到66.3%。基于对SSEV流程的深入分析,我们进一步提出了ReCAPAgent-SQL(基于精炼-评判-行动-规划智能体的SQL框架),以应对日益复杂的企业数据库和现实世界文本到SQL任务。该框架集成了多个专门智能体,分别负责规划、外部知识检索、评判、行动生成、自我精炼、模式链接和结果验证,通过智能体协作实现SQL预测的迭代精炼。ReCAPAgent-SQL的加权多数投票结果在Spider 2.0-Lite的前100个查询上实现了31%的执行准确率,在处理现实企业场景方面展现出显著改进。总体而言,我们的工作促进了可扩展文本到SQL系统在实际环境中的部署,以更低的成本和更高的效率支持更好的数据驱动决策。

0
下载
关闭预览

相关内容

SQL 全名是结构化查询语言,是用于数据库中的标准数据查询语言,IBM 公司最早使用在其开发的数据库系统中。
【ICML2025】大语言模型是自我示范预选择器
专知会员服务
12+阅读 · 2025年6月9日
利用多个大型语言模型:关于LLM集成的调研
专知会员服务
35+阅读 · 2025年2月27日
【博士论文】面向数据的语言生成模型研究
专知会员服务
24+阅读 · 2025年1月19日
大型语言模型:原理、实现与发展
专知会员服务
102+阅读 · 2023年11月28日
LLM in Medical Domain: 大语言模型在医学领域的应用
专知会员服务
103+阅读 · 2023年6月17日
「基于深度学习的 SQL 生成」2022研究综述
专知会员服务
28+阅读 · 2022年8月12日
金融领域自然语言处理研究资源大列表
专知
13+阅读 · 2020年2月27日
自然语言生成资源列表
专知
17+阅读 · 2020年1月4日
干货|当深度学习遇见自动文本摘要,seq2seq+attention
机器学习算法与Python学习
10+阅读 · 2018年5月28日
自然语言处理(NLP)数据集整理
论智
20+阅读 · 2018年4月8日
NLP中自动生产文摘(auto text summarization)
机器学习研究会
14+阅读 · 2017年10月10日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
25+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
VIP会员
相关VIP内容
【ICML2025】大语言模型是自我示范预选择器
专知会员服务
12+阅读 · 2025年6月9日
利用多个大型语言模型:关于LLM集成的调研
专知会员服务
35+阅读 · 2025年2月27日
【博士论文】面向数据的语言生成模型研究
专知会员服务
24+阅读 · 2025年1月19日
大型语言模型:原理、实现与发展
专知会员服务
102+阅读 · 2023年11月28日
LLM in Medical Domain: 大语言模型在医学领域的应用
专知会员服务
103+阅读 · 2023年6月17日
「基于深度学习的 SQL 生成」2022研究综述
专知会员服务
28+阅读 · 2022年8月12日
相关资讯
金融领域自然语言处理研究资源大列表
专知
13+阅读 · 2020年2月27日
自然语言生成资源列表
专知
17+阅读 · 2020年1月4日
干货|当深度学习遇见自动文本摘要,seq2seq+attention
机器学习算法与Python学习
10+阅读 · 2018年5月28日
自然语言处理(NLP)数据集整理
论智
20+阅读 · 2018年4月8日
NLP中自动生产文摘(auto text summarization)
机器学习研究会
14+阅读 · 2017年10月10日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
25+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员