Instructions to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "loftytechlabsdev/Caden-SQL-1.5B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "loftytechlabsdev/Caden-SQL-1.5B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
- Ollama
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with Ollama:
ollama run hf.co/loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
- Unsloth Studio
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for loftytechlabsdev/Caden-SQL-1.5B-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for loftytechlabsdev/Caden-SQL-1.5B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for loftytechlabsdev/Caden-SQL-1.5B-GGUF to start chatting
- Pi
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with Docker Model Runner:
docker model run hf.co/loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
- Lemonade
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Caden-SQL-1.5B-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use loftytechlabsdev/Caden-SQL-1.5B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default loftytechlabsdev/Caden-SQL-1.5B-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
File size: 7,180 Bytes
1264537 8dbcbee 1264537 8dbcbee c7ffae7 8dbcbee | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | ---
license: apache-2.0
language:
- en
- sql
tags:
- text-to-sql
- qwen
- gguf
- local-ai
- unsloth
- sql-generation
datasets:
- xlangai/spider
pipeline_tag: text-generation
base_model:
- Qwen/Qwen2.5-Coder-1.5B-Instruct
---
# π Caden SQL (1.5B) - Text-to-SQL AI
<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.
---
## π Model Architecture & Details
* **Base Model:** `Qwen/Qwen2.5-Coder-1.5B-Instruct`
* **Parameters:** 1.5 Billion
* **Format:** GGUF (`Q4_K_M` Quantized)
* **Training Framework:** [Unsloth](https://github.com/unslothai/unsloth) (Fast LoRA adapters, successfully merged)
* **Context Length:** 32,768 tokens (Capable of ingesting massive database schemas!)
---
## π§ Capabilities
Unlike basic SQL generators that only output `SELECT * FROM table`, Caden has been aggressively fine-tuned to master complex relationships:
* **Advanced Joins:** Seamlessly traverses foreign keys and uses `LEFT JOIN` and `INNER JOIN` appropriately.
* **Correlated Subqueries:** Can nest queries dynamically (`WHERE salary > (SELECT AVG(salary) FROM...)`).
* **Analytical Window Functions:** Excels at `RANK()`, `ROW_NUMBER()`, and `PARTITION BY`.
* **Set Operations:** Fluidly handles `INTERSECT`, `EXCEPT`, and `UNION`.
* **Conversational Awareness:** Caden is trained to converse naturally when greeted, but strictly outputs SQL blocks when requested.
---
## π οΈ Prompt Format (ChatML)
The model expects inputs formatted in **ChatML** with a specific structured template:
```json
[
{
"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."
}
]
```
### Response Example:
```sql
SELECT name FROM head WHERE age > 50;
```
---
## π» Getting Started & Usage
### 1. Running Locally with Ollama (Recommended)
Ollama is the fastest way to run Caden on MacOS, Windows, or Linux.
1. Download the `caden-sql-1.5b-q4_k_m.gguf` file from the Files tab.
2. Create a file named `Modelfile` in the same folder with this configuration:
```dockerfile
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."""
```
3. Build and register the model with Ollama:
```bash
ollama create caden-sql -f Modelfile
```
4. Query the model in your terminal:
```bash
ollama run caden-sql
```
### 2. Running via Hugging Face Transformers (Python)
If you are using the unquantized or merged weights directly via Python:
```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)
```
---
## π Training Details & Hyperparameters
* **Base Model**: `unsloth/Qwen2.5-Coder-1.5B-Instruct`
* **Method**: QLoRA (4-bit quantization, rank `r = 16`, `lora_alpha = 16`)
* **Dataset**: `xlangai/spider` / `philikai/SQL_Spider_DDL` (containing 10,000+ text-to-SQL alignment examples)
* **Optimizer**: `adamw_8bit`
* **Learning Rate**: `2e-4`
* **Scheduler**: `linear`
* **Weight Decay**: `0.01`
* **Batch Size**: 4 per device, 4 gradient accumulation steps (Effective batch size = 16)
* **Training Steps**: 200 SFT steps (tuned to prevent overfitting while maintaining high zero-shot SQL validation accuracy)
---
# π Release Notes (v1.0)
- **Initial Release:** First highly capable 1.5B-parameter SQL generation model.
- **Focus:** Mastered Spider dataset benchmarks, including:
- Correlated Subqueries
- Set Operations
- Window Functions
- **Future Roadmap (v2.0):** Plans to scale up to a 7B-parameter model and support more complex real-world database schemas and advanced SQL query patterns.
---
## β οΈ Limitations & Bias
* **Database Engine**: Primarily trained and evaluated on general SQLite/ANSI SQL. Syntaxes specific to PostgreSQL, MSSQL, or Oracle may require small manual adjustments or specialized fine-tuning.
* **Query Complexity**: Excellent for joins, subqueries, group by, and aggregate operations. Highly complex recursive CTEs or vendor-specific window functions may occasionally require manual corrections.
---
## π License
This project is released under the **Apache 2.0** License, adhering to the base model guidelines of the Qwen series. |