SLM-SQL: An Exploration of Small Language Models for Text-to-SQL

Lei Sheng, Shuai-Shuai Xu
7/30/2025
cs.CL

Official code: CycloneBoy/slm_sql (38 stars, Apache-2.0, last commit 2025-08-12).

Abstract

Large language models (LLMs) have demonstrated strong performance in translating natural language questions into SQL queries (Text-to-SQL). In contrast, small language models (SLMs) ranging from 0.5B to 1.5B parameters currently underperform on Text-to-SQL tasks due to their limited logical reasoning capabilities. However, SLMs offer inherent advantages in inference speed and suitability for edge deployment. To explore their potential in Text-to-SQL applications, we leverage recent advancements in post-training techniques. Specifically, we used the open-source SynSQL-2.5M dataset to construct two derived datasets: SynSQL-Think-916K for SQL generation and SynSQL-Merge-Think-310K for SQL merge revision. We then applied supervised fine-tuning and reinforcement learning-based post-training to the SLM, followed by inference using a corrective self-consistency approach. Experimental results validate the effectiveness and generalizability of our method, SLM-SQL. On the BIRD development set, the five evaluated models achieved an average improvement of 31.4 points. Notably, the 0.5B model reached 56.87\% execution accuracy (EX), while the 1.5B model achieved 67.08\% EX. We will release our dataset, model, and code to github: https://github.com/CycloneBoy/slm_sql.

View on arXivView PDF

Code Implementations(1)

CycloneBoy/slm_sqlOfficial100%
Apache-2.0

SLM-SQL: An Exploration of Small Language Models for Text-to-SQL

381Jul 22, 20251 years agoApache-2.0
grponl2sqlsmall-language-modeltext-to-sql

Similar Papers

Cite this paper

@article{sheng2025slmsql,
  title  = {SLM-SQL: An Exploration of Small Language Models for Text-to-SQL},
  author = {Lei Sheng and Shuai-Shuai Xu},
  year   = {2025},
  eprint = {2507.22478},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.22478v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.22478.svg)](https://codeofpaper.com/paper/2507.22478)

Discussion