通过深度模式探索与规则纠错,提升文本转SQL的准确性。
DexterSQL: Deep Schema Exploration and Rule-based Correction for Text-to-SQL Generation

- 引入深层模式探索器分析列数据分布,识别模糊列关系
- 基于训练库生成通用纠错规则,修复模型重复错误
- 采用依赖树结构分解问题,生成更准确的SQL骨架
基于提示的文本转SQL方法(不微调大模型)存在三大问题:依赖粗粒度模式信息难以区分模糊列、无法捕捉重复生成错误、在复杂查询中易出现条件遗漏、幻觉或错位。本文提出DexterSQL,一种无需微调的文本转SQL系统,包含三项创新:(i) 深层模式探索器,分析列的单独与联合数据分布,揭示其关系与角色;(ii) 无数据库依赖的规则生成器,在训练库中挖掘生成与真实SQL的差异,提炼出可跨库复用的纠错规则;(iii) 多路径SQL生成机制,利用问题句法结构构建依赖树中间表示,指导分解为SQL骨架。DexterSQL在开源与闭源模型上均超越现有水平。使用GPT-OSS-120B(开权重)在BIRD-Dev上达到67.6%准确率,提升至少2.7%;使用GPT-4o与GPT-5.2(闭权重)分别达71.6%与72.2%,提升至少0.9%。
原文摘要 · Abstract (English)
Prompting-based (\textit{i}.\textit{e}., non-fine-tuning) Text-to-SQL methods, where underlying large language model parameters are not changed for the task, face three problems: (\textit{i})~relying on coarse-grained schema information that may not reveal the fine-grained relationships needed to distinguish ambiguous columns, (\textit{ii})~not capturing recurring SQL-generation failures, and (\textit{iii})~suffering from omission, hallucination, or misplacement of conditions in complex questions. This paper develops \textsc{DexterSQL}, a prompting/non-fine-tuning-based Text-to-SQL system that improves SQL generation with three novel components: (\textit{i})~\emph{deep schema explorator} that identifies ambiguous columns, analyzes their individual and joint data distributions to uncover their relationships and the distinct role of each, (\textit{ii})~\emph{database-agnostic rule creator} that mines mismatches between generated and gold SQL only on the training database and converts them into database-agnostic corrective rules that capture recurring LLM failure patterns; and (\textit{iii})~\emph{multi-path SQL generation} that introduces a dependency-tree-based intermediate representation that uses the question's sentence structure to guide its decomposition into an SQL skeleton for final SQL generation. \textsc{DexterSQL} achieves a higher accuracy compared to the state-of-the-art using both open-source/weight and closed-source/weight models. Particularly, \textsc{DexterSQL}'s shows a high improvement of at least 2.7\% using an open-weight model (GPT-OSS-120B) on BIRD-Dev, with total accuracy 67.6\%. \textsc{DexterSQL} also shows better improvement of at least 0.9\% using closed-weight models, with total accuracy 71.6\% and 72.2\% on BIRD-Dev with GPT-4o and GPT-5.2.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。