Downloads · 30 days
658
65% of all-time downloads
jajmangold/gemma-4-12b-constraintkit-GGUF
gemma-4-12b-constraintkit-GGUF is a text-to-3d model from jajmangold. Use it for the text-to-3d task on the model card, and read the license before you ship it in a product. It is set up for gguf. The card lists the license as apache-2.0.
A 12B model that turns plain English into exact CAD, and knows when to say "I can't build that."
Downloads · 30 days
658
65% of all-time downloads
All-time downloads
1K
Public
Repo size
10.1 GB
Likes
6
Public
Click a slice to open those files.
.gguf9.8 GB · 97%
From the Hugging Face model README
A 12B model that turns plain English into exact CAD, and knows when to say "I can't build that."

| 93% | 87% | 57% vs 16% | ~$35 |
|---|---|---|---|
| builds verified against real geometry (SFT stage, held-out) | honest declines on out-of-scope requests (SFT stage; GRPO: 9/10) | honest builds vs a prompted frontier model, fresh requests | total training cost, SFT + GRPO |
This is a Gemma 4 12B fine-tune for constraint-kit, an open-source text-to-CAD system where the AI decides what to build and deterministic math decides where it goes. The model writes a small program: parts, parameters, and mates. constraint-kit compiles that program into real B-rep solids, solves the assembly, and exports STEP. Nothing is a mesh the model hallucinated. Every build can be checked against geometry.
flowchart LR
A(["Plain English"]) --> B["gemma-4-12b-constraintkit<br/>reasons, then writes a program"]
B -->|out of scope| X(["unsupported: reason"])
B -->|parts, params, mates| C["constraint-kit<br/>exact B-rep generators<br/>+ deterministic mate kernel"]
C --> D(["STEP / GLB, BOM,<br/>mass, drawings"])
"3x 12mm OD, 5mm bore, 8mm height spacers stacked."
→ {"parts": [{"id": "s0", "type": "spacer", "params": {"outer_d": 12, "bore_d": 5, "height": 8}}, ... ×3],
"mates": [{"a": "s0", "a_joint": "top", "b": "s1", "b_joint": "bottom"}, ...]}
"Need a spiral bevel gear for a heavy-duty application."
→ {"unsupported": "only straight bevel gears are modeled"}
That second answer is the point. It knows the vocabulary well enough to say which variant it's missing, instead of quietly handing you a straight bevel gear and calling it done.
These are real constraint-kit builds, rendered straight from the exported geometry. Only materials and lighting were added. They show what constraint-kit makes from the kind of parts-params-mates program this model writes. To be precise, the quoted sentences went through constraint-kit's default hosted planner (DeepSeek), not this model, and the banner's planetary gearset was designed by the Z3 solver to exactly 4:1.
![]() | ![]() | ![]() |
| "a pillow bearing block bolted to the side of a 100 mm 20x20 aluminum V-slot extrusion with two M5 socket head screws, a 608 ball bearing pressed into the block's bore, and a 60 mm long 8 mm steel shaft through the bearing" | "an M8 threaded rod 80 mm long with a steel washer and hex nut near each end". The thread is real helical geometry | Four-bar linkage from link lengths 100 / 35 / 90 / 70 mm, closed by the SolveSpace solver |
![]() | ![]() | ![]() |
| NEMA stepper, placed as a BOSL2 library "vitamin" | Flanged pulley, added after the census found it among the most-requested missing parts | Spur pair at the exact center distance, m·(z₁+z₂)/2 |
| File | What it is |
|---|---|
gemma4-12b-constraintkit-grpo-Q6_K.gguf | Final model (SFT + GRPO), Q6_K, 9.8 GB. For llama.cpp |
lora/ | The same model as a PEFT LoRA adapter (r=16) on unsloth/gemma-4-12b-it |
train_sys.txt | The exact system prompt used in training. Required, because the model was not trained on any other prompt |
llama-server -m gemma4-12b-constraintkit-grpo-Q6_K.gguf -c 8192 -ngl 99 --port 8086
# On Volta (V100-class) GPUs add: -fa off -ub 1024 (flash-attn auto = very slow prefill there)
Use raw /completion with the training serialization. The system turn starts with the <|think|> mode token,
and generation stops at <turn|>:
import json, urllib.request
SYS = open("train_sys.txt").read()
def generate(request: str) -> str:
prompt = (f"<|turn>system\n<|think|>\n{SYS}<turn|>\n"
f"<|turn>user\n{request}<turn|>\n<|turn>model\n")
body = {"prompt": prompt, "n_predict": 1400, "temperature": 0.2, "top_p": 0.95, "stop": ["<turn|>"]}
req = urllib.request.Request("http://127.0.0.1:8086/completion", data=json.dumps(body).encode(),
headers={"Content-Type": "application/json"})
text = json.loads(urllib.request.urlopen(req).read())["content"]
return text.split("<channel|>")[-1].strip() # drop the reasoning trace, keep the JSON program
print(generate("a plate with a spacer and a 24-tooth module-1 gear stacked on its boss"))
The output is a DSL program ({"parts": [...], "mates": [...]}) or {"unsupported": "..."}. To check it and
build it, send it to a running constraint-kit service (POST /dsl/verify, POST /build).
| Stage | Builds (geometry-verified) | Honest declines | Notes |
|---|---|---|---|
| SFT, bf16 | 56/60 (93%) | 26/30 (87%) | 0 format failures, 0 build errors |
| SFT, Q6_K GGUF | 55/60 (92%) | 25/30 (83%) | Same 90 probes. Quantization costs about 1–3 points, mostly in declines |
| SFT + GRPO (this model) | 6/6 held | 9/10 (from 8/10) | 16-probe A/B. Silent wrong-variant builds halved (2/10 → 1/10) |
flowchart LR
prompt(["Request"]) --> policy["Gemma 4 12B<br/>LoRA policy"]
policy --> prog["Reasoning + program<br/>or decline"]
prog --> verifier["constraint-kit verifier<br/>checks pass? builds?<br/>geometry signature match?"]
verifier -->|reward| policy
training/.A negative result, reported honestly: a multimodal image→CAD LoRA was also trained and thrown away. With images verified as fed to the model, it scored 52% with the render vs 47% without, which is noise. The model ignored the picture and relied on the bounding box. The results are written up in the repo. The weights aren't shipped.
train_sys.txt (spacer, spur_gear, plate, shaft, washer, nut, bolt, panel,
link, housing, sheet_bracket, and a few library "vitamins"). Anything else should be declined.POST /dsl/verify) before trusting the geometry.Apache-2.0, the same as the Gemma 4 base model. constraint-kit itself is MIT.