arXiv:2506.00391cs.CL2025-06ACL被引 21

用小模型分步解析SQL推理过程,提升纠错效率与准确性

SHARE: An SLM-based Hierarchical Action CorREction Assistant for Text-to-SQL

  • 用三个专用小模型分步处理:转为操作轨迹+两阶段精修
  • 在多种大模型上实现更精准的错误定位与修正,计算开销更低
  • 适合数据受限或隐私要求高的文本转SQL场景

当前文本转SQL的自纠错方法存在两大瓶颈:一是依赖大模型递归调用,导致计算开销倍增;二是大模型难以有效检测和修正声明式SQL错误,因缺乏可解释的推理路径。本文提出SHARE,一种基于小语言模型(SLM)的分层动作纠错助手,使大模型能更精准定位错误并高效修正。SHARE采用三阶段序列化流水线:首先将声明式SQL转换为揭示内在推理步骤的操作轨迹,再进行两阶段细粒度优化。我们还提出一种新颖的分层自进化策略,支持数据高效的训练。实验表明,SHARE显著提升了自纠错能力,并在不同大模型上保持鲁棒性。进一步分析显示,即使在低资源训练条件下,其性能依然强劲,对数据隐私敏感的文本转SQL应用尤为关键。

原文摘要 · Abstract (English)

Current self-correction approaches in text-to-SQL face two critical limitations: 1) Conventional self-correction methods rely on recursive self-calls of LLMs, resulting in multiplicative computational overhead, and 2) LLMs struggle to implement effective error detection and correction for declarative SQL queries, as they fail to demonstrate the underlying reasoning path. In this work, we propose SHARE, an SLM-based Hierarchical Action corREction assistant that enables LLMs to perform more precise error localization and efficient correction. SHARE orchestrates three specialized Small Language Models (SLMs) in a sequential pipeline, where it first transforms declarative SQL queries into stepwise action trajectories that reveal underlying reasoning, followed by a two-phase granular refinement. We further propose a novel hierarchical self-evolution strategy for data-efficient training. Experimental results demonstrate that SHARE effectively enhances self-correction capabilities while proving robust across various LLMs. Furthermore, our comprehensive analysis shows that SHARE maintains strong performance even in low-resource training settings, which is particularly valuable for text-to-SQL applications with data privacy constraints.

文本转SQL自纠错小模型分层推理

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