From 8f4b80da7939abc235734af0d3de242430095b1b Mon Sep 17 00:00:00 2001 From: ModelHub XC Date: Mon, 29 Jun 2026 18:31:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=8C=E7=94=B1ModelHub=20XC=E7=A4=BE=E5=8C=BA=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Model: delimitter/synoema-coder-3b-tools-v8 Source: Original Platform --- .gitattributes | 39 ++++++++ README.md | 139 ++++++++++++++++++++++++++ adapter_config.json | 50 +++++++++ adapter_model.safetensors | 3 + chat_template.jinja | 54 ++++++++++ synoema-coder-3b-tools-v8.Q4_K_M.gguf | 3 + synoema-coder-3b-tools-v8.Q8_0.gguf | 3 + synoema-coder-3b-tools-v8.f16.gguf | 3 + tokenizer.json | 3 + tokenizer_config.json | 16 +++ training_summary.json | 11 ++ 11 files changed, 324 insertions(+) create mode 100644 .gitattributes create mode 100644 README.md create mode 100644 adapter_config.json create mode 100644 adapter_model.safetensors create mode 100644 chat_template.jinja create mode 100644 synoema-coder-3b-tools-v8.Q4_K_M.gguf create mode 100644 synoema-coder-3b-tools-v8.Q8_0.gguf create mode 100644 synoema-coder-3b-tools-v8.f16.gguf create mode 100644 tokenizer.json create mode 100644 tokenizer_config.json create mode 100644 training_summary.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ac28465 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,39 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +tokenizer.json filter=lfs diff=lfs merge=lfs -text +synoema-coder-3b-tools-v8.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text +synoema-coder-3b-tools-v8.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text +synoema-coder-3b-tools-v8.f16.gguf filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..a0d03fc --- /dev/null +++ b/README.md @@ -0,0 +1,139 @@ +--- +language: [en] +license: apache-2.0 +base_model: unsloth/Qwen2.5-Coder-3B-Instruct +library_name: peft +pipeline_tag: text-generation +tags: [synoema, tool-use, agentic, function-calling, lora, qlora, code, qwen2.5, gguf] +model-index: +- name: synoema-coder-3b-tools-v8 + results: + - task: {type: tool-use, name: Synoema MCP Agentic Tool-Use Eval (28 tasks)} + metrics: + - {type: pass@1, value: 1.0, name: "28-task agentic eval (28/28)"} +--- + +# Synoema-Coder-3B Tools (C8) + +A **3B** LoRA fine-tune of `unsloth/Qwen2.5-Coder-3B-Instruct` that turns it into an **agentic coding model for the +[Synoema](https://synoema.tech) programming language** — it writes Synoema, type-checks it, +runs it, searches a corpus, and self-corrects on errors, all through MCP tools. + +- 🌐 **Website:** https://synoema.tech +- 🤖 **This model:** https://huggingface.co/delimitter/synoema-coder-3b-tools-v8 +- 📚 **Training corpus (dataset):** https://huggingface.co/datasets/delimitter/synoema-coder-3b-tools-corpus + +--- + +## 🏆 Result: **100% (28/28)** on the Synoema agentic tool-use benchmark + +Scored on the **corrected agentic harness**: the model is driven **turn-by-turn** (generation +stops at `<|im_end|>`), and **real** tool results are injected between turns — actual +`sno check` / `sno run` output from the live Synoema compiler, never mocked. A task only passes +if the model genuinely completes it end-to-end (e.g. multi-write self-correction: write broken +code → observe the type error → rewrite a valid fix → type-check passes). + +| Capability | Tasks | Pass | +|---|---|---| +| Write + typecheck + run | TU1–TU3, TU5, TU10 | ✅ | +| Search → write → run | TU6, TU9, TU20 | ✅ | +| Multi-write self-correction (if/else → ternary) | TU4, TU13 | ✅ | +| Language features (ADT, HOF, pattern match, cons) | TU11, TU14–TU19, TU23, TU29 | ✅ | +| List comprehensions | TU12, TU26 | ✅ | +| Nested ternary (fizzbuzz) | TU22, TU30 | ✅ | +| **Total** | **28** | **28/28** | + +--- + +## What is Synoema? + +[Synoema](https://synoema.tech) is an **LLM-native programming language and runtime** designed so +that models can write it reliably: + +- **BPE-aligned operators** — every operator maps to exactly one `cl100k_base` token. +- **Ternary instead of if/else** — `? cond -> a : b` (nestable). +- **GBNF grammar** for constrained decoding (structural-correctness guarantee). +- **Cranelift JIT + WebAssembly** compile targets. +- **MCP server** exposing `file_write`, `file_read`, `sno_typecheck`, `sno_run`, `search_corpus`. +- **Contract annotations** (`requires` / `ensures`) for formal verification. + +--- + +## Model details + +| Property | Value | +|---|---| +| Base model | `unsloth/Qwen2.5-Coder-3B-Instruct` | +| Parameters | 3B | +| Method | QLoRA (4-bit NF4 + LoRA), merged to fp16 for GGUF | +| LoRA | r=16, alpha=32 | +| Sequence length | 1024 | +| Epochs / cycle | 3 | +| Training corpus | ~18k tool-use + codegen examples — **every example passes `sno check` + `sno run`** | +| Cycle | C8 (sequential "carousel": each cycle warm-starts from the best previous adapter, then trains on the corpus plus targeted examples for the prior cycle's failures) | +| Hardware | AMD RX 7900 GRE 16GB (ROCm + unsloth) | + +--- + +## GGUF files (llama.cpp / Ollama / LM Studio) + +| File | Quant | Size | Notes | +|---|---|---|---| +| `synoema-coder-3b-tools-v8.Q4_K_M.gguf` | Q4_K_M | 2 GB | smallest, recommended for local use | +| `synoema-coder-3b-tools-v8.Q8_0.gguf` | Q8_0 | 3 GB | near-lossless | +| `synoema-coder-3b-tools-v8.f16.gguf` | F16 | 6 GB | full precision | + +```bash +# llama.cpp +llama-cli -hf delimitter/synoema-coder-3b-tools-v8 --hf-file synoema-coder-3b-tools-v8.Q4_K_M.gguf -p "Write quicksort in Synoema to src/qs.sno and run it." + +# Ollama +ollama run hf.co/delimitter/synoema-coder-3b-tools-v8:Q4_K_M +``` + +--- + +## Usage — Transformers + PEFT (adapter) + +```python +from peft import PeftModel +from transformers import AutoModelForCausalLM, AutoTokenizer + +base = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-Coder-3B-Instruct", device_map="auto") +tok = AutoTokenizer.from_pretrained("unsloth/Qwen2.5-Coder-3B-Instruct") +model = PeftModel.from_pretrained(base, "delimitter/synoema-coder-3b-tools-v8") +``` + +Prompt format is **ChatML**. The system prompt used at training/eval: + +``` +<|im_start|>system +You are sno-code, a Synoema coding agent. Use tools to write and verify code.<|im_end|> +<|im_start|>user +Write `square x = x * x` with `main = square 9` to src/square.sno, typecheck and run it.<|im_end|> +<|im_start|>assistant +``` + +The model emits OpenAI-style `tool_calls` for `file_write`, `sno_typecheck`, `sno_run`, +`file_read`, `search_corpus`; feed real tool results back as `tool` turns. + +--- + +## Synoema language quick reference + +```synoema +maxOf x y = ? x > y -> x : y -- ternary (NO if/then/else) +fact 0 = 1 -- pattern matching +fact n = n * fact (n - 1) +evens xs = [x | x <- xs, x % 2 == 0] -- list comprehension +sumList xs = foldl (\acc x -> acc + x) 0 xs -- higher-order functions +Direction = North | South | East | West -- ADT +opposite North = South +main = qsort [3 1 4 1 5] -- lists are SPACE-separated +``` + +--- + +## License + +Apache-2.0 (same as the Qwen2.5 base model). **Synoema** © Andrey Bubnov — https://synoema.tech diff --git a/adapter_config.json b/adapter_config.json new file mode 100644 index 0000000..4e4c2a1 --- /dev/null +++ b/adapter_config.json @@ -0,0 +1,50 @@ +{ + "alora_invocation_tokens": null, + "alpha_pattern": {}, + "arrow_config": null, + "auto_mapping": { + "base_model_class": "Qwen2ForCausalLM", + "parent_library": "transformers.models.qwen2.modeling_qwen2", + "unsloth_fixed": true + }, + "base_model_name_or_path": "unsloth/qwen2.5-coder-3b-instruct-bnb-4bit", + "bias": "none", + "corda_config": null, + "ensure_weight_tying": false, + "eva_config": null, + "exclude_modules": null, + "fan_in_fan_out": false, + "inference_mode": true, + "init_lora_weights": true, + "layer_replication": null, + "layers_pattern": null, + "layers_to_transform": null, + "loftq_config": {}, + "lora_alpha": 32, + "lora_bias": false, + "lora_dropout": 0, + "megatron_config": null, + "megatron_core": "megatron.core", + "modules_to_save": null, + "peft_type": "LORA", + "peft_version": "0.18.1", + "qalora_group_size": 16, + "r": 16, + "rank_pattern": {}, + "revision": null, + "target_modules": [ + "o_proj", + "up_proj", + "gate_proj", + "down_proj", + "k_proj", + "v_proj", + "q_proj" + ], + "target_parameters": null, + "task_type": "CAUSAL_LM", + "trainable_token_indices": null, + "use_dora": false, + "use_qalora": false, + "use_rslora": false +} \ No newline at end of file diff --git a/adapter_model.safetensors b/adapter_model.safetensors new file mode 100644 index 0000000..302dcc8 --- /dev/null +++ b/adapter_model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6986bb448f420f7db65fad5530e15365b9cbaf8e87ec645cb0acf2005b09c6f5 +size 119801528 diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..bdf7919 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,54 @@ +{%- if tools %} + {{- '<|im_start|>system\n' }} + {%- if messages[0]['role'] == 'system' %} + {{- messages[0]['content'] }} + {%- else %} + {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }} + {%- endif %} + {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n" }} + {%- for tool in tools %} + {{- "\n" }} + {{- tool | tojson }} + {%- endfor %} + {{- "\n\n\nFor each function call, return a json object with function name and arguments within XML tags:\n\n{\"name\": , \"arguments\": }\n<|im_end|>\n" }} +{%- else %} + {%- if messages[0]['role'] == 'system' %} + {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }} + {%- else %} + {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }} + {%- endif %} +{%- endif %} +{%- for message in messages %} + {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %} + {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} + {%- elif message.role == "assistant" %} + {{- '<|im_start|>' + message.role }} + {%- if message.content %} + {{- '\n' + message.content }} + {%- endif %} + {%- for tool_call in message.tool_calls %} + {%- if tool_call.function is defined %} + {%- set tool_call = tool_call.function %} + {%- endif %} + {{- '\n\n{"name": "' }} + {{- tool_call.name }} + {{- '", "arguments": ' }} + {{- tool_call.arguments | tojson }} + {{- '}\n' }} + {%- endfor %} + {{- '<|im_end|>\n' }} + {%- elif message.role == "tool" %} + {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %} + {{- '<|im_start|>user' }} + {%- endif %} + {{- '\n\n' }} + {{- message.content }} + {{- '\n' }} + {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} + {{- '<|im_end|>\n' }} + {%- endif %} + {%- endif %} +{%- endfor %} +{%- if add_generation_prompt %} + {{- '<|im_start|>assistant\n' }} +{%- endif %} diff --git a/synoema-coder-3b-tools-v8.Q4_K_M.gguf b/synoema-coder-3b-tools-v8.Q4_K_M.gguf new file mode 100644 index 0000000..a81ce2c --- /dev/null +++ b/synoema-coder-3b-tools-v8.Q4_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c55992586847cb9fb99c23f0f3b4a7e78e3759df75eb956bbf231fb746ea45ff +size 1929902528 diff --git a/synoema-coder-3b-tools-v8.Q8_0.gguf b/synoema-coder-3b-tools-v8.Q8_0.gguf new file mode 100644 index 0000000..66c624b --- /dev/null +++ b/synoema-coder-3b-tools-v8.Q8_0.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b489811e7ea27a1cd1f04fae66e9ec0735510927ec26f4f3924ef7ea2f2417e6 +size 3285475776 diff --git a/synoema-coder-3b-tools-v8.f16.gguf b/synoema-coder-3b-tools-v8.f16.gguf new file mode 100644 index 0000000..41ff2e0 --- /dev/null +++ b/synoema-coder-3b-tools-v8.f16.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9a5dc5f6ba063ccf8e70c48f5b31f1cc5ce72594be562c52908292f61f90572 +size 6178316736 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..5340d81 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd5948af71b4f56cf697f7580814c7ce8b80595ef985544efcacf716126a2e31 +size 11422356 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..9e10a1d --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,16 @@ +{ + "add_prefix_space": false, + "backend": "tokenizers", + "bos_token": null, + "clean_up_tokenization_spaces": false, + "eos_token": "<|im_end|>", + "errors": "replace", + "extra_special_tokens": [], + "is_local": false, + "model_max_length": 32768, + "pad_token": "<|PAD_TOKEN|>", + "padding_side": "left", + "split_special_tokens": false, + "tokenizer_class": "Qwen2Tokenizer", + "unk_token": null +} diff --git a/training_summary.json b/training_summary.json new file mode 100644 index 0000000..897b770 --- /dev/null +++ b/training_summary.json @@ -0,0 +1,11 @@ +{ + "model": "/home/abubnov/synoema/research/finetune/mcp/output/seq-qwen2.5-coder-3b-tools-c6", + "train_mode": "causal_lm_qlora", + "examples": 18083, + "codegen": 6000, + "interrogator": 0, + "epochs": 3, + "lora_r": 16, + "train_seconds": 31865, + "output": "/home/abubnov/synoema/research/finetune/mcp/output/seq-qwen2.5-coder-3b-tools-c8" +} \ No newline at end of file