Text Generation
Transformers
Safetensors
GGUF
English
llama
text-to-sql
postgresql
code-generation
conversational
text-generation-inference
Instructions to use Interchained/imagine-v10 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Interchained/imagine-v10 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Interchained/imagine-v10") 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("Interchained/imagine-v10") model = AutoModelForCausalLM.from_pretrained("Interchained/imagine-v10", 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
- llama.cpp
How to use Interchained/imagine-v10 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 Interchained/imagine-v10:Q4_K_M # Run inference directly in the terminal: llama cli -hf Interchained/imagine-v10:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Interchained/imagine-v10:Q4_K_M # Run inference directly in the terminal: llama cli -hf Interchained/imagine-v10: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 Interchained/imagine-v10:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Interchained/imagine-v10: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 Interchained/imagine-v10:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Interchained/imagine-v10:Q4_K_M
Use Docker
docker model run hf.co/Interchained/imagine-v10:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Interchained/imagine-v10 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Interchained/imagine-v10" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Interchained/imagine-v10", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Interchained/imagine-v10:Q4_K_M
- SGLang
How to use Interchained/imagine-v10 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 "Interchained/imagine-v10" \ --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": "Interchained/imagine-v10", "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 "Interchained/imagine-v10" \ --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": "Interchained/imagine-v10", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Interchained/imagine-v10 with Ollama:
ollama run hf.co/Interchained/imagine-v10:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use Interchained/imagine-v10 with Docker Model Runner:
docker model run hf.co/Interchained/imagine-v10:Q4_K_M
- Lemonade
How to use Interchained/imagine-v10 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Interchained/imagine-v10:Q4_K_M
Run and chat with the model
lemonade run user.imagine-v10-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Replace with EPIC v10 model card
Browse files
README.md
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<div align="center">
|
| 2 |
|
| 3 |
-
#
|
| 4 |
|
| 5 |
-
###
|
| 6 |
|
| 7 |
**Natural language in. Correct PostgreSQL out. ~1B parameters. No GPU. No API key. No metered inference.**
|
| 8 |
|
| 9 |
-
[** · ownership at every layer, including the model
|
| 316 |
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
`3 > 1`
|
| 320 |
|
| 321 |
</div>
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- text-to-sql
|
| 9 |
+
- postgresql
|
| 10 |
+
- code-generation
|
| 11 |
+
base_model: Interchained/imagine-v9
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
<div align="center">
|
| 15 |
|
| 16 |
+
# 🧠 imagine-v10
|
| 17 |
|
| 18 |
+
### 100% on held-out. Zero hallucinations. Analytical SQL that actually works.
|
| 19 |
|
| 20 |
**Natural language in. Correct PostgreSQL out. ~1B parameters. No GPU. No API key. No metered inference.**
|
| 21 |
|
| 22 |
+
[](#evaluation)
|
| 23 |
+
[](#execution-gate)
|
| 24 |
+
[](#evaluation)
|
| 25 |
+
[](#evaluation)
|
| 26 |
+
[](#local-first)
|
| 27 |
+
[](#status)
|
| 28 |
|
| 29 |
*Part of project `imagine` — Interchained*
|
| 30 |
|
|
|
|
| 32 |
|
| 33 |
---
|
| 34 |
|
| 35 |
+
## The failure that built v10
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
v9 was asked for a LEFT JOIN analytical query:
|
| 38 |
|
| 39 |
+
```sql
|
| 40 |
+
-- "List every customer, their total completed spending, sort by spending desc"
|
| 41 |
+
```
|
| 42 |
|
| 43 |
+
It returned:
|
| 44 |
|
| 45 |
+
```sql
|
| 46 |
+
SELECT c.id, c.name, COALESCE(o.total, 0) AS total_spending
|
| 47 |
+
FROM customers c
|
| 48 |
+
LEFT JOIN orders o ON c.id
|
| 49 |
+
-- ...truncated. Dead.
|
| 50 |
```
|
| 51 |
+
|
| 52 |
+
The correct answer:
|
| 53 |
+
|
| 54 |
+
```sql
|
| 55 |
+
SELECT c.id, c.name, COALESCE(SUM(o.total), 0) AS total_spending
|
| 56 |
+
FROM customers c
|
| 57 |
+
LEFT JOIN orders o ON c.id = o.customer_id AND o.status = 'completed'
|
| 58 |
+
GROUP BY c.id, c.name
|
| 59 |
+
ORDER BY total_spending DESC, c.id ASC;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
```
|
| 61 |
|
| 62 |
+
v9 couldn't do multi-clause analytical queries. **v10 can.**
|
| 63 |
|
| 64 |
---
|
| 65 |
|
| 66 |
+
## 🎯 What v10 adds
|
| 67 |
|
| 68 |
+
Where v9 added write capability (`INSERT`/`UPDATE`/`DELETE`), v10 adds **complex analytical queries**:
|
| 69 |
|
| 70 |
+
- **LEFT JOIN + GROUP BY + COALESCE** — the exact v9 failure mode, now handled
|
| 71 |
+
- **HAVING filters** — post-aggregation conditions
|
| 72 |
+
- **Subquery comparisons** — nested analytical logic
|
| 73 |
+
- **Complex ORDER BY** — multi-column, expression-based sorting
|
| 74 |
+
- **Multi-table JOINs** — beyond simple two-table patterns
|
|
|
|
| 75 |
|
| 76 |
+
---
|
|
|
|
| 77 |
|
| 78 |
+
## 📊 The numbers
|
| 79 |
|
| 80 |
+
| Model | Held-out (telemetry) | Protocol | Execute rate | Invented cols |
|
| 81 |
+
|---|---|---|---|---|
|
| 82 |
+
| imagine-v8 | 50.0% (20/40) | 100% | — | — |
|
| 83 |
+
| imagine-v9 | 90.0% (36/40) | 100% | 97.5% | 0 |
|
| 84 |
+
| **imagine-v10** | **100.0% (40/40)** | **100%** | **100%** | **0** |
|
| 85 |
|
| 86 |
+
**Perfect score.** Zero wrong answers. Zero hallucinations. Zero refusals.
|
| 87 |
|
| 88 |
+
---
|
|
|
|
| 89 |
|
| 90 |
+
## 🧬 How v10 was built
|
|
|
|
| 91 |
|
| 92 |
+
Two-stage fine-tuning from `Interchained/imagine-v9`:
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
+
### Stage 1 — Full fine-tune (smoke)
|
| 95 |
|
| 96 |
+
- **Corpus:** 3,216 admitted pairs (99.94% gate admit rate)
|
| 97 |
+
- **New:** Analytical query templates (LEFT JOIN aggregations, HAVING, subqueries)
|
| 98 |
+
- **Epochs:** 3, LR 1e-5, cosine schedule
|
| 99 |
+
- **Final loss:** 0.0052 (v9 was 0.0320 — **6x better**)
|
| 100 |
+
- **Time:** 4.1 min on H200, 26k tok/s
|
| 101 |
|
| 102 |
+
### Stage 2 — LoRA refinement
|
| 103 |
|
| 104 |
+
- **Base:** v10-smoke checkpoint
|
| 105 |
+
- **Rank:** 16, LR 5e-6
|
| 106 |
+
- **Epochs:** 3
|
| 107 |
+
- **Final loss:** 0.0244
|
| 108 |
+
- **Time:** 5.4 min on H200
|
| 109 |
+
- Adapter folded into full checkpoint
|
| 110 |
|
| 111 |
+
### The corpus
|
|
|
|
|
|
|
| 112 |
|
| 113 |
+
3,218 candidates forged, 3,216 admitted:
|
|
|
|
| 114 |
|
| 115 |
+
| Schema | Templates | Writes | Total |
|
| 116 |
+
|---|---|---|---|
|
| 117 |
+
| shop | 356 | 388 | 744 |
|
| 118 |
+
| clinic | 545 | 290 | 835 |
|
| 119 |
+
| library | 481 | 257 | 738 |
|
| 120 |
+
| fleet | 297 | 226 | 523 |
|
| 121 |
+
| audit | 252 | 126 | 378 |
|
| 122 |
|
| 123 |
+
**Nothing enters training that a live database hasn't agreed with.**
|
|
|
|
| 124 |
|
| 125 |
---
|
| 126 |
|
| 127 |
+
## 🔬 The execution gate
|
| 128 |
|
| 129 |
+
Every candidate goes through L0–L4:
|
| 130 |
|
| 131 |
```
|
| 132 |
+
candidate SQL ──► L0 real PostgreSQL parser not a regex
|
| 133 |
+
L1 read-only + bounded no writes, no sleeps
|
| 134 |
+
L2 EXPLAIN on live schema hallucinations die HERE
|
| 135 |
+
L3 execute, timed, capped real rows
|
| 136 |
+
L4 SAME ANSWER as ref? ◄── the one that matters
|
| 137 |
+
▼
|
| 138 |
+
admitted to corpus
|
| 139 |
```
|
| 140 |
|
| 141 |
+
68/68 gate tests passing. The gate is the truth authority — not a bigger model, not vibes.
|
| 142 |
+
|
| 143 |
+
---
|
| 144 |
|
| 145 |
+
## 📦 Output protocol
|
| 146 |
+
|
| 147 |
+
SQL wrapped in sentinel blocks:
|
| 148 |
|
| 149 |
+
```
|
| 150 |
+
<<<SQL>>>
|
| 151 |
+
SELECT c.id, c.name, COALESCE(SUM(o.total), 0) AS total_spending
|
| 152 |
+
FROM customers c
|
| 153 |
+
LEFT JOIN orders o ON c.id = o.customer_id AND o.status = 'completed'
|
| 154 |
+
GROUP BY c.id, c.name
|
| 155 |
+
ORDER BY total_spending DESC, c.id ASC;
|
| 156 |
+
<<<END>>>
|
| 157 |
```
|
| 158 |
|
| 159 |
+
Can also refuse:
|
| 160 |
|
| 161 |
| block | meaning |
|
| 162 |
|---|---|
|
|
|
|
| 164 |
| `<<<UNANSWERABLE>>>` | this schema cannot answer that |
|
| 165 |
| `<<<CLARIFY>>>` | ambiguous — here's what's missing |
|
| 166 |
|
| 167 |
+
> ⚠️ **A truncated generation is not an answer.** An unterminated block extracts to **nothing**.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
---
|
| 170 |
|
| 171 |
+
## 💻 Loading v10
|
| 172 |
|
| 173 |
+
```python
|
| 174 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 175 |
+
import torch
|
|
|
|
|
|
|
| 176 |
|
| 177 |
+
model_id = "Interchained/imagine-v10"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 180 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 181 |
+
model_id,
|
| 182 |
+
torch_dtype=torch.bfloat16,
|
| 183 |
+
device_map="auto",
|
| 184 |
+
)
|
| 185 |
|
| 186 |
+
# Ask for an analytical query
|
| 187 |
+
prompt = """Schema:
|
| 188 |
+
customers(id, name)
|
| 189 |
+
orders(id, customer_id, total, status)
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
+
List every customer ID, name, and total completed spending.
|
| 192 |
+
Include customers with no completed orders (show 0).
|
| 193 |
+
Sort by spending descending, then ID ascending."""
|
| 194 |
|
| 195 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
|
|
|
|
|
|
| 196 |
|
| 197 |
+
with torch.no_grad():
|
| 198 |
+
output = model.generate(inputs["input_ids"], max_new_tokens=256, do_sample=False)
|
| 199 |
|
| 200 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
```
|
| 202 |
|
| 203 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
|
| 205 |
+
## 🎯 Identity
|
| 206 |
|
| 207 |
+
The deployed model identity is **Imagine**.
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
+
Built and fine-tuned by **Interchained**.
|
|
|
|
|
|
|
|
|
|
| 210 |
|
| 211 |
+
DeepSeek-Coder is part of the upstream lineage (via v8 → v9 → v10), but the deployed identity is Imagine.
|
| 212 |
|
| 213 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
+
## ⚡ Local-first
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
+
Runs on your hardware. No API key. No metered inference. No cloud dependency.
|
|
|
|
| 218 |
|
| 219 |
---
|
| 220 |
|
| 221 |
+
## 📐 The rules
|
| 222 |
|
| 223 |
+
**1 · Don't write a verifier — the engine already shipped one.**
|
| 224 |
+
Real parser. Real planner. Real rows.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
+
**2 · Assert the property, not a proxy.**
|
| 227 |
+
Execution accuracy, not string similarity.
|
| 228 |
|
| 229 |
+
**3 · Schema goes in the prompt, not in the weights.**
|
| 230 |
+
The model learns *"read the schema you were handed"* — not memorise ours.
|
| 231 |
|
| 232 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
+
## ⚠️ Limitations
|
| 235 |
|
| 236 |
+
v10 is a research checkpoint. It may still:
|
| 237 |
|
| 238 |
+
- generate incorrect SQL on novel patterns
|
| 239 |
+
- misunderstand ambiguous requests
|
| 240 |
+
- produce writes with wrong `WHERE` clauses — **always review before executing**
|
| 241 |
|
| 242 |
+
Generated SQL should be reviewed before use in production. This applies doubly to writes.
|
|
|
|
|
|
|
| 243 |
|
| 244 |
+
---
|
|
|
|
|
|
|
| 245 |
|
| 246 |
+
## 🔒 Security
|
|
|
|
|
|
|
| 247 |
|
| 248 |
+
Do not rely on model behavior alone for database safety. Production systems should enforce:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
|
| 250 |
+
- least-privilege database roles
|
| 251 |
+
- statement timeouts and row limits
|
| 252 |
+
- query validation and schema restrictions
|
| 253 |
+
- application-level authorization
|
| 254 |
+
- audit logging
|
| 255 |
+
- **human approval for all write statements**
|
| 256 |
|
| 257 |
---
|
| 258 |
|
|
|
|
| 260 |
|
| 261 |
**Built by [Interchained](https://github.com/Eth-Interchained)** · ownership at every layer, including the model
|
| 262 |
|
| 263 |
+
`3 > 1` — Mark drives, oracle points, Muse builds
|
|
|
|
|
|
|
| 264 |
|
| 265 |
</div>
|