Deploying accurate Text-to-SQL systems at the enterprise level faces a difficult trilemma involving cost, security and performance. Current solutions force enterprises to choose between expensive, proprietary Large Language Models (LLMs) and low-performing Small Language Models (SLMs). Efforts to improve SLMs often rely on distilling reasoning from large LLMs using unstructured Chain-of-Thought (CoT) traces, a process that remains inherently ambiguous. Instead, we hypothesize that a formal, structured reasoning representation provides a clearer, more reliable teaching signal, as the Text-to-SQL task requires explicit and precise logical steps. To evaluate this hypothesis, we propose Struct-SQL, a novel Knowledge Distillation (KD) framework that trains an SLM to emulate a powerful large LLM. Consequently, we adopt a query execution plan as a formal blueprint to derive this structured reasoning. Our SLM, distilled with structured CoT, achieves an absolute improvement of 8.1% over an unstructured CoT distillation baseline. A detailed error analysis reveals that a key factor in this gain is a marked reduction in syntactic errors. This demonstrates that teaching a model to reason using a structured logical blueprint is beneficial for reliable SQL generation in SLMs.


翻译:在企业层面部署精确的Text-to-SQL系统面临着成本、安全性和性能的三重困境。当前的解决方案迫使企业必须在昂贵、专有的大型语言模型(LLM)与性能较低的小型语言模型(SLM)之间做出选择。提升SLM性能的努力通常依赖于从大型LLM中通过非结构化的思维链(CoT)轨迹蒸馏推理能力,这一过程本质上仍存在模糊性。相反,我们假设一种形式化、结构化的推理表征能提供更清晰、更可靠的教学信号,因为Text-to-SQL任务需要明确且精确的逻辑步骤。为验证这一假设,我们提出了Struct-SQL,一个新颖的知识蒸馏(KD)框架,用于训练一个SLM以模仿强大的大型LLM。为此,我们采用查询执行计划作为形式化蓝图来推导这种结构化推理。通过结构化CoT蒸馏得到的SLM,相比非结构化CoT蒸馏基线,实现了8.1%的绝对性能提升。详细的错误分析表明,这一增益的关键因素在于语法错误显著减少。这证明了教导模型使用结构化逻辑蓝图进行推理,对于在SLM中可靠生成SQL是有益的。

0
下载
关闭预览

相关内容

大型语言模型的知识蒸馏综述:方法、评估与应用
专知会员服务
78+阅读 · 2024年7月4日
KnowledGPT:基于知识库的检索和存储访问增强大型语言模型
基于知识蒸馏的BERT模型压缩
大数据文摘
18+阅读 · 2019年10月14日
知识在检索式对话系统的应用
微信AI
32+阅读 · 2018年9月20日
干货|当深度学习遇见自动文本摘要,seq2seq+attention
机器学习算法与Python学习
10+阅读 · 2018年5月28日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
13+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
VIP会员
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
13+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员