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

CodeS:构建面向文本到SQL的开源语言模型

CodeS: Towards Building Open-source Language Models for Text-to-SQL

Renmin University of China(中国人民大学);AI-Finance

Haoyang Li, Jing Zhang, Hanbing Liu, Ju Fan, Xiaokang Zhang, Jun Zhu, Renjie Wei, Hongyan Pan, Cuiping Li, Hong Chen

AI总结:

本文提出CodeS系列开源语言模型(1B-15B参数),通过SQL中心语料增量预训练、提示构建和双向数据增强,在多个文本到SQL基准上以更小参数规模实现SOTA准确率与鲁棒性。

摘要:

语言模型在将自然语言问题翻译为SQL查询(文本到SQL)的任务上已展现出良好的性能。然而,大多数最先进(SOTA)方法依赖功能强大但闭源的大语言模型(LLMs),如ChatGPT和GPT-4,这些模型可能存在模型架构不透明、数据隐私风险以及推理开销高昂等局限性。为解决这些局限性,我们提出了CodeS,这是一系列参数规模从1B到15B的预训练语言模型,专门针对文本到SQL任务设计。CodeS是一个完全开源的语言模型,以更小的参数规模实现了更高的准确率。本文研究了构建CodeS过程中的研究挑战。为增强CodeS的SQL生成能力,我们采用了一种增量预训练方法,使用专门构建的以SQL为中心的语料库。在此基础上,我们通过策略性的提示构建和双向数据增强技术,解决了模式链接和快速领域适应的挑战。我们在多个数据集上进行了全面评估,包括广泛使用的Spider基准、新发布的BIRD基准、鲁棒性诊断基准(如Spider-DK、Spider-Syn、Spider-Realistic和Dr.Spider),以及为金融和学术应用创建的两个真实世界数据集。实验结果表明,我们的CodeS在几乎所有具有挑战性的文本到SQL基准上均达到了新的SOTA准确率和鲁棒性。

英文摘要:

Language models have shown promising performance on the task of translating natural language questions into SQL queries (Text-to-SQL). However, most of the state-of-the-art (SOTA) approaches rely on powerful yet closed-source large language models (LLMs), such as ChatGPT and GPT-4, which may have the limitations of unclear model architectures, data privacy risks, and expensive inference overheads. To address the limitations, we introduce CodeS, a series of pre-trained language models with parameters ranging from 1B to 15B, specifically designed for the text-to-SQL task. CodeS is a fully open-source language model, which achieves superior accuracy with much smaller parameter sizes. This paper studies the research challenges in building CodeS. To enhance the SQL generation abilities of CodeS, we adopt an incremental pre-training approach using a specifically curated SQL-centric corpus. Based on this, we address the challenges of schema linking and rapid domain adaptation through strategic prompt construction and a bi-directional data augmentation technique. We conduct comprehensive evaluations on multiple datasets, including the widely used Spider benchmark, the newly released BIRD benchmark, robustness-diagnostic benchmarks such as Spider-DK, Spider-Syn, Spider-Realistic, and Dr.Spider, as well as two real-world datasets created for financial and academic applications. The experimental results show that our CodeS achieves new SOTA accuracy and robustness on nearly all challenging text-to-SQL benchmarks.

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

↑