passing2961 commited on
Commit
4b5e7eb
·
verified ·
1 Parent(s): 64f3c9b

Release Finch-9B: model weights + README + assets

Browse files
.gitattributes CHANGED
@@ -33,3 +33,8 @@ 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_frontiercs.png filter=lfs diff=lfs merge=lfs -text
39
+ assets/results_kto_ttrl.png filter=lfs diff=lfs merge=lfs -text
40
+ assets/results_main.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ base_model:
8
+ - Qwen/Qwen3.5-9B
9
+ datasets:
10
+ - minnesotanlp/Finch-Collection
11
+ tags:
12
+ - evolution-fine-tuning
13
+ - evolutionary-search
14
+ - discovery
15
+ - code-optimization
16
+ - scientific-discovery
17
+ - mutation-operator
18
+ - mid-training
19
+ ---
20
+
21
+ <div align="center">
22
+
23
+ <h2 style="font-weight: bold; font-size: 1.8em; margin-top: 11px;">
24
+ Evolution Fine-Tuning: Learning to Discover Across 371 Optimization Tasks
25
+ </h2>
26
+ <p style="font-size: 1.05em; margin-top: 4px;">
27
+ <em>A mid-training "practice phase" that teaches small open-source LLMs <strong>how to evolve solutions</strong>.</em>
28
+ </p>
29
+
30
+ <p align="center">
31
+ <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>
32
+ <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>
33
+ <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>
34
+ <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>
35
+ <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>
36
+ <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>
37
+ <a href="https://huggingface.co/minnesotanlp/Finch-4B-KTO"><img src="https://img.shields.io/badge/-Finch--4B--KTO-FFD21E?logo=huggingface&logoColor=black" alt="Finch-4B-KTO"/></a>
38
+ <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>
39
+ <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>
40
+ </p>
41
+
42
+ </div>
43
+
44
+ **Finch-9B** is the largest and strongest member of the **Finch** family — open-source LLMs **evolution fine-tuned (EFT)** to act as a stronger **mutation operator** inside evolutionary search. Built on **Qwen3.5-9B** and trained on the [**Finch Collection**](https://huggingface.co/datasets/minnesotanlp/Finch-Collection), it learns *how to evolve a solution* and shows the **largest discovery gains** in the family.
45
+
46
+ ## TL;DR
47
+
48
+ State-of-the-art discovery systems put an LLM inside an evolutionary search *scaffold* — but the discovery know-how lives in the scaffold, and every new task starts from zero. **Evolution Fine-Tuning (EFT)** moves that behavior *into the model* by turning evolutionary search **trajectories** into supervision. EFT pays off most at scale, making Finch-9B the family's top performer across held-out discovery tasks.
49
+
50
+ <div align="center">
51
+ <img src="./assets/intro_teaser.png" alt="EFT as mid-training" width="960"/>
52
+ </div>
53
+
54
+ - (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.
55
+ - (Right) On NP-hard competitive programming, Finch composes strategies learned across diverse domains, while the base model relies on a single repetitive strategy.
56
+
57
+ ## Finch family
58
+
59
+ | Model | Base | Params | Training | 🤗 Hugging Face |
60
+ |---|---|---:|---|:---:|
61
+ | `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) |
62
+ | `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) |
63
+ | `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) |
64
+ | **`Finch-9B`** ← *this model* | **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) |
65
+ | `Finch-4B-KTO` | 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) |
66
+ | `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) |
67
+
68
+ ## How to Use Finch
69
+
70
+ 1. **Execute OpenEvolve scaffold with Finch**
71
+
72
+ 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).
73
+ 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.
74
+
75
+ 2. **Calling Finch directly**
76
+
77
+ You can also call Finch directly:
78
+
79
+ **System prompt** (task-level instruction from the OpenEvolve scaffold):
80
+ ```
81
+ You are an expert mathematician specializing in circle packing problems and computational geometry.
82
+ Your task is to improve a constructor function that directly produces a specific arrangement of
83
+ 26 circles in a unit square, maximizing the sum of their radii.
84
+ The AlphaEvolve paper achieved a sum of 2.635 for n=26.
85
+
86
+ Key geometric insights:
87
+ - Circle packings often follow hexagonal patterns in the densest regions
88
+ - Maximum density for infinite circle packing is pi/(2*sqrt(3)) ≈ 0.9069
89
+ - Edge effects make square container packing harder than infinite packing
90
+ - Similar radius circles often form regular patterns, while varied radii allow better space utilization
91
+ ```
92
+
93
+ **User prompt** (evolutionary state — current program + evaluator feedback + evolutionary history):
94
+ ```
95
+ # Current Program Information
96
+ - Fitness: 0.3642 (sum_radii: 0.9598)
97
+ - Focus areas: Fitness unchanged at 0.3642. Consider simplifying — code length exceeds 500 characters.
98
+
99
+ # Program Evolution History
100
+ ## Previous Attempts
101
+
102
+ ### Attempt 1
103
+ - Changes: Replace concentric ring placement with hexagonal lattice (5-6-5-6-5 row pattern)
104
+ - Metrics: sum_radii: 0.9598, validity: 1.0 — Improvement in all metrics
105
+
106
+ # Current Program
107
+
108
+ # EVOLVE-BLOCK-START
109
+ import numpy as np
110
+
111
+ def construct_packing():
112
+ n = 26
113
+ centers = np.zeros((n, 2))
114
+ centers[0] = [0.5, 0.5] # center circle
115
+ for i in range(8): # inner ring
116
+ angle = 2 * np.pi * i / 8
117
+ centers[i+1] = [0.5 + 0.3*np.cos(angle), 0.5 + 0.3*np.sin(angle)]
118
+ for i in range(16): # outer ring
119
+ angle = 2 * np.pi * i / 16
120
+ centers[i+9] = [0.5 + 0.7*np.cos(angle), 0.5 + 0.7*np.sin(angle)]
121
+ centers = np.clip(centers, 0.01, 0.99)
122
+ radii = compute_max_radii(centers)
123
+ return centers, radii, np.sum(radii)
124
+ # EVOLVE-BLOCK-END
125
+ ```
126
+
127
+ ```python
128
+ import torch
129
+ from transformers import AutoModelForCausalLM, AutoTokenizer
130
+
131
+ model_id = "minnesotanlp/Finch-9B"
132
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
133
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
134
+
135
+ # Given an evolutionary state — task instruction + parent program + evolutionary history
136
+ # + evaluator feedback — Finch proposes an improved candidate program.
137
+ messages = [
138
+ {"role": "system", "content": SYSTEM_PROMPT}, # provided by your evolutionary scaffold
139
+ {"role": "user", "content": USER_PROMPT}, # parent program + feedback + history
140
+ ]
141
+ inputs = tokenizer.apply_chat_template(
142
+ messages, add_generation_prompt=True, return_tensors="pt"
143
+ ).to(model.device)
144
+
145
+ out = model.generate(inputs, max_new_tokens=30000, do_sample=True, temperature=0.7, top_p=0.95)
146
+ print(tokenizer.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
147
+ ```
148
+
149
+ ## Training
150
+
151
+ - **Data.** `improved` transitions from the [Finch Collection](https://huggingface.co/datasets/minnesotanlp/Finch-Collection) across **355 training tasks** (16 of 371 held out). One evolutionary run is kept per task → **30,445** supervised examples; **900** uniformly-sampled examples for validation.
152
+ - **Teacher.** Trajectories generated by **Qwen3.5-397B-A17B** inside the **OpenEvolve** scaffold.
153
+ - **Recipe.** Full SFT with [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) — **1 epoch**, global batch size **128**, learning rate **1e-5**, on **8× NVIDIA H200 140GB** GPUs.
154
+
155
+ ## Results
156
+
157
+ - Finch outperforms its same-size base by up to **+10.24%** across 22 held-out tasks spanning 5 domains, with per-task gains reaching **+290%**. Gains scale with model size — Finch-4B already matches a model roughly twice its size on the Erdős task.
158
+
159
+ <div align="center">
160
+ <img src="./assets/results_main.png" alt="main results" width="900"/>
161
+ </div>
162
+
163
+ - On NP-hard 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**.
164
+
165
+ <div align="center">
166
+ <img src="./assets/results_frontiercs.png" alt="frontiercs results" width="760"/>
167
+ </div>
168
+
169
+ - With preference learning (KTO), Finch-8B surpasses the best human score on both AC1 and AC2, lifting its competitive-programming average from **24.56 → 37.30**. Paired with the *nanodiscover* learning scaffold, it also matches SOTA on two circle-packing tasks and improves Erdős by **+3.2%**.
170
+
171
+ <div align="center">
172
+ <img src="./assets/results_kto_ttrl.png" alt="frontiercs results" width="760"/>
173
+ </div>
174
+
175
+ ## Limitations
176
+
177
+ - Trajectories are collected and evaluated only with **OpenEvolve**; behavior under different scaffolds is not guaranteed.
178
+ - Finch-9B inherits the capabilities and biases of **Qwen3.5-9B**.
179
+
180
+ ## License
181
+
182
+ 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).
183
+
184
+ ## Acknowledgements
185
+
186
+ 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.
187
+
188
+ ## Citation
189
+
190
+ ```bibtex
191
+ @misc{lee2026evolutionfinetuning,
192
+ title = {Evolution Fine-Tuning: Learning to Discover Across 371 Optimization Tasks},
193
+ 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},
194
+ year = {2026},
195
+ note = {Preprint},
196
+ url = {https://open-galapagos.github.io/evolution_finetuning/},
197
+ }
198
+ ```
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_frontiercs.png ADDED

