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