arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.17144cs.DBcs.AI
收藏

Metasql: 一种自然语言到SQL翻译的生成后排序框架

Metasql: A Generate-then-Rank Framework for Natural Language to SQL Translation

School of Computer Science, Fudan University, Shanghai, China(计算机科学学院,复旦大学,上海,中国)

Yuankai Fan, Zhenying He, Tonghui Ren, Can Huang, Yinan Jing, Kai Zhang, X. Sean Wang

AI总结:

Metasql通过引入查询元数据和学习排序算法,提升自然语言到SQL翻译的准确性。

摘要:

自然语言数据库接口(NLIDB)通过直观的自然语言交互使非技术用户能够访问数据库。高级方法利用神经序列到序列模型或大规模语言模型,通常使用自回归解码来依次生成唯一的SQL查询。尽管这些翻译模型大大提高了整体翻译准确性,在NLIDB基准测试中超过了70%,但使用自回归解码生成单个SQL查询可能导致次优输出,可能产生错误的翻译。在本文中,我们提出了Metasql,一种可以灵活整合到现有NLIDB中的统一生成后排序框架,以一致提高其翻译准确性。Metasql引入查询元数据来控制生成更好的SQL查询候选,并使用学习排序算法来检索全局优化的查询。具体而言,Metasql首先将给定的NL查询含义分解为一组可能的查询元数据,代表语义的基本概念。这些元数据随后用作语言约束,引导底层翻译模型生成一组候选SQL查询。最后,Metasql对候选者进行排序,以确定最适合给定NL查询的最佳匹配。进行了广泛的实验研究Metasql在两个公开的NLIDB基准上的表现。结果表明,使用Metasql可以有效提高翻译模型的性能。

英文摘要:

The Natural Language Interface to Databases (NLIDB) empowers non-technical users with database access through intuitive natural language (NL) interactions. Advanced approaches, utilizing neural sequence-to-sequence models or large-scale language models, typically employ auto-regressive decoding to generate unique SQL queries sequentially. While these translation models have greatly improved the overall translation accuracy, surpassing 70% on NLIDB benchmarks, the use of auto-regressive decoding to generate single SQL queries may result in sub-optimal outputs, potentially leading to erroneous translations. In this paper, we propose Metasql, a unified generate-then-rank framework that can be flexibly incorporated with existing NLIDBs to consistently improve their translation accuracy. Metasql introduces query metadata to control the generation of better SQL query candidates and uses learning-to-rank algorithms to retrieve globally optimized queries. Specifically, Metasql first breaks down the meaning of the given NL query into a set of possible query metadata, representing the basic concepts of the semantics. These metadata are then used as language constraints to steer the underlying translation model toward generating a set of candidate SQL queries. Finally, Metasql ranks the candidates to identify the best matching one for the given NL query. Extensive experiments are performed to study Metasql on two public NLIDB benchmarks. The results show that the performance of the translation models can be effectively improved using Metasql.

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

↑