自然语言到SQL(NL2SQL)转换是研究人员和企业关注的重要问题,因为关系数据库在广泛的实际问题中具有普遍的重要性。尽管大语言模型(LLMs)的能力迅速提升,NL2SQL尚未达到与人类专家SQL编写者同等的准确性,因此需要进一步改进NL2SQL算法。本研究提出了一种新的多代理方法用于NL2SQL,该方法在BIg Bench for LaRge-scale Database(BIRD)基准上实现了78.1%的语义准确性。我们的方法利用了用户提供的模式的语义丰富表示,添加了用户提供的业务规则,并生成了准确的SQL查询。本研究的主要贡献包括(a)我们设计了一种优化的多代理解决方案中的新调度器,该调度器利用LLMs进行计划、协调、反思和自我纠正以生成准确的SQL查询;(b)我们开发了一种先进的模式增强方法,创建了上下文感知的元数据以提高准确性;(c)我们通过在BIRD-SQL基准上评估该方法,展示了其在不同领域和数据集上的准确性和泛化能力。
英文摘要:
Natural language to SQL (NL2SQL) conversion is an important problem for researchers and enterprises due to the ubiquitous importance of relational databases in broad-ranging practical problems. Despite the rapid advancements in the capabilities of LLMs, NL2SQL has not reached parity in accuracy with human expert SQL writers, hence needing additional improvements in NL2SQL algorithms. This study presents a new multi-agent method for NL2SQL that achieves 78.1% semantic accuracy on the BIg Bench for LaRge-scale Database (BIRD) benchmark. Our method leverages a semantically enriched representation of user-provided schema, adds user-provided business rules, and produces accurate SQL queries. The main contributions of this study are (a) We designed an optimized new orchestrator in a multi-agent solution that uses LLMs to plan, orchestrate, reflect, and self-correct to generate accurate SQL queries, (b) We developed an advanced schema enrichment method that creates context-aware metadata to improve accuracy, and (c) We demonstrated the accuracy and generalizability of the method across different domains and datasets by evaluating it on the BIRD-SQL benchmark.
$R^3$: "This is My SQL, Are You With Me?" A Consensus-Based Multi-Agent System for Text-to-SQL Tasks
School of Engineering, Westlake University(西湖大学工程学院);University of Michigan(密歇根大学);Carnegie Mellon University(卡内基梅隆大学);School of Mathematical Science, Shanghai Jiao Tong University(上海交通大学数学科学学院)
From Questions to Queries: An AI-powered Multi-Agent Framework for Spatial Text-to-SQL
Geoinformation and Big Data Research Laboratory, Department of Geography, The Pennsylvania State University(宾夕法尼亚州立大学地理系地理信息与大数据研究实验室);Institute for Computational and Data Sciences and Department of Geography, The Pennsylvania State University(宾夕法尼亚州立大学计算与数据科学研究所及地理系)
A Multi-agent Text2SQL Framework using Small Language Models and Execution Feedback
Griffith University (Australia)(格里菲斯大学);VinUniversity (Vietnam)(文大学);Humboldt-Universitat zu Berlin (Germany)(柏林洪堡大学);The University of Queensland, Australia (2025)(昆士兰大学)
TRUST-SQL: Tool-Integrated Multi-Turn Reinforcement Learning for Text-to-SQL over Unknown Schemas
Beijing University of Posts and Telecommunications(北京邮电大学);State Key Lab of Processors, Institute of Computing Technology, CAS(中国科学院计算技术研究所处理器国家重点实验室);University of Chinese Academy of Sciences(中国科学院大学);Meituan(美团)
BAPPA: Benchmarking Agents, Plans, and Pipelines for Automated Text-to-SQL Generation
Center for Computational & Data Sciences, Independent University, Bangladesh(计算与数据科学中心,独立大学,孟加拉国);University of Massachusetts Amherst(马萨诸塞大学阿默斯特分校);University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)
LLM-Based SQL Generation: Prompting, Self-Refinement, and Adaptive Weighted Majority Voting
Institute of Information Management(信息管理研究所);National Yang Ming Chiao Tung University(阳明交通大学);R. B. Annis School of Engineering(R. B. Annis工程学院);University of Indianapolis(印第安纳大学)
Toward Auditable Neuro-Symbolic Reasoning in Pathology: SQL as an Explicit Trace of Evidence
Capital Normal University, Beijing, China(首都师范大学);Leibniz-Institut für Analytische Wissenschaften-ISAS, Dortmund, Germany(莱比锡分析科学研究所-ISAS);Harbin Institute of Technology, Shenzhen, China(哈尔滨工业大学深圳校区)
Evaluating and Enhancing LLMs for Multi-turn Text-to-SQL with Multiple Question Types
School of Computer Science, Harbin University of Science and Technology(哈尔滨理工大学计算机科学学院);Faculty of Computing, Harbin Institute of Technology(哈尔滨工业大学计算学部)
SeqGenSQL -- A Robust Sequence Generation Model for Structured Query Language
UC Berkeley(加州大学伯克利分校);Google Research(谷歌研究院)
我们探索使用T5(Raffel et al.(2019))将自然语言问题直接转换为SQL语句。与存储在数据库内的信息接口的通用自然语言需要将自然语言问题灵活地转换成数据库查询。性能最好的文本到SQL系统通过首先将问题转换为中间逻辑形式(LF)来完成这项任务(Lyu et al.(2020))。虽然LF提供了方便的中间表示并简化了查询生成,但它们引入了额外的复杂性和注释需求。然而,直接将问题转换为SQL语句的弱监督建模已经证明在没有LF提供的脚手架的情况下更加困难(Min等人(2019))。我们使用T5(Raffel et al.(2019))将问题直接转换为SQL语句,T5是一种预先训练的文本到文本生成模型,经过修改以支持指针生成器风格的解码(见et al.(2017))。我们探索使用问题扩充表模式信息和使用自动生成的银训练数据。由此产生的模型在WikiSQL(Zhong et al.(2017))测试数据集上实现了90.5%的执行准确率,这是弱监督SQL生成的最新技术。与现有技术相比,性能绝对提高了6.6%(Min等人(2019)),接近使用LF的最先进系统的性能。
Large Language Models for Structured Clinical Data Analysis: Dual-Agent Grounding and Validation
Harvard Medical School(哈佛医学院);Wayne State University School of Medicine(韦恩州立大学医学院);Women & Infants Hospital of Rhode Island(罗德岛妇女与婴儿医院);Warren Alpert Medical School of Brown University(布朗大学沃伦·阿尔珀特医学院);Duke University School of Medicine(杜克大学医学院)
SQL-o1: Automatic Text-to-SQL Program Synthesis via Self-Reward Heuristic Search
School of Computer Science, Beijing University of Posts and Telecommunications, China(北京邮电大学计算机科学学院);College of Computing and Data Science, Nanyang Technological University, Singapore(南洋理工大学计算机与数据科学学院);State Key Laboratory of Networking and Switching Technology, Beijing University of Posts and Telecommunications, China(北京邮电大学网络与交换技术国家重点实验室);College of Computer Science, Sichuan University, Chengdu, China(四川大学计算机学院)
AskDB: An LLM Agent for Natural Language Interaction with Relational Databases
IT Operations, Mantu Group(Mantu集团信息技术部);Faculty of Engineering, Vietnamese-German University(越南-德国大学工程学院);Computer Science and Information Engineering, National Taiwan University(国立台湾大学计算机科学与工程系)