Skip to main content
QUICK REVIEW

[Paper Review] Optimizing Small Language Models for NL2SQL via Chain-of-Thought Fine-Tuning

Anshul Solanki, Sanchit Latawa|arXiv (Cornell University)|Mar 24, 2026
Cloud Computing and Resource ManagementComputer Science0 citations
TL;DR

Fine-tuning small models with explicit Chain-of-Thought (CoT) reasoning markedly improves NL2SQL accuracy, while standard fine-tuning harms large models and provides limited gains for them. The approach enables cost-efficient deployment with competitive accuracy.

ABSTRACT

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.

Motivation & Objective

  • Demonstrate how fine-tuning impacts NL2SQL performance across model scales (large vs. small).
  • Evaluate whether Chain-of-Thought (CoT) fine-tuning improves reasoning-enabled NL2SQL results for small models.
  • Show enterprise-facing trade-offs in accuracy, latency, and cost between large and small models in NL2SQL.

Proposed method

  • Standard evaluation with Execution Accuracy by running generated SQL against a shadow database.
  • Dataset curation of Spider-1.0 focused on hard queries with high complexity.
  • Complexity scoring of SQL queries based on JOIN, GROUP BY, ORDER BY, HAVING, and nested queries.
  • Prompt engineering with schema descriptions and self-correction prompts to reduce hallucinations.
  • Fine-tuning: compare Large Gemini 2.5 family and Small Qwen-7B-Chat using LoRA.
  • CoT fine-tuning: create a dataset with step-by-step reasoning traces (Query Analysis, Table Selection, Column Selection, Logic Strategy, Self-Validation).

Experimental results

Research questions

  • RQ1Does standard supervised fine-tuning (SFT) improve NL2SQL performance for large models (Gemini 2.5) or small models (Qwen)?
  • RQ2Can Chain-of-Thought fine-tuning close the performance gap between small and large NL2SQL models?
  • RQ3What is the impact of dataset curation toward hard queries on NL2SQL accuracy for different model scales?
  • RQ4What are the enterprise implications (cost, latency) of using CoT-tuned small models for NL2SQL?

Key findings

  • Standard fine-tuning degrades large-model NL2SQL performance and provides minimal gains for some small variants.
  • Qwen-7B base achieves 36.17% execution accuracy, improving to 45.33% with standard fine-tuning.
  • CoT fine-tuning yields 54.50% execution accuracy on Qwen-7B, an 18.33% absolute increase over SFT.
  • Large Gemini 2.5 models show negligible or negative gains under standard fine-tuning on Spider, with overfitting observed on hard queries.
  • CoT tuning narrows the gap to production-grade performance for small models, enabling cost-effective deployment with faster inference.
  • The study highlights a clear division: large models benefit more from prompting/RAG; small models benefit most from CoT-based fine-tuning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.