ZAS-SQL: 从失败中提炼规则用于零样本文本到SQL
ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQL
AI总结:
提出ZAS-SQL零样本框架,通过Map-Reduce规则蒸馏从失败案例中提取核心生成规则,结合知识增强模式表示、规则驱动结构化推理和执行引导早停三个模块,在Spider上达到87.2%和88.6%执行准确率,超越多个少样本和微调方法。
摘要:
文本到SQL将自然语言转换为可执行的SQL查询。基于大语言模型(LLM)的少样本上下文学习方法表现出色,但其对示例的依赖限制了跨领域泛化,并消耗大量上下文窗口空间。现有的零样本方法缺乏有效的生成约束,仍落后于少样本方法。我们观察到LLM在零样本文本到SQL中的失败并非随机,而是表现出系统性的、重复出现的模式。基于这一观察,我们提出了一个完全零样本的文本到SQL框架,该框架通过基于Map-Reduce的规则蒸馏管道从失败案例中提炼核心生成规则,并通过三个互补模块提高生成质量:知识增强的模式表示,补充数据定义语言中缺失的语义;规则驱动的结构化推理框架,抑制结构偏差;以及执行引导的早停,实现低成本的自我纠正。在Spider上,所提出的框架在开发集和测试集上分别达到87.2%和88.6%的执行准确率,建立了新的零样本最先进水平,并超越了多个基于GPT-4/4o的少样本和微调方法。在领域特定数据集UrbanPlan上,它达到了81.3%,证实了规则蒸馏方法跨领域的泛化能力。此外,当配备4B参数模型时,该框架超越了领先闭源模型的零样本基线,展示了强大的模型通用性。
英文摘要:
Text-to-SQL translates natural language into executable SQL queries. Few-shot in-context learning methods built upon large language models (LLMs) achieve strong performance, yet their reliance on demonstrations limits cross-domain generalization and consumes substantial context window space. Existing zero-shot methods, lacking effective generation constraints, still fall short of few-shot approaches. We observe that LLM failures in zero-shot Text-to-SQL are not random but exhibit systematic, recurring patterns. Building on this observation, we propose a fully zero-shot Text-to-SQL framework that distills core generation rules from failure cases through a Map-Reduce-based rule distillation pipeline and improves generation quality via three complementary modules: knowledge-augmented schema representation, which supplements missing semantics in Data Definition Language; a rule-driven structured reasoning framework that suppresses structural deviations; and Execution-Guided Early Stopping, which enables low-cost self-correction. On Spider, the proposed framework achieves up to 87.2% and 88.6% execution accuracy on the Dev and Test sets, respectively, establishing a new zero-shot state-of-the-art and surpassing multiple few-shot and fine-tuning methods built upon GPT-4/4o. On the domain-specific dataset UrbanPlan, it achieves 81.3%, confirming that the rule distillation approach generalizes across domains. Moreover, when equipped with a 4B-parameter model, the framework surpasses zero-shot baselines of leading closed-source models, demonstrating strong model generality.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。