codybum commited on
Commit
41f25fa
·
verified ·
1 Parent(s): 2029af3

KOS-V5-Instruct (Catbird) — IF-GRPO step 888

Browse files
Files changed (6) hide show
  1. README.md +294 -0
  2. config.json +72 -0
  3. generation_config.json +11 -0
  4. model.safetensors +3 -0
  5. tokenizer.json +0 -0
  6. tokenizer_config.json +11 -0
README.md ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ language:
6
+ - en
7
+ developed_by: University of Kentucky (College of Medicine Office for Research; Center for Clinical and Translational Science) and University of Louisville (Kentucky Center for Digital Innovation)
8
+ affiliations:
9
+ - name: University of Kentucky, College of Medicine Office for Research
10
+ url: https://medicine.uky.edu/sites/research
11
+ - name: University of Kentucky, Center for Clinical and Translational Science (CCTS)
12
+ url: https://www.ccts.uky.edu/
13
+ - name: University of Louisville, Kentucky Center for Digital Innovation
14
+ url: https://centers.louisville.edu/kentucky-center-digital-innovation
15
+ model_name: KOS-V5-Instruct
16
+ model_codename: Catbird
17
+ model_type: qwen3
18
+ base_model: Kentucky-Open-Science/KOS-V5-Base
19
+ tags:
20
+ - medical
21
+ - clinical
22
+ - biomedical
23
+ - instruction-following
24
+ - from-scratch
25
+ - qwen3
26
+ - KOS-V5
27
+ - university-of-kentucky
28
+ - university-of-louisville
29
+ - ccts
30
+ ---
31
+
32
+ # KOS-V5-Instruct · *"Catbird"*
33
+
34
+ **Developed by**
35
+
36
+ **University of Kentucky**
37
+ - [College of Medicine, Office for Research](https://medicine.uky.edu/sites/research)
38
+ - [Center for Clinical and Translational Science (CCTS)](https://www.ccts.uky.edu/)
39
+
40
+ **University of Louisville**
41
+ - [Kentucky Center for Digital Innovation](https://centers.louisville.edu/kentucky-center-digital-innovation)
42
+
43
+ > ⚠️ **Research use only.** This model is provided for research purposes only and must not be used for any
44
+ > commercial, clinical, legal, or production-grade application. The user assumes all risks associated with its use.
45
+
46
+ > 🔒 **Private research artifact.** This repository is private and is not a public release.
47
+
48
+ ---
49
+
50
+ **KOS-V5-Instruct** is a **3.72B-parameter instruction-following model trained completely from scratch** — not
51
+ distilled, not pruned, not continued-pretrained from a general base. It is the instruction-tuned head of the
52
+ **KOS-V5 "Catbird"** line — a **medical** model line whose base ranks **first of 17** at modelling held-out
53
+ clinical text, built on [**KOS-V5-Base**](https://huggingface.co/Kentucky-Open-Science/KOS-V5-Base)
54
+ (235.2B tokens, single epoch). Its instruction ability comes from **GRPO reinforcement learning** against the
55
+ *official* IFEval verifier.
56
+
57
+ **IFEval reported as strict-avg** = `(prompt-level strict + instruction-level strict) / 2` — the exact metric the
58
+ Hugging Face Open LLM Leaderboard publishes as "IFEval."
59
+
60
+ | IFEval **strict-avg** | model | who built it, and how |
61
+ | --: | :-- | :-- |
62
+ | 64.7 | Qwen2.5-3B-Instruct | Alibaba, ~18 trillion tokens |
63
+ | **67.01** | **KOS-V5-Instruct (ours)** | University research team, 235B tokens, from scratch |
64
+ | **61.6** | [KOS-V4-Instruct](https://huggingface.co/Kentucky-Open-Science/KOS-V4-Instruct) (previous generation) | University research team, 180B tokens, 24 GPUs |
65
+ | 55.9 | GPT-3.5-turbo-1106 (the original ChatGPT) | OpenAI, ~10,000-GPU supercomputer |
66
+
67
+ KOS-V5-Instruct **improves on KOS-V4-Instruct by +5.4 points of IFEval strict-avg (61.6 → 67.01)** and **+9.4
68
+ points of MMLU (0.2782 → 0.3720)**, while clearing both the original GPT-3.5-turbo generation and the
69
+ commercially trained Qwen2.5-3B.
70
+
71
+ ## Core specifications
72
+
73
+ | Attribute | Detail |
74
+ | :--- | :--- |
75
+ | **Architecture** | Decoder-only Transformer (`Qwen3ForCausalLM`), Grouped-Query Attention |
76
+ | **Parameters** | 3.715 B |
77
+ | **Hidden / Layers** | 2560 / 36 |
78
+ | **Attention** | 32 query / 8 KV heads (GQA 4:1), head_dim 128, per-head QK-RMSNorm |
79
+ | **Feed-forward** | SwiGLU, intermediate 9728 |
80
+ | **Vocabulary** | 32,000, custom medical byte-level BPE |
81
+ | **Context length** | 32,768 |
82
+ | **Position encoding** | RoPE, θ = 25,000 |
83
+ | **Embeddings** | tied |
84
+ | **Precision** | bfloat16 (7.43 GB, single shard) |
85
+
86
+ ## Pre-training (the KOS-V5 base)
87
+
88
+ Fine-tuned from [**KOS-V5-Base**](https://huggingface.co/Kentucky-Open-Science/KOS-V5-Base) — the from-scratch
89
+ pretrained foundation, a complete single-epoch run over **235.2B tokens**. See that card for corpus composition and
90
+ disclosed pretraining issues.
91
+
92
+ ## Post-training (this model)
93
+
94
+ **SFT** — full-parameter (not LoRA), ChatML (`qwen3_nothink`), LR 7e-5 cosine, GA=1, 1 epoch, NEFTune α=5, with a
95
+ 23-family instruction taxonomy upweighted 5×.
96
+
97
+ **RL (GRPO via verl)** — deterministic verifiable rewards, **no reward model, no LLM judge**. One 8-GPU wall, 888
98
+ steps, KL 0.002, from the `prod2` SFT seed. GRPO lifted IFEval strict-avg from **57.0 (SFT seed) → 67.01 (step 888,
99
+ shipped)**. The trajectory was **monotone to the end of the wall** — the run stopped because the compute wall
100
+ ended, not because it converged.
101
+
102
+ ## The medical foundation
103
+
104
+ **This is a medical model.** KOS-V5-Instruct inherits a base trained on a **54-source medical/biomedical corpus**
105
+ — not a general-purpose model with medical fine-tuning bolted on.
106
+
107
+ The strongest evidence is **bits-per-byte on held-out medical text**, which is tokenizer-agnostic and therefore
108
+ the only strictly fair cross-model comparison. In a **17-model pool** — including dedicated biomedical
109
+ specialists BioMedLM (300B PubMed tokens), Meditron-7B, PMC-LLaMA-7B and MedGemma-4B — the KOS-V5 base ranks
110
+ **first**:
111
+
112
+ | medical text (BPB, lower is better) | KOS-V5-Base | rank |
113
+ | :-- | --: | --: |
114
+ | **5-corpus mean, held-out medical text** | **0.4635** | **1 / 17** |
115
+ | clinical narratives | **0.4179** | **1 / 17** |
116
+ | radiology | **0.5132** | **1 / 17** |
117
+ | chest X-ray reports | **0.6688** | **1 / 17** |
118
+ | BIOSSES biomedical sentence similarity (Pearson / Spearman) | **0.7097 / 0.7014** | **1 / 17** |
119
+ | BLURB biomedical probe mean | 0.7268 | 2 / 17 |
120
+
121
+ Every comparator in that pool was trained on **1.3–153× more data** (0.3–36T tokens vs our 0.235T). See
122
+ [KOS-V5-Base](https://huggingface.co/Kentucky-Open-Science/KOS-V5-Base) for the full 96-metric evaluation.
123
+
124
+ ### Medical MMLU (from the 57-subject run above)
125
+
126
+ The 9 medical subjects of MMLU, extracted from the same official 5-shot run:
127
+
128
+ | medical subject | KOS-V5-Instruct | KOS-V4-Instruct |
129
+ | :-- | --: | --: |
130
+ | nutrition | 0.4706 | 0.2843 |
131
+ | clinical knowledge | 0.4340 | 0.3170 |
132
+ | virology | 0.3916 | 0.2952 |
133
+ | medical genetics | 0.3900 | 0.2700 |
134
+ | anatomy | 0.3852 | 0.3185 |
135
+ | professional medicine | 0.3603 | 0.2132 |
136
+ | college biology | 0.3542 | 0.2917 |
137
+ | college medicine | 0.3410 | 0.2486 |
138
+ | high-school biology | 0.3194 | 0.2387 |
139
+ | **medical-9 mean** | **0.3829** | **0.2752** |
140
+
141
+ **+10.8 points over KOS-V4-Instruct**, and above the model's own full-MMLU average (0.3720) — the medical
142
+ subjects are where it is strongest.
143
+
144
+ > ⚠️ **Why the MCQ numbers understate this model.** Our own measurements show KOS models place very little
145
+ > probability mass on MCQ answer *letters*: the format, not the knowledge, is the bottleneck. A model that ranks
146
+ > **1 of 17** at modelling clinical text while scoring modestly on multiple-choice is exhibiting exactly that gap.
147
+ > **Read the BPB results as the medical signal and the MCQ results as a floor, not a ceiling.**
148
+
149
+ ## Evaluation & benchmarks
150
+
151
+ **Official suites only**, EleutherAI lm-evaluation-harness `0.4.12.dev0` at upstream commit `c1c4bea`, run from a
152
+ **pristine clone** with stock, unmodified task definitions.
153
+
154
+ - **IFEval** — stock `ifeval` task, 0-shot, greedy (`do_sample=false`, `temperature=0.0`),
155
+ task-default `max_gen_toks=1280`, `--apply_chat_template`, seed 0. Constraint checking by the harness's vendored
156
+ **Google** verifier (`instructions_registry`, 25 instruction types).
157
+ - **MMLU** — stock `mmlu` group, official 57 subjects / 14,042 test items, 5-shot from `dev` (`first_n`),
158
+ loglikelihood over A–D, metric `acc` (not `acc_norm`), **no chat template**.
159
+
160
+ | benchmark | KOS-V5-Instruct | KOS-V4-Instruct | Δ |
161
+ | :-- | --: | --: | --: |
162
+ | **IFEval strict-avg** | **67.01** | 61.6 | **+5.4** |
163
+ | IFEval prompt-strict | 0.6155 | 0.5471 | +0.068 |
164
+ | IFEval inst-strict | 0.7242 | 0.6655 | +0.059 |
165
+ | IFEval prompt-loose | 0.6377 | 0.5693 | +0.068 |
166
+ | IFEval inst-loose | 0.7434 | 0.6882 | +0.055 |
167
+ | **MMLU (57-subj, 5-shot, `acc`)** | **0.3720** | 0.2782 | **+0.094** |
168
+
169
+ **Cross-engine reproduction.** IFEval strict-avg measured **67.01** (vLLM backend) and **66.99** (HuggingFace
170
+ backend, pristine harness) in two independent runs seven days apart — a **0.02-point** agreement across two
171
+ inference engines and two harness builds. Both figures are reported; the difference is far below the benchmark's
172
+ own ±2.14-point standard error on 541 prompts, so they are the same measurement.
173
+
174
+ **Harness validation.** The identical pipeline scored the peer mark **Qwen3-4B-Instruct-2507 at 84.71** IFEval
175
+ strict-avg (published reference: 83.4 prompt-strict; we measure 81.89), and independently reproduced
176
+ KOS-V4-Instruct's MMLU to four decimal places (0.2782) against a prior run on a *different* harness build. A score
177
+ of 0.0 on this pipeline would therefore be a model property, not a harness failure.
178
+
179
+ ### IFEval in context (strict-avg)
180
+
181
+ | model | weights | company | params | IFEval strict-avg |
182
+ | :-- | :-- | :-- | :-- | --: |
183
+ | GPT-4o-mini | Proprietary | OpenAI | 8B + | 79 \* |
184
+ | Llama-3.2-3B-Instruct | Open | Meta | 3.2B | 73.9 |
185
+ | **KOS-V5-Instruct (ours)** | **Private** | **Univ. of Kentucky / Louisville** | **3.7B** | **67.01** |
186
+ | Qwen2.5-3B-Instruct | Open | Alibaba | 3.0B | 64.7 |
187
+ | Phi-3-medium-4k-instruct | Open | Microsoft | 14.0B | 64.2 |
188
+ | Mistral-Large | Proprietary | Mistral AI | 46.7B + | 63 \* |
189
+ | **KOS-V4-Instruct (previous gen)** | **Open** | **Univ. of Kentucky** | **3.0B** | **61.6** |
190
+ | Yi-1.5-9B-Chat | Open | 01.AI | 8.8B | 60.5 |
191
+ | Phi-3.5-mini-instruct | Open | Microsoft | 3.8B | 57.7 |
192
+ | GPT-3.5-turbo-0613 | Proprietary | OpenAI | 20B + | 57 \* |
193
+ | Phi-3-mini-4k-instruct | Open | Microsoft | 3.8B | 56.1 |
194
+ | GPT-3.5-turbo-1106 | Proprietary | OpenAI | 20B + | 55.9 |
195
+ | Mistral-7B-Instruct-v0.2 | Open | Mistral AI | 7.2B | 55.0 |
196
+ | Llama-3.1-8B-Instruct | Open | Meta | 8.0B | 44.3 |
197
+ | Llama-2-13b-chat | Open | Meta | 13.0B | 39.8 |
198
+
199
+ **\* strict estimate** — no official IFEval strict sub-metrics published; estimated from published AVG4 or
200
+ prompt-strict (loose metrics run ~2–4 pts above strict). **\+ unofficial params.**
201
+
202
+ ### Against university-built instruction models
203
+
204
+ Measured by us on the identical pristine harness, same protocol, same day:
205
+
206
+ | model | institution | params | IFEval strict-avg | MMLU |
207
+ | :-- | :-- | --: | --: | --: |
208
+ | marin-8b-instruct | Stanford | 8.0B | 70.83 | 0.6112 |
209
+ | **KOS-V5-Instruct (ours)** | **UK / UofL** | **3.7B** | **67.01** | **0.3720** |
210
+ | YuLan-Mini-Instruct | Renmin | 2.4B | 61.51 | 0.5278 |
211
+ | **KOS-V4-Instruct (ours)** | **UK** | **3.0B** | **60.63** | 0.2782 |
212
+ | LLäMmlein-7B-chat | Würzburg | 7.0B | 54.07 | 0.5252 |
213
+ | Poro-34B-chat | U Turku | 34.2B | 34.63 | — |
214
+ | Minerva-7B-instruct | Sapienza | 7.4B | 21.51 | 0.4071 |
215
+ | CroissantLLMChat | CentraleSupélec | 1.3B | 19.94 | 0.2401 |
216
+ | Tucano-2b4-Instruct | U Bonn | 2.4B | 14.95 | 0.2589 |
217
+
218
+ On instruction-following KOS-V5-Instruct places **second among nine university-built instruct models**, ahead of
219
+ every entry except Stanford's Marin-8B — including Poro-34B at **9× its parameter count**. Note that several of
220
+ these models are non-English-first (Finnish, Italian, French, Portuguese, German) and are being measured on
221
+ English benchmarks, which understates their designed capability.
222
+
223
+ ## Known regressions and limitations
224
+
225
+ > These are disclosed deliberately. A high IFEval score does not make this checkpoint production-ready.
226
+
227
+ - **Tool / function calling regressed** relative to the SFT seed during GRPO: BFCL *multiple* **87.0 → 78.5**.
228
+ **No official BFCL has been re-measured on this checkpoint** under the current harness, and the prior-generation
229
+ BFCL figures are contested in our own records; they are therefore **not restated here**. Treat tool-calling on
230
+ this checkpoint as **unmeasured**.
231
+ - **Fabrication roughly doubled** on our internal gate (**14.4% → 28%**) during GRPO. That gate is itself under
232
+ review because it measures on pretraining-distribution text, so the magnitude is uncertain — but the direction
233
+ is a real concern and is the main reason this artifact is private.
234
+ - **Optimising a verifiable reward moved a verifiable metric.** GRPO maximised the official IFEval checker, and
235
+ IFEval went up. Improvement on *unrelated* capabilities should not be assumed from this number.
236
+ - **MMLU 0.3720 is above chance (0.25) but modest.** This is not a knowledge model; it should not be used as a
237
+ medical question-answering authority.
238
+ - **Not a medical-MCQ model.** As with KOS-V4, do not benchmark or deploy it as one.
239
+
240
+ ## Data contamination
241
+
242
+ - **IFEval: CLEAN (verbatim).** Measured — **0 of IFEval's 541 test prompts** appear verbatim in the 825,504
243
+ training records of the SFT seed. Hits by required exact span collapse **30 (13-gram) → 1 (25) → 0 (40) →
244
+ 0 (exact)**; the 13-gram hits were IFEval's own constraint templates ("your entire response should be in english
245
+ and in all lowercase letters no…"), which every instruction-following corpus contains by construction.
246
+ **Caveat:** exact matching cannot detect paraphrase or reformatting.
247
+ - **MMLU: UNCHECKED.** Contamination against MMLU has **not** been scanned for this checkpoint. The MMLU number
248
+ should be read with that caveat.
249
+
250
+ ## Prompt / chat format (ChatML)
251
+
252
+ ```
253
+ <|im_start|>system
254
+ You are a helpful assistant.<|im_end|>
255
+ <|im_start|>user
256
+ Write a haiku about Kentucky. Do not use any commas.<|im_end|>
257
+ <|im_start|>assistant
258
+ ```
259
+
260
+ ## Quickstart
261
+
262
+ ```python
263
+ from transformers import AutoModelForCausalLM, AutoTokenizer
264
+
265
+ model_id = "Kentucky-Open-Science/KOS-V5-Instruct"
266
+ tok = AutoTokenizer.from_pretrained(model_id)
267
+ model = AutoModelForCausalLM.from_pretrained(model_id, dtype="bfloat16", device_map="auto")
268
+
269
+ messages = [{"role": "user", "content": "Write a haiku about Kentucky. Do not use any commas."}]
270
+ inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
271
+ out = model.generate(inputs, max_new_tokens=256, do_sample=False)
272
+ print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
273
+ ```
274
+
275
+ ## Deployment
276
+
277
+ | Precision | Approx. VRAM | Notes |
278
+ | :--- | :--- | :--- |
279
+ | **bfloat16** | ~9 GB | native weights (7.43 GB) + activations; a single 16 GB GPU is comfortable |
280
+
281
+ ## Related models
282
+
283
+ - [**KOS-V5-Base**](https://huggingface.co/Kentucky-Open-Science/KOS-V5-Base) — the from-scratch pretrained
284
+ foundation this model is tuned from (3.72B, 235.2B tokens).
285
+ - [**KOS-V4-Instruct**](https://huggingface.co/Kentucky-Open-Science/KOS-V4-Instruct) — previous generation
286
+ (3.0B, IFEval 61.6), the public release.
287
+ - [**KOS-V4-Base**](https://huggingface.co/Kentucky-Open-Science/KOS-V4-Base) — previous-generation foundation
288
+ (3.015B, 180.3B tokens).
289
+
290
+ ## Intended use & limitations
291
+
292
+ Research use only. English only. Not for clinical, commercial, legal, or production-grade use. Outputs may be
293
+ factually wrong or fabricated — see **Known regressions** above, particularly the fabrication increase. This model
294
+ must not be used to make or inform medical decisions.
config.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 0,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 0,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 2560,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 9728,
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
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention"
52
+ ],
53
+ "max_position_embeddings": 32768,
54
+ "max_window_layers": 36,
55
+ "model_type": "qwen3",
56
+ "num_attention_heads": 32,
57
+ "num_hidden_layers": 36,
58
+ "num_key_value_heads": 8,
59
+ "pad_token_id": 0,
60
+ "rms_norm_eps": 1e-06,
61
+ "rope_parameters": {
62
+ "rope_theta": 25000.0,
63
+ "rope_type": "default"
64
+ },
65
+ "sliding_window": null,
66
+ "tie_word_embeddings": true,
67
+ "transformers_version": "5.3.0",
68
+ "use_cache": false,
69
+ "use_sliding_window": false,
70
+ "vocab_size": 32000,
71
+ "rope_theta": 25000.0
72
+ }
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": [
4
+ 0
5
+ ],
6
+ "output_attentions": false,
7
+ "output_hidden_states": false,
8
+ "pad_token_id": 0,
9
+ "transformers_version": "5.2.0",
10
+ "use_cache": false
11
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17f688c7f4a529c9c03a556ebfffd564e4dfce235964e18570d457e738e69f4c
3
+ size 7430909696
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": null,
3
+ "eos_token": "<|im_end|>",
4
+ "model_max_length": 32768,
5
+ "pad_token": "<|im_end|>",
6
+ "padding_side": "right",
7
+ "split_special_tokens": false,
8
+ "tokenizer_class": "PreTrainedTokenizerFast",
9
+ "unk_token": "<|im_end|>",
10
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\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>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\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\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if message.content is string %}\n {%- set content = message.content %}\n {%- else %}\n {%- set content = '' %}\n {%- endif %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}"
11
+ }