arXiv:2606.08245cs.CL2026-06

从失败中提炼生成规则,实现零样本文本转SQL的高准确率。

ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQL

论文配图:ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQL
图 1 · 摘自论文原文
  • 通过失败案例分析提取核心生成规则,构建零样本推理框架。
  • 在Spider数据集上达87.2%(验证集)和88.6%(测试集)执行准确率。
  • 适用于缺乏标注数据的跨领域场景,尤其适合资源受限的部署。

文本转SQL将自然语言转化为可执行的SQL查询。基于大语言模型的少样本上下文学习方法表现优异,但依赖示例限制了跨领域泛化能力,并占用大量上下文空间。现有零样本方法因缺乏有效生成约束,仍无法达到少样本水平。我们观察到,大模型在零样本文本转SQL中的失败并非随机,而是呈现系统性、重复性的模式。基于此,我们提出一个全零样本框架,通过基于Map-Reduce的规则提炼管道从失败案例中提炼核心生成规则,并通过三个互补模块提升生成质量:知识增强的模式表示,补充数据定义语言中的语义缺失;规则驱动的结构化推理框架,抑制结构偏差;以及执行引导的早期停止,实现低成本自纠正。在Spider数据集上,该框架在验证集和测试集分别达到87.2%和88.6%的执行准确率,刷新零样本新纪录,超越多个基于GPT-4/4o的少样本与微调方法。在领域特定数据集UrbanPlan上达到81.3%,证明规则提炼方法具有跨领域泛化能力。此外,使用40亿参数模型时,其性能超过多个领先闭源模型的零样本基线,体现强模型泛化性。

原文摘要 · Abstract (English)

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.

文本转SQL零样本学习规则提炼大模型推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。