Text-to-SQL is an important task that helps people obtain information from databases by automatically generating SQL queries. Considering the brilliant performance, approaches based on Large Language Models (LLMs) become the mainstream for text-to-SQL. Among these approaches, automated correction is an effective approach that further enhances performance by correcting the mistakes in the generated results. The existing correction methods require LLMs to directly correct with generated SQL, while previous research shows that LLMs do not know how to detect mistakes, leading to poor performance. Therefore, in this paper, we propose to employ the decomposed correction to enhance text-to-SQL performance. We first demonstrate that decomposed correction outperforms direct correction since detecting and fixing mistakes with the results of the decomposed sub-tasks is easier than with SQL. Based on this analysis, we introduce Decomposed Automation Correction (DAC), which corrects SQL by decomposing text-to-SQL into entity linking and skeleton parsing. DAC first generates the entity and skeleton corresponding to the question and then compares the differences between the initial SQL and the generated entities and skeleton as feedback for correction. Experimental results show that our method improves performance by $3.7\%$ on average of Spider, Bird, and KaggleDBQA compared with the baseline method, demonstrating the effectiveness of DAC.
翻译:文本到SQL是一项重要任务,其通过自动生成SQL查询帮助人们从数据库中获取信息。鉴于其卓越性能,基于大语言模型的方法已成为文本到SQL领域的主流。在这些方法中,自动校正是一种通过修正生成结果中的错误来进一步提升性能的有效途径。现有校正方法要求大语言模型直接对生成的SQL进行修正,而先前研究表明大语言模型不擅长错误检测,导致性能不佳。因此,本文提出采用分解式校正来提升文本到SQL性能。我们首先论证分解式校正优于直接校正,因为通过分解子任务的结果进行错误检测与修正比直接处理SQL更为容易。基于此分析,我们提出分解式自动校正方法,该方法通过将文本到SQL分解为实体链接和骨架解析来实现SQL校正。DAC首先生成问题对应的实体与骨架,随后通过比较初始SQL与生成实体及骨架的差异作为校正反馈。实验结果表明,在Spider、Bird和KaggleDBQA数据集上,我们的方法相较于基线方法平均性能提升$3.7\%$,验证了DAC的有效性。