[論文レビュー] Optimizing Small Language Models for NL2SQL via Chain-of-Thought Fine-Tuning
要約: CoT( Chain-of-Thought )推論を明示した微調整により、NL2SQL の精度が小型モデルで著しく向上する一方、標準微調整は大型モデルには悪影響を及ぼし、彼らには限定的な効果しかもたらさない。 このアプローチは、コスト効率の高い展開を実現しつつ競争力のある精度を提供する。
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.
研究の動機と目的
- モデルスケール(大型 vs 小型)間で NL2SQL の性能に対する微調整の影響を示す。
- CoT 微調整が小型モデルの推論能力を持つ NL2SQL の結果を改善するかを評価する。
- NL2SQL における大型と小型モデルの精度・遅延・コストの企業向けトレードオフを示す。
提案手法
- 生成された SQL をシャドウデータベースで実行して Execution Accuracy を評価する標準的評価。
- 複雑性の高い hard クエリに焦点を当てた Spider-1.0 のデータセット作成。
- JOIN、GROUP BY、ORDER BY、HAVING、ネストされたクエリに基づく SQL の複雑さスコアリング。
- スキーマ説明と自己訂正プロンプトを用いたプロンプトエンジニアリングで幻覚を低減。
- 微調整: Large Gemini 2.5 系と Small Qwen-7B-Chat を LoRA を用いて比較。
- CoT 微調整: ステップごとの推論痕跡(Query Analysis、Table Selection、Column Selection、Logic Strategy、Self-Validation)を含むデータセットを作成。
実験結果
リサーチクエスチョン
- RQ1標準的な教師あり微調整(SFT)は、大型モデル(Gemini 2.5)または小型モデル(Qwen)で NL2SQL の性能を改善するか。
- RQ2CoT 微調整は小型 NL2SQL モデルと大型モデルの性能ギャップを縮めるか。
- RQ3難クエリ志向のデータセット作成が、モデルスケール別の NL2SQL 精度に与える影響は。
- RQ4CoT 微調整された小型モデルを NL2SQL に適用する場合の企業向けコスト・遅延への影響は。
主な発見
- 標準的微調整は大型モデルの NL2SQL 性能を低下させ、一部の小型バリアントには最小限の利得をもたらす。
- Qwen-7B base は 36.17% の実行精度を達成し、標準微調整で 45.33% へ改善。
- CoT 微調整は Qwen-7B で 54.50% の実行精度を得て、SFT に対して絶対差分で 18.33% 増加。
- 大型 Gemini 2.5 モデルは Spider で標準微調整下で有意な利得がなく、難クエリで過剰適合を示す。
- CoT 微調整は小型モデルの生産レベルの性能差を縮め、コスト効率の高い展開と高速推論を実現。
- 本研究は明確な分断を強調する: 大型モデルはプロンプティング/RAG からの恩恵をより受ける一方、小型モデルはCoTベースの微調整から最も大きな利益を得る。
この論文を読む
Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。
Nubintでこの論文を読むこのレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。