b-mc2/sql-create-context
Viewer β’ Updated β’ 78.6k β’ 6.25k β’ 506
QwerySmith 1.0 is a specialized Text-to-SQL model based on unsloth/Qwen3-4B, fine-tuned using QLoRA with Unsloth on 10,000 text-to-SQL context pairs (b-mc2/sql-create-context).
| set | system | valid SQL | exact match | execution acc (95% CI) | scored |
|---|---|---|---|---|---|
| in_dist | base_zeroshot | 98.5% | 6.0% | 67.2% (54.7% to 77.7%) | 61/200 |
| in_dist | base_fewshot | 99.5% | 55.0% | 60.7% (48.1% to 71.9%) | 61/200 |
| in_dist | finetuned | 98.0% | 87.5% | 88.5% (78.2% to 94.3%) | 61/200 |
| external | base_zeroshot | 92.7% | 26.0% | 52.3% (46.7% to 58.0%) | 298/300 |
| external | base_fewshot | 89.7% | 20.0% | 47.3% (41.7% to 53.0%) | 298/300 |
| external | finetuned | 93.0% | 9.7% | 34.6% (29.4% to 40.1%) | 298/300 |
How to read this
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained("Cyrax321/QwerySmith-1.0", max_seq_length=2048, load_in_4bit=True)
FastLanguageModel.for_inference(model)
prompt = """<|im_start|>system
You are a text-to-SQL assistant. Given a database schema and a question, reply with exactly one SQL query and nothing else.<|im_end|>
<|im_start|>user
Schema: CREATE TABLE employees (id INT, name VARCHAR, salary INT, department VARCHAR);
Question: What is the highest salary in the marketing department?<|im_end|>
<|im_start|>assistant
<think>
</think>
"""
inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256, use_cache=True)
print(tokenizer.batch_decode(outputs)[0])