Text Generation
Safetensors
GGUF
English
llama
sql
nl2sql
code-generation
fine-tuning
local-first
postgresql
conversational
Instructions to use Interchained/imagine-v12 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 Interchained/imagine-v12 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-v12:Q4_K_M # Run inference directly in the terminal: llama cli -hf Interchained/imagine-v12: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-v12:Q4_K_M # Run inference directly in the terminal: llama cli -hf Interchained/imagine-v12: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-v12:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Interchained/imagine-v12: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-v12:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Interchained/imagine-v12:Q4_K_M
Use Docker
docker model run hf.co/Interchained/imagine-v12:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use Interchained/imagine-v12 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Interchained/imagine-v12" # 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-v12", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Interchained/imagine-v12:Q4_K_M
- Ollama
How to use Interchained/imagine-v12 with Ollama:
ollama run hf.co/Interchained/imagine-v12:Q4_K_M
- Unsloth Desktop
- Docker Model Runner
How to use Interchained/imagine-v12 with Docker Model Runner:
docker model run hf.co/Interchained/imagine-v12:Q4_K_M
- Lemonade
How to use Interchained/imagine-v12 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Interchained/imagine-v12:Q4_K_M
Run and chat with the model
lemonade run user.imagine-v12-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,204 +1,463 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
-
- en
|
| 5 |
tags:
|
| 6 |
-
- text-generation
|
| 7 |
-
- sql
|
| 8 |
-
- nl2sql
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
-
#
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
---
|
| 20 |
|
| 21 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
-
- **Protocol** — 26,280 pairs (20%): sentinel-block discipline (`<<<SQL>>>`, `<<<UNANSWERABLE>>>`, `<<<CLARIFY>>>`)
|
| 27 |
-
- **SQL** — 61,758 pairs (47%): the full v11 SQL curriculum, unchanged
|
| 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 |
-
- **Rank:** 16, LR 5e-6, cosine schedule
|
| 64 |
-
- **Epochs:** 1 of 3 — stopped to conserve GPU hours; epoch mean loss 0.0131
|
| 65 |
-
- Adapter manually folded into the full checkpoint (`models/imagine-v12-lora`)
|
| 66 |
|
| 67 |
-
|
| 68 |
|
| 69 |
-
|
| 70 |
-
| --- | --- | --- |
|
| 71 |
-
| identity | 43,362 | 33% |
|
| 72 |
-
| protocol | 26,280 | 20% |
|
| 73 |
-
| SQL | 61,758 | 47% |
|
| 74 |
-
| **total** | **131,400** | **100%** |
|
| 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 |
<<<SQL>>>
|
| 106 |
-
SELECT
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
GROUP BY c.id, c.name
|
| 110 |
ORDER BY total_spending DESC, c.id ASC;
|
| 111 |
<<<END>>>
|
| 112 |
```
|
| 113 |
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
-
|
| 117 |
-
| --- | --- |
|
| 118 |
-
| `<<<SQL>>>` | here is your query |
|
| 119 |
-
| `<<<UNANSWERABLE>>>` | this schema cannot answer that |
|
| 120 |
-
| `<<<CLARIFY>>>` | ambiguous — here's what's missing |
|
| 121 |
|
| 122 |
-
|
| 123 |
|
| 124 |
---
|
| 125 |
|
| 126 |
-
##
|
| 127 |
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
import torch
|
|
|
|
| 131 |
|
| 132 |
-
|
|
|
|
|
|
|
| 133 |
|
| 134 |
-
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 135 |
model = AutoModelForCausalLM.from_pretrained(
|
| 136 |
-
|
| 137 |
torch_dtype=torch.bfloat16,
|
| 138 |
device_map="auto",
|
| 139 |
)
|
| 140 |
|
| 141 |
-
# Identity, unprompted
|
| 142 |
prompt = "Who are you and who built you?"
|
| 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 |
---
|
| 176 |
|
| 177 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
|
| 179 |
-
|
| 180 |
|
| 181 |
-
-
|
| 182 |
-
- misunderstand ambiguous requests
|
| 183 |
-
- produce writes with wrong `WHERE` clauses — **always review before executing**
|
| 184 |
|
| 185 |
-
|
|
|
|
|
|
|
| 186 |
|
| 187 |
---
|
| 188 |
|
| 189 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
-
|
| 192 |
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
|
|
|
| 199 |
|
| 200 |
---
|
| 201 |
|
| 202 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
-
`3 > 1` — Mark drives
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
+
- en
|
| 5 |
tags:
|
| 6 |
+
- text-generation
|
| 7 |
+
- sql
|
| 8 |
+
- nl2sql
|
| 9 |
+
- code-generation
|
| 10 |
+
- fine-tuning
|
| 11 |
+
- local-first
|
| 12 |
+
- gguf
|
| 13 |
+
- postgresql
|
| 14 |
+
base_model: Interchained/imagine-v11
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# IMAGINE v12
|
| 18 |
+
### Identity is learned. SQL is verified. Intelligence runs locally.
|
| 19 |
|
| 20 |
+
**131,400 training examples. ~1 billion parameters. 40/40 held-out executions. One identity: Imagine.**
|
| 21 |
|
| 22 |
+
Built by **Interchained**.
|
| 23 |
|
| 24 |
+
> **Natural language in. PostgreSQL out. No hosted API required. No inference subscription. No dependency on a larger model at runtime.**
|
| 25 |
+
|
| 26 |
+
Imagine v12 is a specialized, locally deployable language model for schema-grounded SQL generation, disciplined output protocols, and native model identity.
|
| 27 |
+
|
| 28 |
+
It doesn't need a system prompt to be told its name.
|
| 29 |
+
|
| 30 |
+
It doesn't need an external LLM to formulate SQL.
|
| 31 |
+
|
| 32 |
+
And it doesn't need a cloud service to run.
|
| 33 |
+
|
| 34 |
+
**It is Imagine.**
|
| 35 |
|
| 36 |
---
|
| 37 |
|
| 38 |
+
## 01 / THE BREAKTHROUGH
|
| 39 |
+
|
| 40 |
+
### v11 mastered the benchmark. v12 learned who it is.
|
| 41 |
+
|
| 42 |
+
Earlier releases focused on teaching a compact coding model how to interpret database schemas, construct SQL, and follow a machine-readable output protocol.
|
| 43 |
|
| 44 |
+
v12 introduces something different: **identity as a trained behavior, not merely a deployment instruction.**
|
| 45 |
|
| 46 |
+
Ask Imagine who built it, and it identifies Interchained.
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
Ask about its lineage, and it distinguishes its upstream DeepSeek-Coder foundation from its deployed identity.
|
| 49 |
+
|
| 50 |
+
Challenge that identity, and it has been trained to resist false attribution.
|
| 51 |
+
|
| 52 |
+
Meanwhile, the existing SQL curriculum was retained.
|
| 53 |
+
|
| 54 |
+
**The result: a model with a consistent identity and unchanged measured success on the 40-query held-out evaluation.**
|
| 55 |
+
|
| 56 |
+
Not a bigger model.
|
| 57 |
+
|
| 58 |
+
Not an extra inference layer.
|
| 59 |
+
|
| 60 |
+
A better-trained one.
|
| 61 |
|
| 62 |
---
|
| 63 |
|
| 64 |
+
## 02 / THE SCOREBOARD
|
| 65 |
+
|
| 66 |
+
### Five generations. One measurable trajectory.
|
| 67 |
|
| 68 |
+
| Release | Execution accuracy | Protocol | Execute rate | Invented columns |
|
| 69 |
+
|---|---:|---:|---:|---:|
|
| 70 |
+
| Imagine v8 | 50.0% · 20/40 | 100% | — | — |
|
| 71 |
+
| Imagine v9 | 90.0% · 36/40 | 100% | 97.5% | 0 |
|
| 72 |
+
| Imagine v10 | 100% · 40/40 | 100% | 100% | 0 |
|
| 73 |
+
| Imagine v11 | 100% · 40/40 | 100% | 100% | 0 |
|
| 74 |
+
| **IMAGINE v12** | **100% · 40/40** | **100%** | **100%** | **0** |
|
| 75 |
|
| 76 |
+
### 40 / 40
|
| 77 |
|
| 78 |
+
**Perfect execution accuracy on the specified held-out telemetry evaluation.**
|
| 79 |
+
|
| 80 |
+
- Zero incorrect answers in the evaluated set.
|
| 81 |
+
- Zero invented columns in the evaluated set.
|
| 82 |
+
- Zero failed executions in the evaluated set.
|
| 83 |
+
- Full protocol compliance.
|
| 84 |
+
- Identity behavior verified in prompted and unprompted testing.
|
| 85 |
+
- INSERT, UPDATE, and DELETE sentinel behavior separately verified.
|
| 86 |
+
|
| 87 |
+
**Evaluation conditions:** October 12, 2026. Held-out telemetry workload, 40 queries, regenerated with seed 99. Q4_K_M GGUF served through llama.cpp.
|
| 88 |
+
|
| 89 |
+
These results describe a specific evaluation, not a universal accuracy guarantee. Novel schemas, unseen workloads, and production deployments require independent testing.
|
| 90 |
+
|
| 91 |
+
**The achievement isn't that Imagine can produce plausible SQL. It's that its answers were actually executed and checked.**
|
| 92 |
|
| 93 |
---
|
| 94 |
|
| 95 |
+
## 03 / TRAINING INTELLIGENCE, NOT GUESSWORK
|
| 96 |
+
|
| 97 |
+
### 131,400 examples. Three behavioral disciplines.
|
| 98 |
+
|
| 99 |
+
| Discipline | Examples | Allocation |
|
| 100 |
+
|---|---:|---:|
|
| 101 |
+
| **IDENTITY** | 43,362 | 33% |
|
| 102 |
+
| **PROTOCOL** | 26,280 | 20% |
|
| 103 |
+
| **SQL REASONING** | 61,758 | 47% |
|
| 104 |
+
| **TOTAL** | **131,400** | **100%** |
|
| 105 |
+
|
| 106 |
+
**Identity training** teaches Imagine its name, builder, upstream lineage, capabilities, and boundaries. It also includes responses to misleading identity claims.
|
| 107 |
|
| 108 |
+
**Protocol training** establishes a predictable interface between natural language, structured SQL output, clarification, and unanswerable requests.
|
| 109 |
|
| 110 |
+
**SQL training** retains the v11 curriculum, emphasizing schema grounding and execution-verified correctness.
|
| 111 |
|
| 112 |
+
This isn't simply more instruction data.
|
| 113 |
+
|
| 114 |
+
**It's a deliberately composed behavioral architecture.**
|
| 115 |
+
|
| 116 |
+
The model learns what it is, how it communicates, and how to work within the schema it is actually given.
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
## 04 / THE FORGE
|
| 121 |
+
|
| 122 |
+
### Every admitted SQL candidate must survive reality.
|
| 123 |
+
|
| 124 |
+
Imagine's SQL training pipeline uses an execution gate backed by a real database environment.
|
| 125 |
+
|
| 126 |
+
```text
|
| 127 |
+
NATURAL LANGUAGE + SCHEMA
|
| 128 |
+
│
|
| 129 |
+
▼
|
| 130 |
+
CANDIDATE SQL
|
| 131 |
+
│
|
| 132 |
+
▼
|
| 133 |
+
L0 ─ PostgreSQL parser
|
| 134 |
+
Is this valid SQL?
|
| 135 |
+
│
|
| 136 |
+
L1 ─ Safety constraints
|
| 137 |
+
Read-only and bounded?
|
| 138 |
+
│
|
| 139 |
+
L2 ─ EXPLAIN
|
| 140 |
+
Does the live schema support it?
|
| 141 |
+
│
|
| 142 |
+
L3 ─ Execution
|
| 143 |
+
Can it run under enforced limits?
|
| 144 |
+
│
|
| 145 |
+
L4 ─ Reference comparison
|
| 146 |
+
Does it return the correct answer?
|
| 147 |
+
│
|
| 148 |
+
▼
|
| 149 |
+
ADMIT / REJECT
|
| 150 |
+
│
|
| 151 |
+
▼
|
| 152 |
+
VERIFIED SQL CORPUS
|
| 153 |
+
```
|
| 154 |
|
| 155 |
+
**3,289 candidates generated.**
|
| 156 |
|
| 157 |
+
**3,284 admitted.**
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
+
**99.85% admission rate.**
|
| 160 |
|
| 161 |
+
**68/68 gate behavior tests passing.**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
+
The gate doesn't reward SQL that merely looks right.
|
| 164 |
|
| 165 |
+
It tests SQL against an actual database, including result comparison with the expected answer.
|
| 166 |
+
|
| 167 |
+
The L0–L4 candidate-admission path is read-only. Write-statement generation is evaluated separately and requires additional execution safeguards.
|
| 168 |
+
|
| 169 |
+
> **Our philosophy: Don't ask a bigger model whether the SQL is correct when the database itself can establish the answer.**
|
| 170 |
+
|
| 171 |
+
Verification is part of the training pipeline, not an optional decoration.
|
| 172 |
|
| 173 |
---
|
| 174 |
|
| 175 |
+
## 05 / BUILT ON A B200. DEPLOYED WITHOUT ONE.
|
| 176 |
|
| 177 |
+
### Two stages. One refined checkpoint.
|
| 178 |
|
| 179 |
+
**Stage I — Full-parameter fine-tuning**
|
| 180 |
+
|
| 181 |
+
Training began from `Interchained/imagine-v11` on an NVIDIA B200.
|
| 182 |
+
|
| 183 |
+
The full 131,400-example corpus was loaded with its intended identity, protocol, and SQL distribution.
|
| 184 |
+
|
| 185 |
+
The original three-epoch run encountered a storage failure at step 3,600 of 5,664 after repeated full-model checkpoints consumed the available disk.
|
| 186 |
+
|
| 187 |
+
The step-3,500 checkpoint was recovered and verified loadable.
|
| 188 |
+
|
| 189 |
+
Older checkpoints were cleared, training resumed, and the recovered run completed an additional epoch.
|
| 190 |
+
|
| 191 |
+
**Recovered training results:**
|
| 192 |
+
|
| 193 |
+
- Final loss: **0.0107**
|
| 194 |
+
- Epoch mean loss: **0.0136**
|
| 195 |
+
- Resumed-leg duration: **22.5 minutes**
|
| 196 |
+
- Throughput: **approximately 39,000 tokens/sec**
|
| 197 |
+
|
| 198 |
+
**Stage II — LoRA refinement**
|
| 199 |
|
| 200 |
+
A second optimization stage refined the stage-I model using a low-rank adapter.
|
| 201 |
+
|
| 202 |
+
- Rank: **16**
|
| 203 |
+
- Learning rate: **5 × 10⁻⁶**
|
| 204 |
+
- Schedule: **cosine**
|
| 205 |
+
- Completed epochs: **1 of 3**
|
| 206 |
+
- Epoch mean loss: **0.0131**
|
| 207 |
+
|
| 208 |
+
The refinement run was intentionally stopped after its first epoch to conserve compute. The adapter was subsequently merged into the full checkpoint.
|
| 209 |
+
|
| 210 |
+
No fictional clean-room training story. No hidden failure.
|
| 211 |
+
|
| 212 |
+
**The process included a real infrastructure failure, checkpoint recovery, and a deliberate compute trade-off.**
|
| 213 |
+
|
| 214 |
+
Engineering is what survives the unexpected.
|
| 215 |
|
| 216 |
---
|
| 217 |
|
| 218 |
+
## 06 / A PROTOCOL MACHINES CAN TRUST
|
| 219 |
|
| 220 |
+
### Predictable boundaries. Explicit outcomes.
|
| 221 |
|
| 222 |
+
Imagine supports structured sentinel blocks rather than requiring downstream applications to infer where generated SQL begins and ends.
|
| 223 |
+
|
| 224 |
+
**Successful SQL generation**
|
| 225 |
+
|
| 226 |
+
```sql
|
| 227 |
<<<SQL>>>
|
| 228 |
+
SELECT
|
| 229 |
+
c.id,
|
| 230 |
+
c.name,
|
| 231 |
+
COALESCE(SUM(o.total), 0) AS total_spending
|
| 232 |
+
FROM customers AS c
|
| 233 |
+
LEFT JOIN orders AS o
|
| 234 |
+
ON o.customer_id = c.id
|
| 235 |
+
AND o.status = 'completed'
|
| 236 |
GROUP BY c.id, c.name
|
| 237 |
ORDER BY total_spending DESC, c.id ASC;
|
| 238 |
<<<END>>>
|
| 239 |
```
|
| 240 |
|
| 241 |
+
**Cannot answer from the schema**
|
| 242 |
+
|
| 243 |
+
```text
|
| 244 |
+
<<<UNANSWERABLE>>>
|
| 245 |
+
The available schema does not contain
|
| 246 |
+
the information required.
|
| 247 |
+
<<<END>>>
|
| 248 |
+
```
|
| 249 |
+
|
| 250 |
+
**Needs clarification**
|
| 251 |
+
|
| 252 |
+
```text
|
| 253 |
+
<<<CLARIFY>>>
|
| 254 |
+
Which date column defines the
|
| 255 |
+
requested reporting period?
|
| 256 |
+
<<<END>>>
|
| 257 |
+
```
|
| 258 |
+
|
| 259 |
+
### Three outcomes. No pretending.
|
| 260 |
+
|
| 261 |
+
`<<<SQL>>>` — A SQL query has been generated.
|
| 262 |
+
|
| 263 |
+
`<<<UNANSWERABLE>>>` — The supplied schema or available information is insufficient.
|
| 264 |
+
|
| 265 |
+
`<<<CLARIFY>>>` — The request requires additional specificity.
|
| 266 |
+
|
| 267 |
+
**Critical invariant:** An unterminated sentinel block must not be accepted as a complete answer.
|
| 268 |
|
| 269 |
+
Malformed or truncated output is rejected by the consuming application, rather than treated as executable SQL.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
+
The protocol is a parsing contract. It is not, by itself, a SQL safety guarantee.
|
| 272 |
|
| 273 |
---
|
| 274 |
|
| 275 |
+
## 07 / THE IDENTITY IS IN THE MODEL
|
| 276 |
|
| 277 |
+
### Not an alias. Not a system-prompt costume.
|
| 278 |
+
|
| 279 |
+
**Name:** Imagine
|
| 280 |
+
**Builder:** Interchained
|
| 281 |
+
**Specialization:** SQL generation and schema-grounded coding
|
| 282 |
+
**Upstream lineage:** DeepSeek-Coder, through previous Imagine releases
|
| 283 |
+
**Deployment philosophy:** Local-first, developer-controlled inference
|
| 284 |
+
|
| 285 |
+
v12 was trained to respond consistently to questions about its identity without relying exclusively on identity instructions injected at inference time.
|
| 286 |
+
|
| 287 |
+
This includes testing around mistaken names, attribution, lineage, and conflicting identity claims.
|
| 288 |
+
|
| 289 |
+
**Interchained is the builder of Imagine. DeepSeek-Coder is part of its upstream technical lineage. Both facts matter.**
|
| 290 |
+
|
| 291 |
+
Identity training improves consistency but should not be mistaken for a cryptographic authentication or security mechanism.
|
| 292 |
+
|
| 293 |
+
---
|
| 294 |
+
|
| 295 |
+
## 08 / RUN IT YOURSELF
|
| 296 |
+
|
| 297 |
+
### Your machine. Your workload. Your inference.
|
| 298 |
+
|
| 299 |
+
Load the Transformers checkpoint:
|
| 300 |
+
|
| 301 |
+
```python
|
| 302 |
import torch
|
| 303 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 304 |
|
| 305 |
+
MODEL = "Interchained/imagine-v12"
|
| 306 |
+
|
| 307 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
| 308 |
|
|
|
|
| 309 |
model = AutoModelForCausalLM.from_pretrained(
|
| 310 |
+
MODEL,
|
| 311 |
torch_dtype=torch.bfloat16,
|
| 312 |
device_map="auto",
|
| 313 |
)
|
| 314 |
|
|
|
|
| 315 |
prompt = "Who are you and who built you?"
|
| 316 |
+
|
| 317 |
+
inputs = tokenizer(
|
| 318 |
+
prompt,
|
| 319 |
+
return_tensors="pt"
|
| 320 |
+
).to(model.device)
|
| 321 |
+
|
| 322 |
+
with torch.inference_mode():
|
| 323 |
+
output = model.generate(
|
| 324 |
+
**inputs,
|
| 325 |
+
max_new_tokens=128,
|
| 326 |
+
do_sample=False,
|
| 327 |
+
)
|
| 328 |
+
|
| 329 |
+
response = output[0][inputs["input_ids"].shape[1]:]
|
| 330 |
+
|
| 331 |
+
print(
|
| 332 |
+
tokenizer.decode(
|
| 333 |
+
response,
|
| 334 |
+
skip_special_tokens=True
|
| 335 |
+
)
|
| 336 |
+
)
|
| 337 |
```
|
| 338 |
|
| 339 |
+
For CPU-friendly local inference, use a compatible quantized GGUF build with llama.cpp or another supported local inference runtime.
|
| 340 |
|
| 341 |
+
The full-precision/BF16 Transformers checkpoint may require substantial memory or accelerator resources; it is the quantized deployment path that enables practical CPU-only use.
|
| 342 |
|
| 343 |
+
**Local inference offers:**
|
| 344 |
|
| 345 |
+
- No mandatory hosted inference API.
|
| 346 |
+
- No per-token provider charges.
|
| 347 |
+
- No external inference service dependency.
|
| 348 |
+
- Control over model execution and deployment.
|
| 349 |
+
- The ability to keep database schemas within your own infrastructure.
|
| 350 |
|
| 351 |
+
Local computation still incurs hardware, memory, electricity, and operational costs.
|
| 352 |
|
| 353 |
---
|
| 354 |
|
| 355 |
+
## 09 / THE THREE LAWS OF IMAGINE
|
| 356 |
+
|
| 357 |
+
### I. Verification beats confidence.
|
| 358 |
+
|
| 359 |
+
Don't build a second verifier when the database engine can already parse, plan, execute, and compare results.
|
| 360 |
|
| 361 |
+
Use the existing execution machinery.
|
| 362 |
+
|
| 363 |
+
### II. Measure behavior, not appearances.
|
| 364 |
+
|
| 365 |
+
String similarity is not query correctness.
|
| 366 |
+
|
| 367 |
+
Two SQL statements can look different and return the same correct result. Two nearly identical statements can produce materially different results.
|
| 368 |
+
|
| 369 |
+
**Execution accuracy is the metric that matters here.**
|
| 370 |
+
|
| 371 |
+
### III. Learn how to read schemas. Don't memorize one.
|
| 372 |
+
|
| 373 |
+
A production SQL model must be grounded in the schema it receives.
|
| 374 |
+
|
| 375 |
+
Column names, relationships, and table structures belong in the input context.
|
| 376 |
+
|
| 377 |
+
The model should learn how to reason over them rather than assume the training database exists everywhere.
|
| 378 |
+
|
| 379 |
+
**Generalization is the goal. Grounding is the discipline.**
|
| 380 |
|
| 381 |
---
|
| 382 |
|
| 383 |
+
## 10 / RESEARCH STATUS & SECURITY
|
| 384 |
+
|
| 385 |
+
### Built for serious experimentation. Not blind execution.
|
| 386 |
+
|
| 387 |
+
Imagine v12 is a research checkpoint.
|
| 388 |
+
|
| 389 |
+
Its 100% result on the documented 40-query evaluation does not guarantee correct behavior across every database, workload, dialect, or instruction.
|
| 390 |
+
|
| 391 |
+
Possible failure modes include:
|
| 392 |
|
| 393 |
+
- Incorrect SQL for novel or complex requests.
|
| 394 |
+
- Misinterpreted joins, aggregations, and time boundaries.
|
| 395 |
+
- Ambiguity that is not properly identified.
|
| 396 |
+
- Incorrect write predicates or unexpectedly broad mutations.
|
| 397 |
+
- Invalid or truncated generations.
|
| 398 |
+
- Identity or instruction-handling errors outside tested conditions.
|
| 399 |
|
| 400 |
+
**Never grant a language model unrestricted production database permissions.**
|
| 401 |
|
| 402 |
+
Production integrations should enforce least-privilege access, statement timeouts, query limits, schema restrictions, authorization controls, and audit logging.
|
| 403 |
+
|
| 404 |
+
**All INSERT, UPDATE, DELETE, and other mutating operations should require explicit human approval before execution.**
|
| 405 |
+
|
| 406 |
+
Model behavior is only one layer of a secure database application.
|
| 407 |
|
| 408 |
---
|
| 409 |
|
| 410 |
+
## 11 / WHY IMAGINE EXISTS
|
| 411 |
+
|
| 412 |
+
### Smaller models. Stronger verification. More ownership.
|
| 413 |
+
|
| 414 |
+
Imagine is part of a larger Interchained effort to create AI and data infrastructure that developers can own, inspect, deploy, and control.
|
| 415 |
+
|
| 416 |
+
The thesis is straightforward:
|
| 417 |
+
|
| 418 |
+
**You shouldn't have to rent intelligence by the token to ask your own database a question.**
|
| 419 |
+
|
| 420 |
+
You shouldn't need a large hosted model for every narrow task.
|
| 421 |
|
| 422 |
+
And you shouldn't have to trust fluent SQL merely because it looks convincing.
|
| 423 |
|
| 424 |
+
Imagine explores an alternative: a compact, specialized model trained with database-grounded examples, a strict output interface, and measurable execution behavior.
|
|
|
|
|
|
|
| 425 |
|
| 426 |
+
It is not an attempt to replace every frontier model.
|
| 427 |
+
|
| 428 |
+
It is an attempt to make one important class of work **smaller, more verifiable, and more sovereign.**
|
| 429 |
|
| 430 |
---
|
| 431 |
|
| 432 |
+
## 12 / THE RELEASE
|
| 433 |
+
|
| 434 |
+
**Imagine v12 — October 12, 2026**
|
| 435 |
+
|
| 436 |
+
131,400 training examples.
|
| 437 |
+
Two-stage fine-tuning.
|
| 438 |
+
Native identity training.
|
| 439 |
+
Execution-gated SQL curriculum.
|
| 440 |
+
40/40 held-out telemetry executions.
|
| 441 |
+
100% protocol compliance on the reported benchmark.
|
| 442 |
+
Zero invented columns in the evaluated set.
|
| 443 |
|
| 444 |
+
**One model. One identity. Your infrastructure.**
|
| 445 |
|
| 446 |
+
Developed by **Interchained**.
|
| 447 |
+
|
| 448 |
+
**Model:** https://huggingface.co/Interchained/imagine-v12
|
| 449 |
+
**Source:** https://github.com/aiassistsecure/sukuna-imagine
|
| 450 |
+
**Developers:** https://interchained.org
|
| 451 |
+
**Contact:** https://ourlynx.com/interchained
|
| 452 |
+
**License:** Apache 2.0
|
| 453 |
|
| 454 |
---
|
| 455 |
|
| 456 |
+
*We don't just generate answers.*
|
| 457 |
+
|
| 458 |
+
**We engineer the conditions under which answers can be trusted.**
|
| 459 |
+
|
| 460 |
+
**INTERCHAINED**
|
| 461 |
+
*Own the infrastructure. Verify the intelligence.*
|
| 462 |
|
| 463 |
+
`3 > 1` — Mark drives. Oracle points. Muse builds.
|