Git LFS Details

  • SHA256: 224db4ce303e254c09b56a2a6c7af7e5ba9cdae5e65774922c1f7499c42eade6
  • Pointer size: 131 Bytes
  • Size of remote file: 116 kB
assets/results_kto_ttrl.png ADDED

Git LFS Details

  • SHA256: b5da7421d1350a0fd86fcb649a9f000bf5420259d316c5a1898673db951295f8
  • Pointer size: 131 Bytes
  • Size of remote file: 153 kB
assets/results_main.png ADDED

Git LFS Details

  • SHA256: c12a7f1274589887c3bd34811753edf14fc42572f54fd2db2336e2488c249873
  • Pointer size: 131 Bytes
  • Size of remote file: 332 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": 4096,
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": 4096,
22
+ "initializer_range": 0.02,
23
+ "intermediate_size": 12288,
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": false,
87
+ "use_cache": false,
88
+ "vocab_size": 248320
89
+ },
90
+ "tie_word_embeddings": false,
91
+ "transformers_version": "5.2.0",
92
+ "use_cache": false,
93
+ "video_token_id": 248057,
94
+ "vision_config": {
95
+ "deepstack_visual_indexes": [],
96
+ "depth": 27,
97
+ "dtype": "bfloat16",
98
+ "hidden_act": "gelu_pytorch_tanh",
99
+ "hidden_size": 1152,
100
+ "in_channels": 3,
101
+ "initializer_range": 0.02,
102
+ "intermediate_size": 4304,
103
+ "model_type": "qwen3_5",
104
+ "num_heads": 16,
105
+ "num_position_embeddings": 2304,
106
+ "out_hidden_size": 4096,
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:6cc8d0aa476548b0c979c4d419be7aca5b878145a75f6e220368e435a115b704
3
+ size 18819722392
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": true,
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
+ }