arXiv:2605.19010cs.AI2026-05被引 2

用多智能体系统提升自然语言转SQL准确率

AgentNLQ: A General-Purpose Agent for Natural Language to SQL

论文配图:AgentNLQ: A General-Purpose Agent for Natural Language to SQL
图 1 · 摘自论文原文
  • 设计多智能体协同架构,通过规划与自我修正生成SQL
  • 在BIRD基准上实现78.1%语义准确率,优于人类专家
  • 适用于跨领域数据库,适合企业级数据查询场景

自然语言转SQL(NL2SQL)因关系型数据库的广泛应用而至关重要。尽管大模型能力快速提升,但其在准确性上仍未达到人类专家水平,亟需算法改进。本文提出一种新的多智能体NL2SQL方法,在大规模数据库基准BIRD上实现了78.1%的语义准确率。该方法利用语义增强的模式表示,融合用户提供的业务规则,生成高精度SQL。主要贡献包括:(a) 设计了优化的多智能体编排器,使用大模型进行计划、调度、反思与自纠错;(b) 开发了先进的模式增强方法,生成上下文感知的元数据以提升准确性;(c) 在BIRD-SQL基准上验证了方法在不同领域和数据集上的准确性和泛化能力。

原文摘要 · Abstract (English)

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.

自然语言转SQL多智能体大模型应用数据库查询

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。