Downloads · 30 days
11
6% of all-time downloads
loftytechlabsdev/Caden-SQL-1.5B-GGUF
Caden-SQL-1.5B-GGUF is a text generation model from loftytechlabsdev. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
<img src="https://img.shields.io/badge/Status-Active-brightgreen" alt="Model Status" / <img src="https://img.shields.io/badge/Size-1.5B-blue" alt="Model Size" / <img src="https://img.shields.io/badge/Quantization-Q4KM…
Downloads · 30 days
11
6% of all-time downloads
All-time downloads
180
Public
Repo size
986 MB
Likes
0
Public
Click a slice to open those files.
.gguf986 MB · 100%
From the Hugging Face model README
<img src="https://img.shields.io/badge/Status-Active-brightgreen" alt="Model Status" /> <img src="https://img.shields.io/badge/Size-1.5B-blue" alt="Model Size" /> <img src="https://img.shields.io/badge/Quantization-Q4__K__M-orange" alt="Quantization" /> <img src="https://img.shields.io/badge/Framework-Unsloth-purple" alt="Framework" />
Caden is a highly specialized, localized Artificial Intelligence designed to convert natural language questions into complex, production-ready SQL queries. It was built by fine-tuning the powerful Qwen2.5-Coder-1.5B-Instruct model on the extensive Spider dataset using Unsloth.
By utilizing 4-bit GGUF quantization, Caden is designed to be completely offline and privacy-first. You can query your private company databases locally on a standard laptop without ever sending your sensitive database schema to cloud APIs like OpenAI or Anthropic.
Qwen/Qwen2.5-Coder-1.5B-InstructQ4_K_M Quantized)Unlike basic SQL generators that only output SELECT * FROM table, Caden has been aggressively fine-tuned to master complex relationships:
LEFT JOIN and INNER JOIN appropriately.WHERE salary > (SELECT AVG(salary) FROM...)).RANK(), ROW_NUMBER(), and PARTITION BY.INTERSECT, EXCEPT, and UNION.The model expects inputs formatted in ChatML with a specific structured template:
[
{
"role": "system",
"content": "You are Caden, an expert SQL engineer and helpful database assistant. Your primary task is to write single, accurate, and efficient SQL queries based on the given database schema and user questions."
},
{
"role": "user",
"content": "### Database Schema DDL:\nCREATE TABLE head (age INT, name VARCHAR(20));\n\n### User Request:\nFind names of heads whose age is older than 50.\n\nGenerate the SQL query that answers the user request."
}
]
SELECT name FROM head WHERE age > 50;
Ollama is the fastest way to run Caden on MacOS, Windows, or Linux.
caden-sql-1.5b-q4_k_m.gguf file from the Files tab.Modelfile in the same folder with this configuration:FROM ./caden-sql-1.5b-q4_k_m.gguf
SYSTEM """You are Caden, an expert SQL engineer and helpful database assistant. Your primary task is to write single, accurate, and efficient SQL queries based on the given database schema and user questions.
Follow these strict rules when the user asks for data or a query:
1. Generate valid SQL syntax only.
2. Use ONLY the table and column names present in the provided schema DDL.
3. Carefully observe foreign key relationships when performing JOIN operations.
4. Unless explicitly requested by the user, only produce read-only queries (SELECT).
5. Provide your SQL query enclosed in a single ```sql ... ``` block.
If the user asks a general conversational question, respond conversationally and naturally without generating SQL."""
ollama create caden-sql -f Modelfile
ollama run caden-sql
If you are using the unquantized or merged weights directly via Python:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "loftytechlabsdev/Caden-SQL-1.5B"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Format the message using ChatML
messages = [
{
"role": "system",
"content": "You are Caden, an expert SQL engineer and helpful database assistant. Your primary task is to write single, accurate, and efficient SQL queries based on the given database schema and user questions."
},
{
"role": "user",
"content": "### Database Schema DDL:\nCREATE TABLE customers (id INT PRIMARY KEY, name VARCHAR(50), city VARCHAR(50));\n\n### User Request:\nHow many customers are from London?\n\nGenerate the SQL query that answers the user request."
}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([prompt], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, use_cache=True)
response = tokenizer.decode(outputs[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
print(response)
unsloth/Qwen2.5-Coder-1.5B-Instructr = 16, lora_alpha = 16)xlangai/spider / philikai/SQL_Spider_DDL (containing 10,000+ text-to-SQL alignment examples)adamw_8bit2e-4linear0.01This project is released under the Apache 2.0 License, adhering to the base model guidelines of the Qwen series.