arXiv:2409.15985cs.AI2024-09被引 12

开源小模型+自修正机制,让非专业人士也能准确将自然语言转为SQL。

DataGpt-SQL-7B: An Open-Source Language Model for Text-to-SQL

  • 用2万+样本微调小模型,提升自然语言转SQL的效率。
  • 在Spider数据集上达到87.2%准确率,代码正确性显著提升。
  • 适合数据查询新手和需规避闭源模型风险的团队使用。

为解决将自然语言查询转换为SQL命令的关键问题,我们提出一套轻量级微调模型与自修正机制,旨在降低非专家用户的数据访问与分析门槛,并缓解闭源大模型带来的风险。具体而言,我们构建了包含超过2万条样本的Text-to-SQL数据集及偏好数据集,以提升该领域生成效率。为进一步保障生成代码的有效性,系统集成了一个代码校正模块。我们的DataGpt-sql系统在Spider-dev上取得了87.2%的准确率,充分验证了该方案在文本转SQL任务中的有效性。代码、数据与模型均已开源,详见 https://github.com/CainiaoTechAi/datagpt-sql-7b。

原文摘要 · Abstract (English)

In addressing the pivotal role of translating natural language queries into SQL commands, we propose a suite of compact, fine-tuned models and self-refine mechanisms to democratize data access and analysis for non-expert users, mitigating risks associated with closed-source Large Language Models. Specifically, we constructed a dataset of over 20K sample for Text-to-SQL as well as the preference dateset, to improve the efficiency in the domain of SQL generation. To further ensure code validity, a code corrector was integrated into the model. Our system, DataGpt-sql, achieved 87.2\% accuracy on the spider-dev, respectively, showcasing the effectiveness of our solution in text-to-SQL conversion tasks. Our code, data, and models are available at \url{https://github.com/CainiaoTechAi/datagpt-sql-7b}

文本转SQL开源模型数据查询

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