synoema-coder-3b-v2
Synoema Coder model โ fine-tuned for generating general Synoema programs: arithmetic, recursion, higher-order functions, ADTs, pattern matching, and more.
Synoema is a formally verified, BPE-aligned functional language for LLM-generated software. GBNF grammar + Hindley-Milner types + contracts eliminate the verification gap โ prompt to native / WASM / IoT with no human review.
๐ synoema.tech ยท ๐ฆ GitHub ยท ๐ Language Reference
Model Description
General-purpose Synoema code generation model based on Qwen/Qwen2.5-Coder-3B-Instruct.
Generates syntactically and semantically correct Synoema programs across
all major language constructs. Outputs verified by sno run (exit code 0).
Evaluation Results
| Metric | Result | Method |
|---|---|---|
| run_pass | 75/104 (72.1%) | sampling t=0.7, 3 tries |
| compile_pass | 70/104 (67.3%) | greedy |
Corpus: corpus_synoema_passing_v9.jsonl (971 examples, v9)
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
base = "Qwen/Qwen2.5-Coder-3B-Instruct"
adapter = "delimitter/synoema-coder-3b-v2"
tok = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(base, torch_dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(model, adapter)
model = model.merge_and_unload()
SYS = """# Synoema โ BPE-aligned functional language
Entry point: `main = <expr>`. Functions: `name args = body`.
Pattern matching via multiple equations. Conditional: `? cond -> then : else`.
Lists: `[1 2 3]` (space-sep). No return, no print, no def/fn keywords.
Write only valid Synoema code."""
prompt = tok.apply_chat_template([
{"role": "system", "content": SYS},
{"role": "user", "content": "Fibonacci of 10"},
], tokenize=False, add_generation_prompt=True)
inp = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inp, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.9)
print(tok.decode(out[0][inp["input_ids"].shape[1]:], skip_special_tokens=True))
Synoema Code Examples
-- Fibonacci
fib 0 = 0
fib 1 = 1
fib n = fib (n - 1) + fib (n - 2)
main = fib 10
-- Quicksort
qsort [] = []
qsort [x|xs] = qsort (filter (\ y -> y < x) xs) ++ [x] ++ qsort (filter (\ y -> y >= x) xs)
main = qsort [3 1 4 1 5 9 2 6]
Training Details
| Parameter | Value |
|---|---|
| Language version | 0.1.0-beta.1 |
| Training corpus | corpus_synoema_passing_v9.jsonl (971 examples, v9) |
| Method | QLoRA (LoRA r=32, ฮฑ=64) |
| Base model | Qwen/Qwen2.5-Coder-3B-Instruct |
| Epochs | 10 |
| Learning rate | 1e-4 |
| Final loss | 0.0077 |
License
Apache 2.0. Base model license applies separately. See synoema.tech for full terms.