Qwen2.5-Coder-3B-SQL

Qwen2.5-Coder-3B fine-tuned with LoRA for Postgres and SQLite SQL: autocomplete inside a query, filling a gap in the middle of a query, English to SQL, and explaining a query in English. It is the default model for the text2sql tool and is meant to be downloaded and run locally by that tool.

Built with Qwen.

Files

File Precision Size Notes
Qwen2.5-Coder-3B-SQL-Q8_0.gguf Q8_0 3.3 GB Recommended. Same scores as BF16
Qwen2.5-Coder-3B-SQL-BF16.gguf BF16 6.2 GB Full precision, for making your own quants

Both run in llama.cpp and anything built on it. Q8_0 fits on a 6 GB GPU with room for context.

Training

LoRA (rank 32) on 300,000 examples sampled from a set of about 600,000, built from public text-to-SQL datasets and synthetic pairs on app-style schemas, with about half of each task in Postgres and half in SQLite. Postgres versions of SQLite pairs were kept only when both returned the same results. Trained for one epoch on a single RTX 5070 Ti. The adapter was merged into the base weights before converting to GGUF.

Prompt format

Every task is written as a small repo with a gap to fill in the last file, using Qwen's own repo and FIM tokens.

<|repo_name|>my_db
<|file_sep|>schema.sql
-- dialect: postgres
CREATE TABLE users (id int, name text, age int);
<|file_sep|>query.sql
<|fim_prefix|>-- users over 30
SELECT name FROM users <|fim_suffix|><|fim_middle|>

The text2sql tool builds these prompts for you.

Evaluation

BIRD Mini-Dev (SQLite), scored by running the generated SQL and comparing its results to the reference query. Scores are for the Q8_0 file, next to the base model at Q8_0 with the same prompts.

Task Base model Fine-tuned
English to SQL (no hints) 14.9% 33.7%
Continue a query 39.0% 49.9%
Fill the middle of a query 35.5% 45.8%

When the query has a comment saying what it is for, the fine-tuned model scores 75.7% on continue and 72.1% on fill-middle.

License

This model is a derivative of Qwen2.5-Coder-3B and is released under the Qwen Research License, which does not allow commercial use.

Downloads last month
-
GGUF
Model size
3B params
Architecture
qwen2
Hardware compatibility
Log In to add your hardware

8-bit

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for JackyJoh/Qwen2.5-Coder-3B-SQL

Base model

Qwen/Qwen2.5-3B
Adapter
(105)
this model