小模型通过思维链微调,低成本逼近生产级自然语言转SQL性能
Optimizing Small Language Models for NL2SQL via Chain-of-Thought Fine-Tuning
- 用思维链(CoT)数据微调小模型,提升推理能力
- 小模型准确率从36%升至54.5%,接近大模型水平
- 适合追求低延迟、低成本部署的工业级应用
将自然语言转为SQL(NL2SQL)仍是企业数据民主化的关键瓶颈。尽管大型语言模型(如Gemini 2.5)在零样本场景下表现优异,但其高推理成本限制了大规模部署。本文研究了大、小模型在NL2SQL任务上的微调效果。结果揭示出反直觉的缩放现象:在标准数据集上微调大模型(Gemini 2.5 Flash/Lite)收益甚微,常在复杂查询上过拟合;而小模型(Qwen)则显著受益。微调使小模型基线准确率从36%提升至45%,进一步引入显式思维链(CoT)数据后,准确率跃升至54.5%(图2)。虽仍低于Gemini 2.5等大模型表现,但已满足业务对成本降低、推理延迟减少及关键性能阈值的要求。本研究证明,迁移推理模式可使计算高效的小模型逼近生产级性能。
原文摘要 · Abstract (English)
Translating Natural Language to SQL (NL2SQL) remains a critical bottleneck for democratization of data in enterprises. Although Large Language Models (LLMs) like Gemini 2.5 and other LLMs have demonstrated impressive zero-shot capabilities, their high inference costs limit deployment at scale. This paper explores the efficacy of fine-tuning both large and small language models on NL2SQL tasks. Our research reveals a counter-intuitive scaling phenomenon. Fine-tuning large models (Gemini 2.5 Flash/Lite) on standard datasets yields negligible returns, often leading to overfitting on complex queries. Conversely, small models (Qwen) show significant gains. Fine-tuning improved the small model baseline from 36% to 45%, and further enriching the dataset with explicit Chain-of-Thought (CoT) reasoning surged accuracy to 54.5%(Fig 2). While this is still lower than the accuracy of large models like Gemini 2.5 , it does serve the business goal of significant cost reduction, latency in inference time and also meeting the business critical performance accuracy threshold.This paper demonstrates that transferring reasoning patterns enables compute-efficient smaller models to approach production-grade performance.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。