Text Generation
Transformers
Safetensors
qwen2
text-to-sql
reinforcement-learning
conversational
text-generation-inference
Run this model with HF Jobs
Run cycloneboy/SLM-SQL-Base-0.5B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/cycloneboy/SLM-SQL-Base-0.5B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/cycloneboy/SLM-SQL-Base-0.5B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/cycloneboy/SLM-SQL-Base-0.5B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/cycloneboy/SLM-SQL-Base-0.5B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use cycloneboy/SLM-SQL-Base-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cycloneboy/SLM-SQL-Base-0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cycloneboy/SLM-SQL-Base-0.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cycloneboy/SLM-SQL-Base-0.5B") model = AutoModelForCausalLM.from_pretrained("cycloneboy/SLM-SQL-Base-0.5B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cycloneboy/SLM-SQL-Base-0.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cycloneboy/SLM-SQL-Base-0.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cycloneboy/SLM-SQL-Base-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cycloneboy/SLM-SQL-Base-0.5B
- SGLang
How to use cycloneboy/SLM-SQL-Base-0.5B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "cycloneboy/SLM-SQL-Base-0.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cycloneboy/SLM-SQL-Base-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "cycloneboy/SLM-SQL-Base-0.5B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cycloneboy/SLM-SQL-Base-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cycloneboy/SLM-SQL-Base-0.5B with Docker Model Runner:
docker model run hf.co/cycloneboy/SLM-SQL-Base-0.5B
Update README.md
Browse files123---license: apache-2.0---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119---pipeline_tag: text-generationlibrary_name: transformerslicense: cc-by-nc-4.0tags:- text-to-sql- reinforcement-learning---# SLM-SQL: An Exploration of Small Language Models for Text-to-SQL### Important Linksπ[Arxiv Paper](https://arxiv.org/abs/2507.22478) |π€[HuggingFace](https://huggingface.co/collections/cycloneboy/slm-sql-688b02f99f958d7a417658dc) |π€[ModelScope](https://modelscope.cn/collections/SLM-SQL-624bb6a60e9643) |## 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/slm_sql/main/data/image/slmsql_framework.png" height="500" alt="slmsql_framework">### Main Results<img src="https://raw.githubusercontent.com/CycloneBoy/slm_sql/main/data/image/slmsql_bird_result.png" height="500" alt="slm_sql_result"><img src="https://raw.githubusercontent.com/CycloneBoy/slm_sql/main/data/image/slmsql_bird_main.png" height="500" alt="slmsql_bird_main"><img src="https://raw.githubusercontent.com/CycloneBoy/slm_sql/main/data/image/slmsql_spider_main.png" height="500" alt="slmsql_spider_main">Performance Comparison of different Text-to-SQL methods on BIRD dev and test dataset.<img src="https://raw.githubusercontent.com/CycloneBoy/slm_sql/main/data/image/slmsql_ablation_study.png" height="300" alt="slmsql_ablation_study">## Model| **Model** | Base Model | Train Method | Modelscope | HuggingFace ||------------------------------------------|------------------------------|--------------|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|| SLM-SQL-Base-0.5B | Qwen2.5-Coder-0.5B-Instruct | SFT | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-Base-0.5B) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-Base-0.5B) || SLM-SQL-0.5B | Qwen2.5-Coder-0.5B-Instruct | SFT + GRPO | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-0.5B) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-0.5B) || CscSQL-Merge-Qwen2.5-Coder-0.5B-Instruct | Qwen2.5-Coder-0.5B-Instruct | SFT + GRPO | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/CscSQL-Merge-Qwen2.5-Coder-0.5B-Instruct) | [π€ HuggingFace](https://huggingface.co/cycloneboy/CscSQL-Merge-Qwen2.5-Coder-0.5B-Instruct) || SLM-SQL-Base-1.5B | Qwen2.5-Coder-1.5B-Instruct | SFT | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-Base-1.5B) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-Base-1.5B) || SLM-SQL-1.5B | Qwen2.5-Coder-1.5B-Instruct | SFT + GRPO | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-1.5B) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-1.5B) || CscSQL-Merge-Qwen2.5-Coder-1.5B-Instruct | Qwen2.5-Coder-1.5B-Instruct | SFT + GRPO | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/CscSQL-Merge-Qwen2.5-Coder-1.5B-Instruct) | [π€ HuggingFace](https://huggingface.co/cycloneboy/CscSQL-Merge-Qwen2.5-Coder-1.5B-Instruct) || SLM-SQL-Base-0.6B | Qwen3-0.6B | SFT | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-Base-0.6B) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-Base-0.6B) || SLM-SQL-0.6B | Qwen3-0.6B | SFT + GRPO | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-0.6B) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-0.6B) || SLM-SQL-Base-1.3B | deepseek-coder-1.3b-instruct | SFT | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-Base-1.3B ) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-Base-1.3B ) || SLM-SQL-1.3B | deepseek-coder-1.3b-instruct | SFT + GRPO | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-1.3B ) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-1.3B ) || SLM-SQL-Base-1B | Llama-3.2-1B-Instruct | SFT | [π€ Modelscope](https://modelscope.cn/models/cycloneboy/SLM-SQL-Base-1B ) | [π€ HuggingFace](https://huggingface.co/cycloneboy/SLM-SQL-Base-1B ) |## Dataset| **Dataset** | Modelscope | HuggingFace ||----------------------------|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|| SynsQL-Think-916k | [π€ Modelscope](https://modelscope.cn/datasets/cycloneboy/SynsQL-Think-916k) | [π€ HuggingFace](https://huggingface.co/datasets/cycloneboy/SynsQL-Think-916k) || SynsQL-Merge-Think-310k | [π€ Modelscope](https://modelscope.cn/datasets/cycloneboy/SynsQL-Merge-Think-310k) | [π€ HuggingFace](https://huggingface.co/datasets/cycloneboy/SynsQL-Merge-Think-310k) || bird train and dev dataset | [π€ Modelscope](https://modelscope.cn/datasets/cycloneboy/bird_train) | [π€ HuggingFace](https://huggingface.co/datasets/cycloneboy/bird_train) |## TODO- [ ] Release inference code- [ ] Upload Model- [ ] Release training code- [ ] Fix bug- [ ] Update doc## Thanks to the following projects- [csc_sql](https://github.com/CycloneBoy/csc_sql)- [open-r1](https://github.com/huggingface/open-r1)- [OmniSQL](https://github.com/RUCKBReasoning/OmniSQL)## 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},}```
README.md+119-3