Utiric commited on
Commit
eb50150
·
verified ·
1 Parent(s): 57c3ee3

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ![ARBITER banner](./arbiter-banner.svg)
2
+
3
+ [![held-out](https://img.shields.io/badge/held--out_macro-0.844-blue)](./README.md)
4
+ [![params](https://img.shields.io/badge/params-0.6B-violet)](./README.md)
5
+ [![langs](https://img.shields.io/badge/langs-TR_%2B_EN-yellow)](./README.md)
6
+ [![license](https://img.shields.io/badge/license-Apache--2.0-green)](./README.md)
7
+
8
+ # ARBITER-general — 0.6B single-pass decision layer
9
+
10
+ **State in, typed decisions out. One forward pass, zero generated tokens.**
11
+
12
+ ARBITER is a fine-tune of `Qwen/Qwen3-0.6B-Base` that answers structured questions —
13
+ `choice` (up to 52 options), `score` (ordered levels), `noul` (yes/no) — in a single
14
+ forward pass, in Turkish or English. It never generates text: option-letter logits
15
+ (`A`–`Z`, `a`–`z`) are read at a fixed `Answer: (` slot and soft-maxed into calibrated
16
+ probabilities with a confidence score.
17
+
18
+ ```python
19
+ from arbiter import Arbiter
20
+
21
+ arb = Arbiter("Utiric/arbiter-general") # a local directory path also works
22
+ out = arb.decide(
23
+ state="My package never arrived, I want a refund.",
24
+ questions=[
25
+ {"id": "intent", "type": "choice",
26
+ "instructions": "What does the customer want?",
27
+ "options": {"Refund": "wants money back",
28
+ "Whereabouts": "asks where the package is",
29
+ "Cancel": "wants to cancel the subscription",
30
+ "Greeting": "just saying hello"}},
31
+ {"id": "urgent", "type": "noul",
32
+ "instructions": "Does this need immediate action?",
33
+ "criteria": {"true": "angry, threatening, or time-critical",
34
+ "false": "routine request"}},
35
+ {"id": "tone", "type": "score",
36
+ "instructions": "Customer anger?",
37
+ "levels": ["calm", "annoyed", "angry", "furious"]},
38
+ ],
39
+ )
40
+ # {"intent": {"choice": "Refund", "probabilities": {...}, "confidence": 0.61},
41
+ # "urgent": {"noul": 0.12, "confidence": 0.76, ...},
42
+ # "tone": {"level": "2", "score": 2.1, ...}}
43
+ ```
44
+
45
+ > **No pip package (yet).** Copy `arbiter.py` (~200 lines, only `torch` + `transformers`)
46
+ > next to your code. No training stack, no server, no API key needed. The file mirrors
47
+ > the exact training prompt format — do not rephrase the prompt template inside it.
48
+
49
+ ---
50
+
51
+ ## How it works
52
+
53
+ ![How it works](./arbiter-how.svg)
54
+
55
+ 1. State and question are rendered into one prompt wrapped in `<state>` tags with
56
+ `Question (choice|yes/no|score):` labels and `(A) option — description` lines,
57
+ ending in `Answer: (`.
58
+ 2. The model runs **once**. The hidden state at the slot position is projected
59
+ through the LM-head rows of the 52 letter tokens only.
60
+ 3. Softmax over the valid options (temperature **1.6**, fit post-hoc) gives the
61
+ distribution. `confidence` = top-1 minus top-2 probability gap.
62
+ 4. `noul` returns P(yes); `score` returns the argmax level plus the expectation
63
+ over levels.
64
+
65
+ Latency scales with prompt length only (prefill cost) — there is no per-token
66
+ generation loop.
67
+
68
+ ## API reference
69
+
70
+ `Arbiter(path, device=None, temperature=None, max_state_tokens=2048)`
71
+
72
+ | Argument | Meaning |
73
+ |---|---|
74
+ | `path` | HF repo id or local directory with weights |
75
+ | `device` | `"cuda"` / `"cpu"` (auto-detected by default) |
76
+ | `temperature` | softmax temperature; default read from `s1_config.json` (1.6) |
77
+ | `max_state_tokens` | state truncation budget (70% head / 30% tail, marked) |
78
+
79
+ `decide(state, questions)` — `state` is a string (or JSON-serializable object).
80
+ Each question needs `id`, `type` (`choice` \| `score` \| `noul`), and:
81
+
82
+ | Type | Fields | Returns |
83
+ |---|---|---|
84
+ | `choice` | `instructions`, `options` (list or `{name: description}`) | `choice`, `probabilities`, `confidence` |
85
+ | `score` | `instructions`, `levels` (ordered list) | `level`, `score` (expectation), `confidence`, `probabilities` |
86
+ | `noul` | `instructions`, optional `criteria: {true, false}` | `noul` = P(yes), `confidence`, `probabilities` |
87
+
88
+ Budgets: **2048** state tokens · **52** options per pass · Turkish + English tested.
89
+
90
+ ---
91
+
92
+ ## Evaluation — held-out (8 tasks × 500, full eval, temperature 1.6)
93
+
94
+ Held-out rows never appeared in training (exact-dedup isolated). Macro **0.8438** vs chance 0.2958.
95
+
96
+ | Slice | acc | ECE | Note |
97
+ |---|---|---|---|
98
+ | code_pr_review | 1.000 | 0.053 | |
99
+ | customer_action | 0.796 | 0.073 | weakest link, under active work |
100
+ | dialogue_turn_taking | 0.992 | 0.014 | |
101
+ | irony_sarcasm | 0.620 | 0.117 | noisy slice — do not use standalone |
102
+ | legal_contract_risk | 0.914 | 0.025 | routing signal, not legal advice |
103
+ | medical_triage | 0.778 | 0.112 | routing signal, never autonomous diagnosis |
104
+ | moderation_discord | 0.704 | 0.084 | tier-1 pre-filter; escalate on low confidence |
105
+ | multilingual_sentiment | 0.946 | 0.028 | |
106
+ | **macro** | **0.8438** | 0.063 | Brier 0.220 |
107
+
108
+ ## Evaluation — public zero-shot (0-shot, slot-logit scoring, no generation)
109
+
110
+ | Benchmark (split, n) | ARBITER | Random / Majority |
111
+ |---|---|---|
112
+ | Belebele tur_Latn (900) / eng_Latn (900) | 0.284 / 0.340 | 0.25 / 0.28 |
113
+ | MMLU 6-subset avg (1,425) | 0.373 | 0.25 / 0.32 |
114
+ | Banking77 sample-500 | 0.035 | 0.013 |
115
+ | OffensEval-TR (3,528) | 0.797 | 0.50 / 0.80 |
116
+ | TweetEval offensive+hate (3,830) | 0.632 | 0.50 / 0.61 |
117
+ | XCOPA-TR (500) | 0.486 | 0.50 |
118
+ | XNLI-TR (1k sample) | 0.407 | 0.33 / 0.35 |
119
+
120
+ Read honestly: strong on trained domains, modest zero-shot — reported with random and
121
+ majority baselines everywhere, as it should be. XCOPA is chance-level; Banking77's
122
+ 77-way zero-shot is 3× random but low in absolute terms. Treat these as a floor for
123
+ fine-tuning, not a ceiling.
124
+
125
+ ## Training journey (held-out macro)
126
+
127
+ | Stage | macro | What changed |
128
+ |---|---|---|
129
+ | v1 SFT | 0.497 | baseline; overfit on 1.5 epochs |
130
+ | v2 + teacher relabel | 0.768 | 26k teacher-written descriptions |
131
+ | v3 + moderation data | 0.787 | moderation slice relabeled |
132
+ | v4 cherry-pick | 0.811 | kept gains, restored casualties |
133
+ | DPO-1 | 0.822 | 16k preference pairs |
134
+ | v5–v7 + new domains | 0.818 | legal/medical/multilingual siblings |
135
+ | **DPO-3 (this release)** | **0.844** | same pairs recipe on v7 |
136
+
137
+ Recipe: full fine-tune of the 0.6B backbone, CE + 0.3·Brier loss, 1 epoch,
138
+ held-out-Brier early stopping, then Decision-DPO (β=1.0 + 0.1 CE anchor, LR 1e-5).
139
+
140
+ ## Data card (summary)
141
+
142
+ - ~130k training rows across 26 tasks; ~26k teacher-(re)labeled rows.
143
+ - The teacher model (Ministral-14B) writes **descriptions only**; gold labels are
144
+ deterministic (rules, dataset labels, star ratings). Teacher-written golds proved
145
+ unreliable on irony and were reverted to dataset labels there.
146
+ - Gates on every iteration: exact-dedup train↔held-out, test-set contamination scan
147
+ (**0 overlaps** across 11.4k public-benchmark rows), option-name leakage scan on
148
+ teacher-written descriptions.
149
+
150
+ ## Limitations (please read before deploying)
151
+
152
+ - A classifier head — not a reasoner, generator, or judge. No free text, ever.
153
+ - Medical and legal outputs are triage signals for pipelines **with humans in the loop**.
154
+ - Moderation output is a tier-1 signal; escalate to a stronger judge and a human
155
+ on low confidence.
156
+ - Turkish + English only. Customer-action and irony are the weakest slices.
157
+ - Not hardened against adversarial prompt injection.
158
+
159
+ ## Files
160
+
161
+ | File | What |
162
+ |---|---|
163
+ | `model.safetensors` (+ `config.json`, `tokenizer.*`, `s1_config.json`) | weights, Qwen3-0.6B-Base format |
164
+ | `arbiter.py` | standalone inference client — copy it, nothing to install |
165
+ | `arbiter-banner.svg`, `arbiter-how.svg` | release artwork |
166
+ | `README.md` | this card |
167
+
168
+ ## License & citation
169
+
170
+ Apache-2.0 (base-model license carried over).
171
+
172
+ ```bibtex
173
+ @misc{arbiter2026,
174
+ title = {ARBITER-general: a 0.6B single-pass decision layer for TR+EN},
175
+ author = {Utiric},
176
+ year = {2026},
177
+ note = {Held-out macro 0.844 across 8 tasks; Qwen3-0.6B-Base fine-tune + Decision-DPO}
178
+ }
179
+ ```
arbiter-banner.svg ADDED
arbiter-how.svg ADDED
arbiter.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ARBITER standalone inference client (copy this file, no package to install).
2
+
3
+ Mirrors the exact training/eval prompt format from System One (`s1/schema.py`,
4
+ `s1/engine.py`): <state> tags with 70/30 head-tail truncation, `Question (kind):`
5
+ labels, `(A) option — description` lines, and a single logit readout at the
6
+ `Answer: (` slot. Deviating from this format degrades scores — do not rephrase it.
7
+
8
+ Requires: torch, transformers. Weights: Qwen3-0.6B-Base fine-tune (Apache-2.0).
9
+
10
+ Usage:
11
+ from arbiter import Arbiter
12
+ arb = Arbiter("Utiric/arbiter-general") # or a local directory
13
+ out = arb.decide(
14
+ state="Package never arrived, I want a refund.",
15
+ questions=[{"id": "intent", "type": "choice",
16
+ "instructions": "What does the customer want?",
17
+ "options": {"Refund": "wants money back",
18
+ "Whereabouts": "asks where the package is"}}],
19
+ )
20
+ # {"intent": {"choice": "Refund", "probabilities": {...}, "confidence": 0.61}}
21
+ """
22
+
23
+ import json
24
+ import string
25
+
26
+ import torch
27
+ from transformers import AutoModelForCausalLM, AutoTokenizer
28
+
29
+ LETTERS = list(string.ascii_uppercase) + list(string.ascii_lowercase) # 52 slots
30
+ KIND_TAG = {"choice": "choice", "noul": "yes/no", "score": "score"}
31
+ TRUNC_MARKER = "\n[... truncated ...]\n"
32
+
33
+
34
+ def _truncate(tok, text, max_tokens):
35
+ ids = tok.encode(text, add_special_tokens=False)
36
+ if len(ids) <= max_tokens:
37
+ return ids
38
+ head = int(max_tokens * 0.7)
39
+ tail = max_tokens - head - 8
40
+ mid = tok.encode(TRUNC_MARKER, add_special_tokens=False)
41
+ return ids[:head] + mid + ids[-tail:]
42
+
43
+
44
+ def _render_option(letter, opt, desc):
45
+ opt = str(opt).strip()
46
+ if desc:
47
+ return f"({letter}) {opt} — {str(desc).strip()}"
48
+ return f"({letter}) {opt}"
49
+
50
+
51
+ def _build_ids(tok, state, qtext, kind, options, descs, max_state_tokens):
52
+ if not isinstance(state, str):
53
+ state = json.dumps(state, ensure_ascii=False, indent=1)
54
+ bos = [tok.bos_token_id] if tok.bos_token_id is not None else []
55
+ ids = list(bos) + tok.encode("<state>\n", add_special_tokens=False)
56
+ ids += _truncate(tok, state, max_state_tokens)
57
+ ids += tok.encode("\n</state>\n", add_special_tokens=False)
58
+ lines = [f"\nQuestion ({KIND_TAG.get(kind, kind)}): {str(qtext).strip()}"]
59
+ if kind == "score":
60
+ lines.append("\nLevels:")
61
+ elif kind == "choice":
62
+ lines.append("\nOptions:")
63
+ for j, o in enumerate(options):
64
+ d = descs[j] if descs and j < len(descs) else None
65
+ lines.append("\n" + _render_option(LETTERS[j], o, d))
66
+ lines.append("\nAnswer: (")
67
+ ids.extend(tok.encode("".join(lines), add_special_tokens=False))
68
+ return ids
69
+
70
+
71
+ class Arbiter:
72
+ def __init__(self, path, device=None, temperature=None, max_state_tokens=2048):
73
+ self.device = device or ("cuda" if torch.cuda.is_available() else "cpu")
74
+ dtype = torch.bfloat16 if self.device == "cuda" else torch.float32
75
+ self.tok = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
76
+ if self.tok.pad_token_id is None:
77
+ self.tok.pad_token = self.tok.eos_token or "<|endoftext|>"
78
+ self.lm = (
79
+ AutoModelForCausalLM.from_pretrained(
80
+ path, dtype=dtype, trust_remote_code=True
81
+ )
82
+ .to(self.device)
83
+ .eval()
84
+ )
85
+ inner = getattr(self.lm, "model", None)
86
+ self.backbone = getattr(inner, "language_model", inner) or self.lm
87
+ cfg = self.lm.config
88
+ self.softcap = getattr(
89
+ getattr(cfg, "text_config", cfg), "final_logit_softcapping", None
90
+ )
91
+ lids = []
92
+ for L in LETTERS:
93
+ e = self.tok.encode(L, add_special_tokens=False)
94
+ assert len(e) == 1, f"letter {L!r} is not a single token in this tokenizer"
95
+ lids.append(e[0])
96
+ self.letter_ids = torch.tensor(lids, device=self.device)
97
+ self.temperature = 1.0 if temperature is None else float(temperature)
98
+ try:
99
+ import os
100
+
101
+ cfg_path = os.path.join(path, "s1_config.json")
102
+ if os.path.isfile(cfg_path):
103
+ with open(cfg_path) as f:
104
+ self.temperature = float(
105
+ json.load(f).get("temperature", self.temperature)
106
+ )
107
+ except OSError:
108
+ pass
109
+ self.max_state_tokens = max_state_tokens
110
+
111
+ @torch.no_grad()
112
+ def _probs(self, ids, nopts):
113
+ x = torch.tensor([ids], device=self.device)
114
+ mask = torch.ones_like(x)
115
+ h = self.backbone(input_ids=x, attention_mask=mask).last_hidden_state[:, -1, :]
116
+ W = self.lm.get_output_embeddings().weight[self.letter_ids]
117
+ logits = torch.nn.functional.linear(h.to(W.dtype), W).float()
118
+ if self.softcap:
119
+ logits = torch.tanh(logits / self.softcap) * self.softcap
120
+ logits = logits / self.temperature
121
+ logits[:, nopts:] = float("-inf")
122
+ return torch.softmax(logits[0, :nopts], -1).cpu().tolist()
123
+
124
+ def decide(self, state, questions):
125
+ out = {}
126
+ for q in questions:
127
+ kind = q.get("type", "choice")
128
+ text = q.get("instructions") or q.get("question") or q.get("text") or ""
129
+ if kind == "noul":
130
+ crit = q.get("criteria") or {}
131
+ opts = ["no", "yes"]
132
+ descs = (
133
+ [crit.get("false"), crit.get("true")]
134
+ if isinstance(crit, dict)
135
+ else None
136
+ )
137
+ elif kind == "score":
138
+ levels = q.get("levels") or []
139
+ opts = [str(i) for i in range(len(levels))]
140
+ descs = list(levels)
141
+ else:
142
+ o = q.get("options") or []
143
+ if isinstance(o, dict):
144
+ opts, descs = list(o.keys()), list(o.values())
145
+ else:
146
+ opts, descs = [str(x) for x in o], None
147
+ assert len(opts) <= len(LETTERS), f"max {len(LETTERS)} options per pass"
148
+ ids = _build_ids(
149
+ self.tok, state, text, kind, opts, descs, self.max_state_tokens
150
+ )
151
+ p = self._probs(ids, len(opts))
152
+ by_opt = {o: p[i] for i, o in enumerate(opts)}
153
+ top = sorted(range(len(opts)), key=lambda i: -p[i])
154
+ conf = p[top[0]] - (p[top[1]] if len(p) > 1 else 0.0)
155
+ qid = q.get("id", "q")
156
+ if kind == "noul":
157
+ out[qid] = {"noul": p[1], "confidence": conf, "probabilities": by_opt}
158
+ elif kind == "score":
159
+ out[qid] = {
160
+ "level": str(top[0]),
161
+ "score": sum(i * v for i, v in enumerate(p)),
162
+ "confidence": conf,
163
+ "probabilities": by_opt,
164
+ }
165
+ else:
166
+ out[qid] = {
167
+ "choice": opts[top[0]],
168
+ "confidence": conf,
169
+ "probabilities": by_opt,
170
+ }
171
+ return out
172
+
173
+
174
+ if __name__ == "__main__":
175
+ import sys
176
+
177
+ arb = Arbiter(sys.argv[1] if len(sys.argv) > 1 else "Utiric/arbiter-general")
178
+ print(
179
+ json.dumps(
180
+ arb.decide(
181
+ state="Kargo 20 gündür gelmedi, iade istiyorum.",
182
+ questions=[
183
+ {
184
+ "id": "intent",
185
+ "type": "choice",
186
+ "instructions": "What does the customer want?",
187
+ "options": {
188
+ "Refund": "wants money back",
189
+ "Whereabouts": "asks where the package is",
190
+ "Cancel": "wants to cancel",
191
+ "Greeting": "just saying hello",
192
+ },
193
+ }
194
+ ],
195
+ ),
196
+ ensure_ascii=False,
197
+ indent=1,
198
+ )
199
+ )
chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# 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>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\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" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151643,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 3072,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention"
44
+ ],
45
+ "max_position_embeddings": 32768,
46
+ "max_window_layers": 28,
47
+ "model_type": "qwen3",
48
+ "num_attention_heads": 16,
49
+ "num_hidden_layers": 28,
50
+ "num_key_value_heads": 8,
51
+ "pad_token_id": null,
52
+ "rms_norm_eps": 1e-06,
53
+ "rope_parameters": {
54
+ "rope_theta": 1000000,
55
+ "rope_type": "default"
56
+ },
57
+ "sliding_window": null,
58
+ "tie_word_embeddings": true,
59
+ "transformers_version": "5.17.0",
60
+ "use_cache": true,
61
+ "use_sliding_window": false,
62
+ "vocab_size": 151936
63
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": false,
4
+ "eos_token_id": 151643,
5
+ "max_new_tokens": 2048,
6
+ "transformers_version": "5.17.0"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8cd1c795c2cc9f925c6c02bfa7f0e25e432f2d2feab9570170a1fe5e829cf0d
3
+ size 1192135096
s1_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"temperature": 1.6}
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
3
+ size 11422650
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|endoftext|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "is_local": true,
24
+ "local_files_only": false,
25
+ "model_max_length": 131072,
26
+ "pad_token": "<|endoftext|>",
27
+ "split_special_tokens": false,
28
+ "tokenizer_class": "Qwen2Tokenizer",
29
+ "unk_token": null
30
+ }