arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2408.16991cs.CL
收藏

面向真实场景的SQL检查与精炼的工具辅助智能体

Tool-Assisted Agent on SQL Inspection and Refinement in Real-World Scenarios

Beihang University(北京航空航天大学);Zhongguancun Laboratory(中关村实验室)

Zhongyuan Wang, Richong Zhang, Zhijie Nie, Jaein Kim

AI总结:

本文提出一种配备检索器和检测器的工具辅助智能体框架,用于诊断和纠正SQL查询中的数据库不匹配问题,并构建了Spider-Mismatch数据集,在多个基准上取得了最优性能。

摘要:

近期的Text-to-SQL方法通过引入数据库管理系统的反馈来利用大语言模型(LLMs)。虽然这些方法能有效处理SQL查询中的执行错误,但在数据库不匹配问题上表现不佳——这类错误不会触发执行异常。数据库不匹配包括条件不匹配和更严格的约束不匹配等问题,这两类问题在真实场景中更为普遍。为应对这些挑战,我们提出了一种用于SQL检查与精炼的工具辅助智能体框架,为基于LLM的智能体配备了两个专用工具:一个检索器和一个检测器,旨在诊断并纠正存在数据库不匹配的SQL查询。这些工具增强了LLM更有效地处理真实世界查询的能力。我们还引入了Spider-Mismatch,这是一个专门构建的新数据集,用于反映真实场景中遇到的条件不匹配问题。实验结果表明,我们的方法在少样本设置下,在Spider和Spider-Realistic数据集的平均结果上取得了最高性能,并且在更贴近真实的数据集Spider-Mismatch上显著优于基线方法。

英文摘要:

Recent Text-to-SQL methods leverage large language models (LLMs) by incorporating feedback from the database management system. While these methods effectively address execution errors in SQL queries, they struggle with database mismatches -- errors that do not trigger execution exceptions. Database mismatches include issues such as condition mismatches and stricter constraint mismatches, both of which are more prevalent in real-world scenarios. To address these challenges, we propose a tool-assisted agent framework for SQL inspection and refinement, equipping the LLM-based agent with two specialized tools: a retriever and a detector, designed to diagnose and correct SQL queries with database mismatches. These tools enhance the capability of LLMs to handle real-world queries more effectively. We also introduce Spider-Mismatch, a new dataset specifically constructed to reflect the condition mismatch problems encountered in real-world scenarios. Experimental results demonstrate that our method achieves the highest performance on the averaged results of the Spider and Spider-Realistic datasets in few-shot settings, and it significantly outperforms baseline methods on the more realistic dataset, Spider-Mismatch.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