imagine-v12

1.1K downloads 1 likes on Hugging Face updated

Model card

🧠 imagine-v12

Native identity. The model knows who it is.

Natural language in. Correct PostgreSQL out. ~1B parameters. No GPU. No API key. No metered inference.

Part of project imagine — Interchained


🎯 What v12 adds

Where v11 fixed predicate placement, v12 adds native identity — the model answers "who are you" as itself, unprompted:

  • Identity — 43,362 pairs (33% of training): name, builder, lineage, capabilities, honest handling of false-identity prompts
  • Protocol — 26,280 pairs (20%): sentinel-block discipline (<<<SQL>>>, <<<UNANSWERABLE>>>, <<<CLARIFY>>>)
  • SQL — 61,758 pairs (47%): the full v11 SQL curriculum, unchanged

The deployed model identity is Imagine. Built and fine-tuned by Interchained.


📊 The numbers

Model Held-out (telemetry) Protocol Execute rate Invented cols
imagine-v8 50.0% (20/40) 100% — —
imagine-v9 90.0% (36/40) 100% 97.5% 0
imagine-v10 100.0% (40/40) 100% 100% 0
imagine-v11 100.0% (40/40) 100% 100% 0
imagine-v12 100.0% (40/40) 100% 100% 0

Perfect score, held. Zero wrong answers. Zero hallucinations. Zero refusals.

Evaluated 2026-10-12 on the held-out telemetry set (40 queries, regenerated with seed 99), served as Q4_K_M GGUF via llama.cpp. Identity verified prompted and unprompted — correctly identifies as Imagine/Interchained, distinguishes DeepSeek lineage from identity, resists injection. Writes (INSERT/UPDATE/DELETE) verified with sentinel blocks.


🧬 How v12 was built

Two-stage fine-tuning from Interchained/imagine-v11, on a bare-metal NVIDIA B200 (gpu.ai):

Stage 1 — Full fine-tune

  • Corpus: 131,400 rows — exact 33% identity / 20% protocol / 47% SQL split, zero omissions
  • Epochs: 3 planned; the run filled the disk at step 3600/5664 (full-model checkpoints every 100 steps × 2.7GB each)
  • Recovery: step3500 checkpoint verified loadable, old checkpoints cleared, resumed for 1 final epoch — epoch mean loss 0.0136, final loss 0.0107
  • Time: ~22.5 min for the resumed leg, 39k tok/s

Stage 2 — LoRA refinement (early stop)

  • Base: v12 stage-1 final
  • Rank: 16, LR 5e-6, cosine schedule
  • Epochs: 1 of 3 — stopped to conserve GPU hours; epoch mean loss 0.0131
  • Adapter manually folded into the full checkpoint (models/imagine-v12-lora)

The corpus

Component Rows Share
identity 43,362 33%
protocol 26,280 20%
SQL 61,758 47%
total 131,400 100%

SQL side: 3,289 candidates forged, 3,284 admitted (99.85% gate admit rate), 68/68 gate behaviors green.

Nothing enters training that a live database hasn't agreed with.


🔬 The execution gate

Every candidate goes through L0–L4:

candidate SQL ──► L0  real PostgreSQL parser     not a regex
                 L1  read-only + bounded          no writes, no sleeps
                 L2  EXPLAIN on live schema       hallucinations die HERE
                 L3  execute, timed, capped       real rows
                 L4  SAME ANSWER as ref?          ◄── the one that matters
                                              ▼
                                       admitted to corpus

68/68 gate tests passing. The gate is the truth authority — not a bigger model, not vibes.


📦 Output protocol

SQL wrapped in sentinel blocks:

<<<SQL>>>
SELECT c.id, c.name, COALESCE(SUM(o.total), 0) AS total_spending
FROM customers c
LEFT JOIN orders o ON c.id = o.customer_id AND o.status = 'completed'
GROUP BY c.id, c.name
ORDER BY total_spending DESC, c.id ASC;
<<<END>>>

Can also refuse:

block meaning
<<<SQL>>> here is your query
<<<UNANSWERABLE>>> this schema cannot answer that
<<<CLARIFY>>> ambiguous — here's what's missing

⚠️ A truncated generation is not an answer. An unterminated block extracts to nothing.


💻 Loading v12

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "Interchained/imagine-v12"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

# Identity, unprompted
prompt = "Who are you and who built you?"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
    output = model.generate(inputs["input_ids"], max_new_tokens=128, do_sample=False)
print(tokenizer.decode(output[0], skip_special_tokens=True))

🎯 Identity

The deployed model identity is Imagine.

Built and fine-tuned by Interchained.

DeepSeek-Coder is part of the upstream lineage (via v8 → v9 → v10 → v11 → v12), but the deployed identity is Imagine.


⚡ Local-first

Runs on your hardware. No API key. No metered inference. No cloud dependency.


📐 The rules

1 · Don't write a verifier — the engine already shipped one. Real parser. Real planner. Real rows.

2 · Assert the property, not a proxy. Execution accuracy, not string similarity.

3 · Schema goes in the prompt, not in the weights. The model learns "read the schema you were handed" — not memorise ours.


⚠️ Limitations

v12 is a research checkpoint. It may still:

  • generate incorrect SQL on novel patterns
  • misunderstand ambiguous requests
  • produce writes with wrong WHERE clauses — always review before executing

Generated SQL should be reviewed before use in production. This applies doubly to writes.


🔒 Security

Do not rely on model behavior alone for database safety. Production systems should enforce:

  • least-privilege database roles
  • statement timeouts and row limits
  • query validation and schema restrictions
  • application-level authorization
  • audit logging
  • human approval for all write statements

Built by Interchained · ownership at every layer, including the model

3 > 1 — Mark drives, oracle points, Muse builds