arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.11984cs.DB
收藏

NL2SQL-BUGs: 一个用于检测NL2SQL翻译语义错误的基准

NL2SQL-BUGs: A Benchmark for Detecting Semantic Errors in NL2SQL Translation

The Hong Kong University of Science and Technology (Guangzhou)(香港科技大学(广州))

Xinyu Liu, Shuyu Shen, Boyan Li, Nan Tang, Yuyu Luo

AI总结:

NL2SQL-BUGs是一个用于检测NL2SQL翻译中语义错误的基准,通过两级分类法识别9大类31子类错误,揭示当前大语言模型在语义错误检测上的不足。

摘要:

自然语言到SQL(即NL2SQL)翻译对于普及数据库访问至关重要,但即使是最先进的模型也经常生成语义上不正确的SQL查询,阻碍了数据库供应商广泛采用这些技术。尽管现有的NL2SQL基准主要关注正确查询翻译,我们认为一个专门用于识别NL2SQL翻译中常见错误的基准同样重要,因为准确检测这些错误是任何后续修正(无论是由人还是模型进行)的前提。为了解决这一差距,我们提出了NL2SQL-BUGs,这是首个专门用于检测和分类NL2SQL翻译中语义错误的基准。NL2SQL-BUGs采用两级分类法,系统地分类语义错误,涵盖9个主要类别和31个子类别。该基准包含2018个专家标注的实例,每个实例包含一个自然语言查询、数据库模式和SQL查询,并对语义不正确的查询进行详细错误标注。通过全面的实验,我们证明当前大型语言模型在语义错误检测上存在显著局限性,平均检测准确率为75.16%。具体而言,我们的方法成功检测了106个错误(占BIRD数据集中先前未被检测到的错误的6.91%)。这突显了NL2SQL系统中语义错误检测的重要性。该基准在https://nl2sql-bugs.github.io/上公开可用。

英文摘要:

Natural Language to SQL (i.e., NL2SQL) translation is crucial for democratizing database access, but even state-of-the-art models frequently generate semantically incorrect SQL queries, hindering the widespread adoption of these techniques by database vendors. While existing NL2SQL benchmarks primarily focus on correct query translation, we argue that a benchmark dedicated to identifying common errors in NL2SQL translations is equally important, as accurately detecting these errors is a prerequisite for any subsequent correction-whether performed by humans or models. To address this gap, we propose NL2SQL-BUGs, the first benchmark dedicated to detecting and categorizing semantic errors in NL2SQL translation. NL2SQL-BUGs adopts a two-level taxonomy to systematically classify semantic errors, covering 9 main categories and 31 subcategories. The benchmark consists of 2,018 expert-annotated instances, each containing a natural language query, database schema, and SQL query, with detailed error annotations for semantically incorrect queries. Through comprehensive experiments, we demonstrate that current large language models exhibit significant limitations in semantic error detection, achieving an average detection accuracy of 75.16%. Specifically, our method successfully detected 106 errors (accounting for 6.91%) in BIRD, a widely-used NL2SQL dataset, which were previously undetected annotation errors. This highlights the importance of semantic error detection in NL2SQL systems. The benchmark is publicly available at https://nl2sql-bugs.github.io/.

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

↑