初始化项目,由ModelHub XC社区提供模型

Model: delimitter/synoema-coder-1.5b-tools-v12
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-06-29 20:45:36 +08:00
commit 69799ab629
11 changed files with 323 additions and 0 deletions

39
.gitattributes vendored Normal file
View File

@@ -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-1.5b-tools-v12.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
synoema-coder-1.5b-tools-v12.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
synoema-coder-1.5b-tools-v12.f16.gguf filter=lfs diff=lfs merge=lfs -text

139
README.md Normal file
View File

@@ -0,0 +1,139 @@
---
language: [en]
license: apache-2.0
base_model: unsloth/Qwen2.5-1.5B-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-1.5b-tools-v12
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-1.5B Tools (C12)
A **1.5B** LoRA fine-tune of `unsloth/Qwen2.5-1.5B-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-1.5b-tools-v12
- 📚 **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 | TU1TU3, 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, TU14TU19, 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-1.5B-Instruct` |
| Parameters | 1.5B |
| 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 | C12 (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-1.5b-tools-v12.Q4_K_M.gguf` | Q4_K_M | 940 MB | smallest, recommended for local use |
| `synoema-coder-1.5b-tools-v12.Q8_0.gguf` | Q8_0 | 2 GB | near-lossless |
| `synoema-coder-1.5b-tools-v12.f16.gguf` | F16 | 3 GB | full precision |
```bash
# llama.cpp
llama-cli -hf delimitter/synoema-coder-1.5b-tools-v12 --hf-file synoema-coder-1.5b-tools-v12.Q4_K_M.gguf -p "Write quicksort in Synoema to src/qs.sno and run it."
# Ollama
ollama run hf.co/delimitter/synoema-coder-1.5b-tools-v12:Q4_K_M
```
---
## Usage — Transformers + PEFT (adapter)
```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-1.5B-Instruct", device_map="auto")
tok = AutoTokenizer.from_pretrained("unsloth/Qwen2.5-1.5B-Instruct")
model = PeftModel.from_pretrained(base, "delimitter/synoema-coder-1.5b-tools-v12")
```
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

50
adapter_config.json Normal file
View File

@@ -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-1.5B-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": [
"v_proj",
"up_proj",
"k_proj",
"gate_proj",
"q_proj",
"down_proj",
"o_proj"
],
"target_parameters": null,
"task_type": "CAUSAL_LM",
"trainable_token_indices": null,
"use_dora": false,
"use_qalora": false,
"use_rslora": false
}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92a2bb8ca66fb1dfaed6ff2dda670d31f99c286af3682ceb14a6d11bfe02e6f9
size 73911112

54
chat_template.jinja Normal file
View File

@@ -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 <tools></tools> XML tags:\n<tools>" }}
{%- for tool in tools %}
{{- "\n" }}
{{- tool | tojson }}
{%- endfor %}
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|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<tool_call>\n{"name": "' }}
{{- tool_call.name }}
{{- '", "arguments": ' }}
{{- tool_call.arguments | tojson }}
{{- '}\n</tool_call>' }}
{%- endfor %}
{{- '<|im_end|>\n' }}
{%- elif message.role == "tool" %}
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
{{- '<|im_start|>user' }}
{%- endif %}
{{- '\n<tool_response>\n' }}
{{- message.content }}
{{- '\n</tool_response>' }}
{%- 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 %}

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:669e3378cacfc7760310a62907fce51354e3f46721b1ddf55da04443029d6b8d
size 986048032

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c4a46431d5d97e74106b5f970347d34de7612867ff23fe179705bceaf5ab16af
size 1646572576

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e4526812f21a0afbb20945f9fc699c24d3e23a9444baa552b38c9a4cdbffdec
size 3093668896

3
tokenizer.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bd5948af71b4f56cf697f7580814c7ce8b80595ef985544efcacf716126a2e31
size 11422356

15
tokenizer_config.json Normal file
View File

@@ -0,0 +1,15 @@
{
"add_prefix_space": false,
"backend": "tokenizers",
"bos_token": null,
"clean_up_tokenization_spaces": false,
"eos_token": "<|im_end|>",
"errors": "replace",
"is_local": false,
"model_max_length": 32768,
"pad_token": "<|PAD_TOKEN|>",
"padding_side": "left",
"split_special_tokens": false,
"tokenizer_class": "Qwen2Tokenizer",
"unk_token": null
}

11
training_summary.json Normal file
View File

@@ -0,0 +1,11 @@
{
"model": "/home/abubnov/synoema/research/finetune/mcp/output/seq-qwen2.5-1.5b-tools-c11",
"train_mode": "causal_lm_qlora",
"examples": 17087,
"codegen": 6000,
"interrogator": 0,
"epochs": 3,
"lora_r": 16,
"train_seconds": 17522,
"output": "/home/abubnov/synoema/research/finetune/mcp/output/seq-qwen2.5-1.5b-tools-c12"
}