arXiv:2502.06759cs.CLcs.AI2025-02被引 3

用思维链提升文本转SQL的准确率和可解释性。

Rationalization Models for Text-to-SQL

  • 通过人工标注少量样本,用大模型生成分步推理的SQL中间过程。
  • 在BIRD数据集上,复杂查询的执行准确率显著提升。
  • 适合需要可解释性的文本转数据库场景,如智能客服、数据分析。

我们提出一种生成思维链(CoT)推理过程的框架,用于增强文本转SQL模型的微调效果。这些推理包含中间SQL语句和解释,作为构建最终查询的逐步步骤。首先手动标注少量示例,再通过迭代式动态少样本知识蒸馏,从教师模型中提取知识。随后在验证过的分解查询上训练理性化模型,从而生成大规模合成的CoT标注。在BIRD数据集上,对比了使用与不使用该推理过程的小型语言模型微调结果,发现分步生成显著提升了执行准确率,尤其在中高复杂度查询上;同时增强了模型输出的可解释性。

原文摘要 · Abstract (English)

We introduce a framework for generating Chain-of-Thought (CoT) rationales to enhance text-to-SQL model fine-tuning. These rationales consist of intermediate SQL statements and explanations, serving as incremental steps toward constructing the final SQL query. The process begins with manually annotating a small set of examples, which are then used to prompt a large language model in an iterative, dynamic few-shot knowledge distillation procedure from a teacher model. A rationalization model is subsequently trained on the validated decomposed queries, enabling extensive synthetic CoT annotations for text-to-SQL datasets. To evaluate the approach, we fine-tune small language models with and without these rationales on the BIRD dataset. Results indicate that step-by-step query generation improves execution accuracy, especially for moderately and highly complex queries, while also enhancing explainability.

文本转SQL思维链可解释性知识蒸馏

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