arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.12379cs.AIcs.DBcs.PL
收藏

分析大型语言模型在 Text-to-SQL 合成中的有效性

Analyzing the Effectiveness of Large Language Models on Text-to-SQL Synthesis

University of Colorado Boulder(科罗拉多大学博尔德分校)

Richard Roberson, Gowtham Kaki, Ashutosh Trivedi

AI总结:

本文基于 spider 评估 LLM 的 Text-to-SQL 能力,比较 QLoRA 微调 WizardCoder-15B 与 GPT 少样本生成加零样本纠错方案,并归纳七类 SQL 错误。

摘要:

本研究考察了使用大型语言模型(LLM)进行 Text-to-SQL 程序合成的多种方法,重点关注所得结果与洞见。研究采用流行的 Text-to-SQL 数据集 spider,目标是输入自然语言问题及数据库模式,并输出正确的 SQL SELECT 查询。最初的方法是微调一个本地开源模型以生成 SELECT 查询。在 spider 数据集上使用 QLoRa 微调 WizardLM 的 WizardCoder-15B 模型后,生成查询的执行准确率最高升至 61%。第二种方法使用经过微调的 gpt-3.5-turbo-16k(少样本)加 gpt-4-turbo(零样本纠错),执行准确率最高达到 82.1%。在所有错误查询中,大多数可按出错原因归为七类:选择错误的列或错误的列顺序、按错误的列分组、预测条件中的错误值、使用与标准答案不同的聚合函数、JOIN 子句过多或过少、Spider 数据集内部的不一致,以及最后一类:查询结构完全错误。即便不是全部,大多数查询都属于这些类别;这有助于理解 LLM 程序合成目前仍存在哪些缺陷,以及可以在哪些方面改进。

英文摘要:

This study investigates various approaches to using Large Language Models (LLMs) for Text-to-SQL program synthesis, focusing on the outcomes and insights derived. Employing the popular Text-to-SQL dataset, spider, the goal was to input a natural language question along with the database schema and output the correct SQL SELECT query. The initial approach was to fine-tune a local and open-source model to generate the SELECT query. After QLoRa fine-tuning WizardLM's WizardCoder-15B model on the spider dataset, the execution accuracy for generated queries rose to a high of 61%. With the second approach, using the fine-tuned gpt-3.5-turbo-16k (Few-shot) + gpt-4-turbo (Zero-shot error correction), the execution accuracy reached a high of 82.1%. Of all the incorrect queries, most can be categorized into a seven different categories of what went wrong: selecting the wrong columns or wrong order of columns, grouping by the wrong column, predicting the wrong values in conditionals, using different aggregates than the ground truth, extra or too few JOIN clauses, inconsistencies in the Spider dataset, and lastly completely incorrect query structure. Most if not all of the queries fall into these categories and it is insightful to understanding where the faults still lie with LLM program synthesis and where they can be improved.

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

↑