Run this model with HF Jobs
Run cubehugging/Minnow-SQL-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/cubehugging/Minnow-SQL-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/cubehugging/Minnow-SQL-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/cubehugging/Minnow-SQL-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/cubehugging/Minnow-SQL-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 cubehugging/Minnow-SQL-0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cubehugging/Minnow-SQL-0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cubehugging/Minnow-SQL-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("cubehugging/Minnow-SQL-0.5B") model = AutoModelForCausalLM.from_pretrained("cubehugging/Minnow-SQL-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 cubehugging/Minnow-SQL-0.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cubehugging/Minnow-SQL-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": "cubehugging/Minnow-SQL-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cubehugging/Minnow-SQL-0.5B
- SGLang
How to use cubehugging/Minnow-SQL-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 "cubehugging/Minnow-SQL-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": "cubehugging/Minnow-SQL-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 "cubehugging/Minnow-SQL-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": "cubehugging/Minnow-SQL-0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cubehugging/Minnow-SQL-0.5B with Docker Model Runner:
docker model run hf.co/cubehugging/Minnow-SQL-0.5B
Minnow-SQL-0.5B
A small model (0.5B parameters) that turns a question in plain English into a SQLite query. It is Qwen2.5-Coder-0.5B-Instruct fine-tuned with LoRA on the Spider training set plus a slice of SynSQL-2.5M, then merged into one model. It runs on a laptop GPU or a CPU.
Code, training scripts and every scored run: github.com/thiscube/Minnow-SQL-0.5B
Scores
Execution accuracy: a query counts as right when it returns the same rows as the reference query.
| Spider dev (1,034) | Spider test, scored once (917) | |
|---|---|---|
| Base model, one answer | 45.36% | |
| This model, one answer | 62.48% | |
| This model, 15 answers voted, then repaired | 71.18% | 76.66% |
The third row uses the vote and repair steps from the GitHub repo: the model writes 15 queries, they are run, the most common result wins (empty results last), and a winning query that names a missing column is fixed from the database. Scores use the project's own checker, not the official Spider test-suite checker.
Prompt format
The model was trained on this exact format. Use the chat template with this system message:
You are an expert in SQLite. Given a database schema and a question, write one SQLite query that answers the question. Reply with the SQL query only.
and this user message:
Database schema:
<the CREATE TABLE statements of the database>
/*
Values from the question found in the database:
singer.Country = 'France'
*/
Question: How many singers are from France?
The comment block is optional. It lists words from the question that appear as stored values, which helps the model pick the right column and spelling. Leave it out when nothing matches.
Example
from transformers import AutoModelForCausalLM, AutoTokenizer
name = "cubehugging/Minnow-SQL-0.5B"
tokenizer = AutoTokenizer.from_pretrained(name)
model = AutoModelForCausalLM.from_pretrained(name)
schema = """CREATE TABLE singer (Singer_ID int PRIMARY KEY, Name text, Country text, Age int)"""
question = "How many singers are from France?"
messages = [
{"role": "system", "content": "You are an expert in SQLite. Given a database schema and a question, write one SQLite query that answers the question. Reply with the SQL query only."},
{"role": "user", "content": f"Database schema:\n{schema}\n\nQuestion: {question}"},
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
)
output = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
# SELECT count(*) FROM singer WHERE country = "France"
Limits
- SQLite only. Other SQL dialects were not trained or tested.
- Questions that need two or more joins are its weak spot.
- Spider dev questions were never used for training. Dev and the test half above were only used for scoring.
- Downloads last month
- 61
Model tree for cubehugging/Minnow-SQL-0.5B
Base model
Qwen/Qwen2.5-0.5B