发表机构
POSTECH; KAIST(浦项科技大学; 韩国科学技术院)
机构由 AI 辅助整理,请以论文原文为准。AI 中文总结
针对NL2SQL中LLM生成SQL执行成功但结果错误的问题,提出基于错误分类法的TEG方法,通过掩码相关构造和编辑指令生成候选修复,利用执行反馈选择,在NL2SQL-BUGs上单错误准确率47.3,优于基线。
AI 中文摘要
大型语言模型根据自然语言问题编写的 SQL 查询可以成功执行,但可能产生不正确的结果,因此仅凭执行结果无法揭示需要修复的内容。错误分类法说明了查询为何错误,但未指出何处查看或如何更改。现有方法可以通过反馈、错误报告或带有未掩码查询的生成计划来指导 SQL 纠正。我们引入了 TEG(基于分类法的错误定位),它将提供的诊断转化为自然语言到 SQL(NL2SQL)纠正的结构化输入。类型特定规则将每种错误类型映射到需要重新考虑的构造类别和需要请求的编辑操作。TEG 在适用时掩码查询中选定的构造,并在编辑指令中说明该操作。TEG 根据此输入生成候选纠正,使用执行反馈指导候选选择,并针对具有多个错误的查询一次一个注释地重复该过程。在 NL2SQL-BUGs 上,TEG 使用 Qwen2.5-7B-Instruct 达到了 47.3 的单错误执行准确率和 37.0 的总体准确率。在主要比较中评估的模型大小和思考模式中,TEG 在单错误查询上优于所有评估的基线,即使基线收到相同的错误类型注释。在预测类型下,TEG 在单错误查询上仍高于直接 LLM 纠正和 ErrorLLM。
英文摘要
SQL queries that large language models write from natural language questions can execute successfully yet produce incorrect results, so execution alone does not reveal what to fix. An error taxonomy says why the query is wrong, but not where to look or how to change it. Existing methods can guide SQL correction through feedback, error reports, or generated plans alongside an unmasked query. We introduce TEG(Taxonomy-guided Error Grounding), which turns a supplied diagnosis into a structured correction input for natural language-to-SQL (NL2SQL) correction. Type-specific rules map each error type to construct classes to reconsider and an edit operation to request. TEG masks the selected constructs in the query when applicable and states that operation in an edit instruction. TEG generates candidate corrections from this input, uses execution feedback to guide candidate selection, and repeats the process one annotation at a time for queries with several errors. On NL2SQL-BUGs, TEG reaches 47.3 single-error execution accuracy and 37.0 overall with Qwen2.5-7B-Instruct. Across the model sizes and thinking modes evaluated in the main comparison, TEG outperforms all evaluated baselines on single-error queries, even when the baselines receive the same error-type annotations. With predicted types, TEG stays above direct LLM correction and ErrorLLM on single-error queries.
Comments32 pages