arXiv:2409.15907cs.CLcs.AI2024-09中稿 · ECAI 2024被引 6

通过注入领域数据库知识,提升大模型生成准确SQL的能力。

Enhancing Text-to-SQL Capabilities of Large Language Models via Domain Database Knowledge Injection

  • 将领域数据库知识注入大模型,增强其对表结构的理解。
  • 在多个模型上显著提升执行匹配率(EX)和精确匹配率(EM)。
  • 方法通用性强,适用于多种下游Text-to-SQL任务。

Text-to-SQL是语义解析的一个子任务,随着大语言模型(LLMs)的发展取得了快速进展。然而,由于幻觉问题及缺乏领域特定数据库知识(如表模式和单元格值),大模型在生成表名、列名以及将值正确匹配到列时仍会出错。本文提出一种知识注入方法,通过引入先验知识来增强大模型对模式内容的理解,从而提升其在Text-to-SQL任务中的表现。实验结果表明,在领域特定数据库知识上进行预训练,并在下游Text-to-SQL任务上微调,能显著提高执行匹配率(EX)和精确匹配率(EM);该方法有效减少了列名生成错误和值列匹配错误。此外,注入知识的模型可广泛应用于多种下游Text-to-SQL任务,证明了该方法的通用性。

原文摘要 · Abstract (English)

Text-to-SQL is a subtask in semantic parsing that has seen rapid progress with the evolution of Large Language Models (LLMs). However, LLMs face challenges due to hallucination issues and a lack of domain-specific database knowledge(such as table schema and cell values). As a result, they can make errors in generating table names, columns, and matching values to the correct columns in SQL statements. This paper introduces a method of knowledge injection to enhance LLMs' ability to understand schema contents by incorporating prior knowledge. This approach improves their performance in Text-to-SQL tasks. Experimental results show that pre-training LLMs on domain-specific database knowledge and fine-tuning them on downstream Text-to-SQL tasks significantly improves the Execution Match (EX) and Exact Match (EM) metrics across various models. This effectively reduces errors in generating column names and matching values to the columns. Furthermore, the knowledge-injected models can be applied to many downstream Text-to-SQL tasks, demonstrating the generalizability of the approach presented in this paper.

Text-to-SQL大模型知识注入数据库

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