arXiv:2503.19988cs.LGcs.AI2025-03ACL被引 32

用执行反馈优化大模型的思维链,提升自然语言转SQL准确率

ExCoT: Optimizing Reasoning for Text-to-SQL with Execution Feedback

  • 结合思维链与双策略偏好优化,仅用执行结果反馈训练
  • 在BIRD和Spider数据集上准确率分别提升至68.51%和86.59%
  • 无需人工标注或奖励模型,适合工业级文本转SQL应用

文本到SQL任务需要精确推理将自然语言问题转化为结构化查询。尽管大语言模型(LLMs)在多种推理任务中表现优异,但其在文本到SQL中利用思维链(CoT)推理的能力仍待挖掘。我们发现:零样本思维链增益有限,而无思维链的直接偏好优化(DPO)也仅带来微小提升。为此提出ExCoT框架,通过结合思维链与离策略及在线策略的DPO,仅依赖执行准确性作为反馈,迭代优化开源大模型。该方法无需奖励模型或人工标注偏好。实验表明,ExCoT使LLaMA-3 70B在BIRD开发集上的执行准确率从57.37%提升至68.51%,在Spider测试集上从78.81%提升至86.59%;Qwen-2.5-Coder也表现出类似改进。最优模型在单模型设置下达到BIRD和Spider的当前最佳性能,其中在BIRD测试集上达到68.53%。

原文摘要 · Abstract (English)

Text-to-SQL demands precise reasoning to convert natural language questions into structured queries. While large language models (LLMs) excel in many reasoning tasks, their ability to leverage Chain-of-Thought (CoT) reasoning for text-to-SQL remains underexplored. We identify critical limitations: zero-shot CoT offers minimal gains, and Direct Preference Optimization (DPO) applied without CoT yields marginal improvements. We propose ExCoT, a novel framework that iteratively optimizes open-source LLMs by combining CoT reasoning with off-policy and on-policy DPO, relying solely on execution accuracy as feedback. This approach eliminates the need for reward models or human-annotated preferences. Our experimental results demonstrate significant performance gains: ExCoT improves execution accuracy on BIRD dev set from 57.37% to 68.51% and on Spider test set from 78.81% to 86.59% for LLaMA-3 70B, with Qwen-2.5-Coder demonstrating similar improvements. Our best model achieves state-of-the-art performance in the single-model setting on both BIRD and Spider datasets, notably achieving 68.53% on the BIRD test set.

文本转SQL思维链大模型优化执行反馈

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