CoolFace
Modelpublic

cycloneboy/CscSQL-Merge-Qwen2.5-Coder-0.5B-Instruct

sourceHugging Facecc-by-nc-4.0updated 1y agoView on Hugging Face
0likes28downloads
Model Card

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

Important Links

๐Ÿ“–Arxiv Paper | ๐Ÿค—HuggingFace | ๐Ÿค–ModelScope |

News

  • โ€”July 31, 2025: Upload model to modelscope and huggingface.
  • โ€”July 30, 2025: Publish the paper to arxiv

Introduction

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.

Framework

<img src="https://raw.githubusercontent.com/CycloneBoy/slmsql/main/data/image/slmsqlframework.png" height="500" alt="slmsql_framework">

Main Results

<img src="https://raw.githubusercontent.com/CycloneBoy/slmsql/main/data/image/slmsqlbirdresult.png" height="500" alt="slmsql_result">

<img src="https://raw.githubusercontent.com/CycloneBoy/slmsql/main/data/image/slmsqlbirdmain.png" height="500" alt="slmsqlbird_main">

<img src="https://raw.githubusercontent.com/CycloneBoy/slmsql/main/data/image/slmsqlspidermain.png" height="500" alt="slmsqlspider_main">

Performance Comparison of different Text-to-SQL methods on BIRD dev and test dataset.

<img src="https://raw.githubusercontent.com/CycloneBoy/slmsql/main/data/image/slmsqlablationstudy.png" height="300" alt="slmsqlablation_study">

Model

**Model**Base ModelTrain MethodModelscopeHuggingFace
SLM-SQL-Base-0.5BQwen2.5-Coder-0.5B-InstructSFT๐Ÿค– Modelscope๐Ÿค— HuggingFace
SLM-SQL-0.5BQwen2.5-Coder-0.5B-InstructSFT + GRPO๐Ÿค– Modelscope๐Ÿค— HuggingFace
CscSQL-Merge-Qwen2.5-Coder-0.5B-InstructQwen2.5-Coder-0.5B-InstructSFT + GRPO๐Ÿค– Modelscope๐Ÿค— HuggingFace
SLM-SQL-Base-1.5BQwen2.5-Coder-1.5B-InstructSFT๐Ÿค– Modelscope๐Ÿค— HuggingFace
SLM-SQL-1.5BQwen2.5-Coder-1.5B-InstructSFT + GRPO๐Ÿค– Modelscope๐Ÿค— HuggingFace
CscSQL-Merge-Qwen2.5-Coder-1.5B-InstructQwen2.5-Coder-1.5B-InstructSFT + GRPO๐Ÿค– Modelscope๐Ÿค— HuggingFace
SLM-SQL-Base-0.6BQwen3-0.6BSFT๐Ÿค– Modelscope๐Ÿค— HuggingFace
SLM-SQL-0.6BQwen3-0.6BSFT + GRPO๐Ÿค– Modelscope๐Ÿค— HuggingFace
SLM-SQL-Base-1.3Bdeepseek-coder-1.3b-instructSFT๐Ÿค– Modelscope๐Ÿค— HuggingFace
SLM-SQL-1.3Bdeepseek-coder-1.3b-instructSFT + GRPO๐Ÿค– Modelscope๐Ÿค— HuggingFace
SLM-SQL-Base-1BLlama-3.2-1B-InstructSFT๐Ÿค– Modelscope๐Ÿค— HuggingFace

Dataset

**Dataset**ModelscopeHuggingFace
SynsQL-Think-916k๐Ÿค– Modelscope๐Ÿค— HuggingFace
SynsQL-Merge-Think-310k๐Ÿค– Modelscope๐Ÿค— HuggingFace
bird train and dev dataset๐Ÿค– Modelscope๐Ÿค— HuggingFace

TODO

  • โ€”[ ] Release inference code
  • โ€”[ ] Upload Model
  • โ€”[ ] Release training code
  • โ€”[ ] Fix bug
  • โ€”[ ] Update doc

Thanks to the following projects

Citation

bibtex

@misc{sheng2025slmsqlexplorationsmalllanguage,
      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},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2507.22478}, 
}

@misc{sheng2025cscsqlcorrectiveselfconsistencytexttosql,
      title={CSC-SQL: Corrective Self-Consistency in Text-to-SQL via Reinforcement Learning}, 
      author={Lei Sheng and Shuai-Shuai Xu},
      year={2025},
      eprint={2505.13271},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2505.13271}, 
}