passing2961 commited on
Commit
6328911
·
verified ·
1 Parent(s): 722209b

Release Finch-4B-KTO: model weights + README + assets

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ 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
37
+ assets/intro_teaser.png filter=lfs diff=lfs merge=lfs -text
38
+ assets/results_kto.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ base_model:
8
+ - minnesotanlp/Finch-4B
9
+ datasets:
10
+ - minnesotanlp/Finch-Collection
11
+ tags:
12
+ - evolution-fine-tuning
13
+ - evolutionary-search
14
+ - discovery
15
+ - preference-learning
16
+ - kto
17
+ - mutation-operator
18
+ - mid-training
19
+ ---
20
+
21
+ <div align="center">
22
+
23
+
24
+ <h2 style="font-weight: bold; font-size: 1.8em; margin-top: 11px;">
25
+ Evolution Fine-Tuning: Learning to Discover Across 371 Optimization Tasks
26
+ </h2>
27
+ <p style="font-size: 1.05em; margin-top: 4px;">
28
+ <em>A mid-training "practice phase" that teaches small open-source LLMs <strong>how to evolve solutions</strong>.</em>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="https://open-galapagos.github.io/evolution_finetuning/"><img src="https://img.shields.io/badge/Website-Project%20Page-1E90FF.svg?logo=googlechrome&logoColor=white" alt="Website"/></a>
33
+ <a href="https://github.com/Open-Galapagos/evolution_finetuning"><img src="https://img.shields.io/badge/GitHub-Code-181717.svg?logo=github" alt="GitHub"/></a>
34
+ <a href="https://huggingface.co/datasets/minnesotanlp/Finch-Collection"><img src="https://img.shields.io/badge/HuggingFace-Dataset-FFD21E.svg?logo=huggingface" alt="Dataset"/></a>
35
+ <a href="https://huggingface.co/minnesotanlp/Finch-2B"><img src="https://img.shields.io/badge/-Finch--2B-FFD21E?logo=huggingface&logoColor=black" alt="Finch-2B"/></a>
36
+ <a href="https://huggingface.co/minnesotanlp/Finch-4B"><img src="https://img.shields.io/badge/-Finch--4B-FFD21E?logo=huggingface&logoColor=black" alt="Finch-4B"/></a>
37
+ <a href="https://huggingface.co/minnesotanlp/Finch-8B"><img src="https://img.shields.io/badge/-Finch--8B-FFD21E?logo=huggingface&logoColor=black" alt="Finch-8B"/></a>
38
+ <a href="https://huggingface.co/minnesotanlp/Finch-9B"><img src="https://img.shields.io/badge/-Finch--9B-FFD21E?logo=huggingface&logoColor=black" alt="Finch-9B"/></a>
39
+ <a href="https://huggingface.co/minnesotanlp/Finch-8B-KTO"><img src="https://img.shields.io/badge/-Finch--8B--KTO-FFD21E?logo=huggingface&logoColor=black" alt="Finch-8B-KTO"/></a>
40
+ <a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="Apache 2.0"/></a>
41
+ </p>
42
+
43
+ </div>
44
+
45
+ **Finch-4B-KTO** extends [**`Finch-4B`**](https://huggingface.co/minnesotanlp/Finch-4B) with a second, preference-learning stage ([**KTO**](https://arxiv.org/abs/2402.01306)). On top of evolution fine-tuning — which teaches the model *how to evolve a solution* as a **mutation operator** — KTO adds the ability to **self-judge** which candidate solutions are promising and which fall short, further sharpening cross-task discovery. Lineage: **Qwen3.5-4B → Finch-4B (EFT + SFT) → Finch-4B-KTO**.
46
+
47
+ ## TL;DR
48
+
49
+ Evolution Fine-Tuning (EFT) turns evolutionary search **trajectories** into supervision, moving discovery behavior from the *scaffold* into the *model*. **KTO** then trains the model on `improved` vs. `regressed` transitions jointly, so it internalizes a sense of solution quality — improving every measured discovery metric over Finch-4B.
50
+
51
+ <div align="center">
52
+ <img src="./assets/intro_teaser.png" alt="EFT as mid-training" width="960"/>
53
+ </div>
54
+
55
+ - (Left) EFT acts as mid-training, boosting Finch's discovery on the Erdős minimum-overlap problem under both test-time search and test-time learning.
56
+ - (Right) On NP-hard competitive programming, Finch composes strategies learned across diverse domains, while the base model relies on a single repetitive strategy.
57
+
58
+ ## Finch family
59
+
60
+ | Model | Base | Params | Training | 🤗 Hugging Face |
61
+ |---|---|---:|---|:---:|
62
+ | `Finch-2B` | Qwen3.5-2B | 2B | EFT | [![Open on Hugging Face](https://img.shields.io/badge/-Open-FFD21E?logo=huggingface&logoColor=black)](https://huggingface.co/minnesotanlp/Finch-2B) |
63
+ | `Finch-4B` | Qwen3.5-4B | 4B | EFT | [![Open on Hugging Face](https://img.shields.io/badge/-Open-FFD21E?logo=huggingface&logoColor=black)](https://huggingface.co/minnesotanlp/Finch-4B) |
64
+ | `Finch-8B` | Qwen3-8B | 8B | EFT | [![Open on Hugging Face](https://img.shields.io/badge/-Open-FFD21E?logo=huggingface&logoColor=black)](https://huggingface.co/minnesotanlp/Finch-8B) |
65
+ | `Finch-9B` | Qwen3.5-9B | 9B | EFT | [![Open on Hugging Face](https://img.shields.io/badge/-Open-FFD21E?logo=huggingface&logoColor=black)](https://huggingface.co/minnesotanlp/Finch-9B) |
66
+ | **`Finch-4B-KTO`** ← *this model* | **Qwen3.5-4B** | **4B** | **EFT + KTO** | [![Open on Hugging Face](https://img.shields.io/badge/-Open-FFD21E?logo=huggingface&logoColor=black)](https://huggingface.co/minnesotanlp/Finch-4B-KTO) |
67
+ | `Finch-8B-KTO` | Qwen3-8B | 8B | EFT + KTO | [![Open on Hugging Face](https://img.shields.io/badge/-Open-FFD21E?logo=huggingface&logoColor=black)](https://huggingface.co/minnesotanlp/Finch-8B-KTO) |
68
+
69
+ ## How to Use Finch
70
+
71
+ 1. **Execute OpenEvolve scaffold with Finch**
72
+
73
+ Finch is a **mutation operator for evolutionary search**, most effective driven by a scaffold such as **OpenEvolve** (`T = 100`, temperature `0.7`, top-`p` `0.95`, up to `30K` tokens).
74
+ You can also use other scaffolds in the [SkyDiscover](https://github.com/skydiscover-ai/skydiscover) framework, but we do not guarantee performance, as our model is trained on OpenEvolve's trajectories — one of this work's limitations.
75
+
76
+ 2. **Calling Finch directly**
77
+
78
+ You can also call Finch directly:
79
+
80
+ **System prompt** (task-level instruction from the OpenEvolve scaffold):
81
+ ```
82
+ You are an expert mathematician specializing in circle packing problems and computational geometry.
83
+ Your task is to improve a constructor function that directly produces a specific arrangement of
84
+ 26 circles in a unit square, maximizing the sum of their radii.
85
+ The AlphaEvolve paper achieved a sum of 2.635 for n=26.
86
+
87
+ Key geometric insights:
88
+ - Circle packings often follow hexagonal patterns in the densest regions
89
+ - Maximum density for infinite circle packing is pi/(2*sqrt(3)) ≈ 0.9069
90
+ - Edge effects make square container packing harder than infinite packing
91
+ - Similar radius circles often form regular patterns, while varied radii allow better space utilization
92
+ ```
93
+
94
+ **User prompt** (evolutionary state — current program + evaluator feedback + evolutionary history):
95
+ ```
96
+ # Current Program Information
97
+ - Fitness: 0.3642 (sum_radii: 0.9598)
98
+ - Focus areas: Fitness unchanged at 0.3642. Consider simplifying — code length exceeds 500 characters.
99
+
100
+ # Program Evolution History
101
+ ## Previous Attempts
102
+
103
+ ### Attempt 1
104
+ - Changes: Replace concentric ring placement with hexagonal lattice (5-6-5-6-5 row pattern)
105
+ - Metrics: sum_radii: 0.9598, validity: 1.0 — Improvement in all metrics
106
+
107
+ # Current Program
108
+
109
+ # EVOLVE-BLOCK-START
110
+ import numpy as np
111
+
112
+ def construct_packing():
113
+ n = 26
114
+ centers = np.zeros((n, 2))
115
+ centers[0] = [0.5, 0.5] # center circle
116
+ for i in range(8): # inner ring
117
+ angle = 2 * np.pi * i / 8
118
+ centers[i+1] = [0.5 + 0.3*np.cos(angle), 0.5 + 0.3*np.sin(angle)]
119
+ for i in range(16): # outer ring
120
+ angle = 2 * np.pi * i / 16
121
+ centers[i+9] = [0.5 + 0.7*np.cos(angle), 0.5 + 0.7*np.sin(angle)]
122
+ centers = np.clip(centers, 0.01, 0.99)
123
+ radii = compute_max_radii(centers)
124
+ return centers, radii, np.sum(radii)
125
+ # EVOLVE-BLOCK-END
126
+ ```
127
+
128
+ ```python
129
+ import torch
130
+ from transformers import AutoModelForCausalLM, AutoTokenizer
131
+
132
+ model_id = "minnesotanlp/Finch-4B-KTO"
133
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
134
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
135
+
136
+ # Given an evolutionary state — task instruction + parent program + evolutionary history
137
+ # + evaluator feedback — Finch proposes an improved candidate program.
138
+ messages = [
139
+ {"role": "system", "content": SYSTEM_PROMPT}, # provided by your evolutionary scaffold
140
+ {"role": "user", "content": USER_PROMPT}, # parent program + feedback + history
141
+ ]
142
+ inputs = tokenizer.apply_chat_template(
143
+ messages, add_generation_prompt=True, return_tensors="pt"
144
+ ).to(model.device)
145
+
146
+ out = model.generate(inputs, max_new_tokens=30000, do_sample=True, temperature=0.7, top_p=0.95)
147
+ print(tokenizer.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
148
+ ```
149
+
150
+ ## Training
151
+
152
+ Two stages:
153
+
154
+ - **Stage 1 — EFT (SFT).** [`Finch-4B`](https://huggingface.co/minnesotanlp/Finch-4B): full SFT of **Qwen3.5-4B** on `improved` transitions from the [Finch Collection](https://huggingface.co/datasets/minnesotanlp/Finch-Collection) (355 training tasks; one run/task → **30,445** examples; 900 for validation) with [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) — 1 epoch, global batch size 128, LR 1e-5, on 8× NVIDIA H200 140GB.
155
+ - **Stage 2 — KTO.** Preference learning ([KTO](https://arxiv.org/abs/2402.01306)) on `improved` (desirable) and `regressed` (undesirable) transitions jointly, maximizing the contrastive signal that guides the model toward self-judging which solutions are promising and which fall short.
156
+ - **Teacher (data).** Trajectories generated by **Qwen3.5-397B-A17B** inside the **OpenEvolve** scaffold.
157
+
158
+ ## Results
159
+
160
+ - Finch outperforms its same-size base model by +10.2% on 22 held-out tasks across 5 domains, with improvements of up to +290% on individual tasks.
161
+ - Larger models benefit more, and Finch-4B matches a model roughly 2× larger on the Erdős task.
162
+
163
+
164
+ <div align="center">
165
+ <img src="./assets/results_main.png" alt="main results" width="900"/>
166
+ </div>
167
+
168
+ - On competitive programming (FrontierCS), Finch-9B averages 46.01 vs base Qwen3.5-9B's 32.46; on CALICO's P263 (UC Berkeley's official open-ended contest) it scores 86.10 vs 55.09
169
+
170
+
171
+ <div align="center">
172
+ <img src="./assets/results_frontiercs.png" alt="frontiercs results" width="760"/>
173
+ </div>
174
+
175
+ - With preference learning (KTO), Finch-8B surpasses the best human score on AC1 and AC2, while its competitive programming score improves from 24.56 → 37.30.
176
+ - Finch-8B matches SOTA on two circle-packing tasks and improves the Erdős task by +3.2%.
177
+
178
+ <div align="center">
179
+ <img src="./assets/results_kto_ttrl.png" alt="frontiercs results" width="760"/>
180
+ </div>
181
+
182
+ ## Limitations
183
+
184
+ Trajectories are collected and evaluated only with **OpenEvolve**; behavior under different scaffolds is not guaranteed.
185
+
186
+ ## License
187
+
188
+ The **Finch Collection** is released under the [**CC-BY 4.0 License**](https://creativecommons.org/licenses/by/4.0/) and is recommended for **non-commercial academic research**. The accompanying **code** and **Finch model weights** are released under the [**Apache 2.0 License**](https://www.apache.org/licenses/LICENSE-2.0).
189
+
190
+ ## Acknowledgements
191
+
192
+ This research was supported by the "Advanced GPU Utilization Support Program" funded by the Government of the Republic of Korea (Ministry of Science and ICT). We are grateful to the SkyDiscover team for their valuable feedback on the dataset construction process, the use of the SkyDiscover framework, and the overall direction of this research — in particular, [Shu Liu](https://shulynnliu.com/), [Shubham Agarwal](https://skejriwal44.github.io/), and [Mert Cemri](https://people.eecs.berkeley.edu/~mert_cemri/) for their insightful comments and discussions. We also thank the OpenEvolve team, especially Ritik Vijayvergiya and [Asankhaya Sharma](https://asankhaya.github.io/), for their guidance on using the OpenEvolve framework and for their thoughtful comments on this work. We further thank the authors of ALE-Bench, especially [Yuki Imajuku](https://imajuku.tech/), and the AtCoder team for authorizing the public release of the evolutionary search trajectories derived from their CC BY-ND 4.0-licensed dataset. Finally, we thank [Byung-Kwan Lee](https://byungkwanlee.github.io/ByungKwanLee-CV/) for valuable feedback during the early stages of this project.
193
+
194
+ ## Citation
195
+
196
+ ```bibtex
197
+ @misc{lee2026evolutionfinetuning,
198
+ title = {Evolution Fine-Tuning: Learning to Discover Across 371 Optimization Tasks},
199
+ author = {Young-Jun Lee and Seungone Kim and Minki Kang and Alistair Cheong and Zerui Chen and Seungho Han and Taehee Jung and Dongyeop Kang},
200
+ year = {2026},
201
+ note = {Preprint},
202
+ url = {https://open-galapagos.github.io/evolution_finetuning/},
203
+ }
204
+ ```
assets/finch_icon.png ADDED
assets/intro_teaser.png ADDED

Git LFS Details

  • SHA256: 50e825db841e72ac37560145a523697a4b009e320df28193f23bb467f9e8a85d
  • Pointer size: 131 Bytes
  • Size of remote file: 436 kB
assets/results_kto.png ADDED

Git LFS Details

  • SHA256: b5da7421d1350a0fd86fcb649a9f000bf5420259d316c5a1898673db951295f8
  • Pointer size: 131 Bytes
  • Size of remote file: 153 kB
chat_template.jinja ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- if tools and tools is iterable and tools is not mapping %}
46
+ {{- '<|im_start|>system\n' }}
47
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
48
+ {%- for tool in tools %}
49
+ {{- "\n" }}
50
+ {{- tool | tojson }}
51
+ {%- endfor %}
52
+ {{- "\n</tools>" }}
53
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
+ {%- if messages[0].role == 'system' %}
55
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
56
+ {%- if content %}
57
+ {{- '\n\n' + content }}
58
+ {%- endif %}
59
+ {%- endif %}
60
+ {{- '<|im_end|>\n' }}
61
+ {%- else %}
62
+ {%- if messages[0].role == 'system' %}
63
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
64
+ {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
+ {%- endif %}
66
+ {%- endif %}
67
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
68
+ {%- for message in messages[::-1] %}
69
+ {%- set index = (messages|length - 1) - loop.index0 %}
70
+ {%- if ns.multi_step_tool and message.role == "user" %}
71
+ {%- set content = render_content(message.content, false)|trim %}
72
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
73
+ {%- set ns.multi_step_tool = false %}
74
+ {%- set ns.last_query_index = index %}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- endfor %}
78
+ {%- if ns.multi_step_tool %}
79
+ {{- raise_exception('No user query found in messages.') }}
80
+ {%- endif %}
81
+ {%- for message in messages %}
82
+ {%- set content = render_content(message.content, true)|trim %}
83
+ {%- if message.role == "system" %}
84
+ {%- if not loop.first %}
85
+ {{- raise_exception('System message must be at the beginning.') }}
86
+ {%- endif %}
87
+ {%- elif message.role == "user" %}
88
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
+ {%- elif message.role == "assistant" %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if message.reasoning_content is string %}
92
+ {%- set reasoning_content = message.reasoning_content %}
93
+ {%- else %}
94
+ {%- if '</think>' in content %}
95
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
96
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
97
+ {%- endif %}
98
+ {%- endif %}
99
+ {%- set reasoning_content = reasoning_content|trim %}
100
+ {%- if loop.index0 > ns.last_query_index %}
101
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
102
+ {%- else %}
103
+ {{- '<|im_start|>' + message.role + '\n' + content }}
104
+ {%- endif %}
105
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
106
+ {%- for tool_call in message.tool_calls %}
107
+ {%- if tool_call.function is defined %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {%- if loop.first %}
111
+ {%- if content|trim %}
112
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
113
+ {%- else %}
114
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
115
+ {%- endif %}
116
+ {%- else %}
117
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
+ {%- endif %}
119
+ {%- if tool_call.arguments is defined %}
120
+ {%- for args_name, args_value in tool_call.arguments|items %}
121
+ {{- '<parameter=' + args_name + '>\n' }}
122
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
123
+ {{- args_value }}
124
+ {{- '\n</parameter>\n' }}
125
+ {%- endfor %}
126
+ {%- endif %}
127
+ {{- '</function>\n</tool_call>' }}
128
+ {%- endfor %}
129
+ {%- endif %}
130
+ {{- '<|im_end|>\n' }}
131
+ {%- elif message.role == "tool" %}
132
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
133
+ {{- '<|im_start|>user' }}
134
+ {%- endif %}
135
+ {{- '\n<tool_response>\n' }}
136
+ {{- content }}
137
+ {{- '\n</tool_response>' }}
138
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
139
+ {{- '<|im_end|>\n' }}
140
+ {%- elif loop.last %}
141
+ {{- '<|im_end|>\n' }}
142
+ {%- endif %}
143
+ {%- else %}
144
+ {{- raise_exception('Unexpected message role.') }}
145
+ {%- endif %}
146
+ {%- endfor %}
147
+ {%- if add_generation_prompt %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- if enable_thinking is defined and enable_thinking is false %}
150
+ {{- '<think>\n\n</think>\n\n' }}
151
+ {%- else %}
152
+ {{- '<think>\n' }}
153
+ {%- endif %}
154
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5ForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "eos_token_id": 248046,
7
+ "hidden_size": 2560,
8
+ "image_token_id": 248056,
9
+ "model_type": "qwen3_5",
10
+ "pad_token_id": 248044,
11
+ "text_config": {
12
+ "attention_bias": false,
13
+ "attention_dropout": 0.0,
14
+ "attn_output_gate": true,
15
+ "bos_token_id": null,
16
+ "dtype": "bfloat16",
17
+ "eos_token_id": 248044,
18
+ "full_attention_interval": 4,
19
+ "head_dim": 256,
20
+ "hidden_act": "silu",
21
+ "hidden_size": 2560,
22
+ "initializer_range": 0.02,
23
+ "intermediate_size": 9216,
24
+ "layer_types": [
25
+ "linear_attention",
26
+ "linear_attention",
27
+ "linear_attention",
28
+ "full_attention",
29
+ "linear_attention",
30
+ "linear_attention",
31
+ "linear_attention",
32
+ "full_attention",
33
+ "linear_attention",
34
+ "linear_attention",
35
+ "linear_attention",
36
+ "full_attention",
37
+ "linear_attention",
38
+ "linear_attention",
39
+ "linear_attention",
40
+ "full_attention",
41
+ "linear_attention",
42
+ "linear_attention",
43
+ "linear_attention",
44
+ "full_attention",
45
+ "linear_attention",
46
+ "linear_attention",
47
+ "linear_attention",
48
+ "full_attention",
49
+ "linear_attention",
50
+ "linear_attention",
51
+ "linear_attention",
52
+ "full_attention",
53
+ "linear_attention",
54
+ "linear_attention",
55
+ "linear_attention",
56
+ "full_attention"
57
+ ],
58
+ "linear_conv_kernel_dim": 4,
59
+ "linear_key_head_dim": 128,
60
+ "linear_num_key_heads": 16,
61
+ "linear_num_value_heads": 32,
62
+ "linear_value_head_dim": 128,
63
+ "mamba_ssm_dtype": "float32",
64
+ "max_position_embeddings": 262144,
65
+ "mlp_only_layers": [],
66
+ "model_type": "qwen3_5_text",
67
+ "mtp_num_hidden_layers": 1,
68
+ "mtp_use_dedicated_embeddings": false,
69
+ "num_attention_heads": 16,
70
+ "num_hidden_layers": 32,
71
+ "num_key_value_heads": 4,
72
+ "pad_token_id": null,
73
+ "partial_rotary_factor": 0.25,
74
+ "rms_norm_eps": 1e-06,
75
+ "rope_parameters": {
76
+ "mrope_interleaved": true,
77
+ "mrope_section": [
78
+ 11,
79
+ 11,
80
+ 10
81
+ ],
82
+ "partial_rotary_factor": 0.25,
83
+ "rope_theta": 10000000,
84
+ "rope_type": "default"
85
+ },
86
+ "tie_word_embeddings": true,
87
+ "use_cache": false,
88
+ "vocab_size": 248320
89
+ },
90
+ "tie_word_embeddings": true,
91
+ "transformers_version": "5.2.0",
92
+ "use_cache": false,
93
+ "video_token_id": 248057,
94
+ "vision_config": {
95
+ "deepstack_visual_indexes": [],
96
+ "depth": 24,
97
+ "dtype": "bfloat16",
98
+ "hidden_act": "gelu_pytorch_tanh",
99
+ "hidden_size": 1024,
100
+ "in_channels": 3,
101
+ "initializer_range": 0.02,
102
+ "intermediate_size": 4096,
103
+ "model_type": "qwen3_5",
104
+ "num_heads": 16,
105
+ "num_position_embeddings": 2304,
106
+ "out_hidden_size": 2560,
107
+ "patch_size": 16,
108
+ "spatial_merge_size": 2,
109
+ "temporal_patch_size": 2
110
+ },
111
+ "vision_end_token_id": 248054,
112
+ "vision_start_token_id": 248053
113
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "eos_token_id": [
4
+ 248046,
5
+ 248044
6
+ ],
7
+ "pad_token_id": 248044,
8
+ "transformers_version": "5.2.0",
9
+ "use_cache": true
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc4ef99daf78da81982347168ff7de42ec7505945cb3aec2ed7f72f7821e8340
3
+ size 10350019328
processor_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "data_format": "channels_first",
4
+ "do_convert_rgb": true,
5
+ "do_normalize": true,
6
+ "do_rescale": true,
7
+ "do_resize": true,
8
+ "image_mean": [
9
+ 0.5,
10
+ 0.5,
11
+ 0.5
12
+ ],
13
+ "image_processor_type": "Qwen2VLImageProcessorFast",
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "merge_size": 2,
20
+ "patch_size": 16,
21
+ "resample": 3,
22
+ "rescale_factor": 0.00392156862745098,
23
+ "size": {
24
+ "longest_edge": 16777216,
25
+ "shortest_edge": 65536
26
+ },
27
+ "temporal_patch_size": 2
28
+ },
29
+ "processor_class": "Qwen3VLProcessor",
30
+ "video_processor": {
31
+ "data_format": "channels_first",
32
+ "default_to_square": true,
33
+ "do_convert_rgb": true,
34
+ "do_normalize": true,
35
+ "do_rescale": true,
36
+ "do_resize": true,
37
+ "do_sample_frames": true,
38
+ "fps": 2,
39
+ "image_mean": [
40
+ 0.5,
41
+ 0.5,
42
+ 0.5
43
+ ],
44
+ "image_std": [
45
+ 0.5,
46
+ 0.5,
47
+ 0.5
48
+ ],
49
+ "max_frames": 768,
50
+ "merge_size": 2,
51
+ "min_frames": 4,
52
+ "patch_size": 16,
53
+ "resample": 3,
54
+ "rescale_factor": 0.00392156862745098,
55
+ "return_metadata": false,
56
+ "size": {
57
+ "longest_edge": 25165824,
58
+ "shortest_edge": 4096
59
+ },
60
+ "temporal_patch_size": 2,
61
+ "video_processor_type": "Qwen3VLVideoProcessor"
62
+ }
63
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87a7830d63fcf43bf241c3c5242e96e62dd3fdc29224ca26fed8ea333db72de4
3
+ size 19989343
tokenizer_config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "audio_bos_token": "<|audio_start|>",
4
+ "audio_eos_token": "<|audio_end|>",
5
+ "audio_token": "<|audio_pad|>",
6
+ "backend": "tokenizers",
7
+ "bos_token": null,
8
+ "clean_up_tokenization_spaces": false,
9
+ "eos_token": "<|im_end|>",
10
+ "errors": "replace",
11
+ "image_token": "<|image_pad|>",
12
+ "is_local": false,
13
+ "model_max_length": 262144,
14
+ "model_specific_special_tokens": {
15
+ "audio_bos_token": "<|audio_start|>",
16
+ "audio_eos_token": "<|audio_end|>",
17
+ "audio_token": "<|audio_pad|>",
18
+ "image_token": "<|image_pad|>",
19
+ "video_token": "<|video_pad|>",
20
+ "vision_bos_token": "<|vision_start|>",
21
+ "vision_eos_token": "<|vision_end|>"
22
+ },
23
+ "pad_token": "<|endoftext|>",
24
+ "padding_side": "right",
25
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
+ "processor_class": "Qwen3VLProcessor",
27
+ "split_special_tokens": false,
28
+ "tokenizer_class": "TokenizersBackend",
29
+ "unk_token": null,
30
+ "video_token": "<|video_pad|>",
31
+ "vision_bos_token": "<|vision_start|>",
32
+ "vision_eos_token": "<|vision_end|>"
33
+ }