Montalte commited on
Commit
f82d492
·
verified ·
1 Parent(s): a704edb

Upload qwen4b taskvector merge

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
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2024 Alibaba Cloud
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
MANIFEST.sha256 ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 832dd9e00a68dd83b3c3fb9f5588dad7dcf337a0db50f7d9483f310cd292e92e LICENSE
2
+ 5e66b33663c05d41fe3758efd5dde9aaa83e587e032e6f4d458a6fc74bc881f9 OFFICIAL_MERGE_RECEIPT.json
3
+ 1592a771cd3fe8b9e6a976c36a2f8edbcd8c373b4ff5645c69911f0944802f33 README.md
4
+ 490367bf1e2bd55f5a7381dc4083bcffc18430bcbc26457680c5c17268225bcc adapter/MANIFEST.json
5
+ 16a5f02dafeca4c7804f7306e353375ac567d8158ed37baa20b80dcfe9188f33 adapter/TOKEN_ROWS_META.json
6
+ 4e04ab4bb3a660f837b6f57d3964cebfdf5b5a58cebc0c5cd9a30372a396212c adapter/adapter_config.json
7
+ 619dcee8c5c04416fed0cee928375583332ce2986bf3f51c0caf8408433831ed adapter/adapter_model.safetensors
8
+ 407274bf3280d79ed8efabaf3c3b3e75debaeb6b8efdb4433ac0bae934144688 adapter/token_rows_both_sides.safetensors
9
+ 87a2728cb8dc9fe424d624542f6060ec05a1d285ebbec578bb078900e33396b5 chat_template.jinja
10
+ 40bcf4e0a6a7b5eb8aa582ee23f0c9700d76f147d17159419893bbad0f762176 config.json
11
+ a2ac0d07aac37502207a212b122abe32bd9564266594a317c0ff490ebce1f226 generation_config.json
12
+ 0e43b8415e406761c7ab73c8225fde51abdb7f51a4b80a9e90c616f53c3ea419 model.safetensors
13
+ 5ebf618c3d547252a8078665415fa4fb3b080d071c7e0f2750f6af44e231bc3e provenance/DEV256_COMPLETE.json
14
+ 24fc75c1ce08f0e4b7dcc31684c36c1f95b7032999c0e40308426781728f939c provenance/MQ0_NEAR_DUP.json
15
+ c9f6e3b33a4693354da05fd6f18b3d05932430ca7c8dc9f7f008d3dcc49ac592 provenance/POLICY.json
16
+ 5c45fca93b73d0293c39913fc74160cc24f3ed5efa4bfd51582428cc029e1cd2 provenance/RUN_IDENTITY.json
17
+ 0304abe092d416ca7974b8f98f39783c52e71467bea8382ed000315ed917ec8a provenance/TRAINING_CONFIG.json
18
+ 2ff0f61e200d18dd55b1301f9573e923abd6fe87608220f7126cf709d4cb7288 provenance/build_mix_distill_payload.py
19
+ be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506 tokenizer.json
20
+ 1749ac66e3e7ce3862337c23cca5895a2ee131929563e18a944f8c1c80363712 tokenizer_config.json
OFFICIAL_MERGE_RECEIPT.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"adapter_tree_sha256":"467d7c210b6001b8a1c638cce88ebb5112fa2f7d1684000f712b4ccafa814b29","base_model_path":"/workspace/code-sft-infra/models/qwen3-4b-base","checkpoint_manifest_sha256":"490367bf1e2bd55f5a7381dc4083bcffc18430bcbc26457680c5c17268225bcc","checkpoint_path":"/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/out/Q4B-THINK-MIX/906bfd4b4dc7f14ee4320094d8b41684abff8539/qwen3-8b-think-lcb-system-v2/fc22e609554e898f2ae570f75bce208ae3428aada9931dc43bc7da3735f95885/step-000920-tokens-64848450","label":"v4-q4b-think-mix","merge_backend":"merge_for_eval","merged_at_unix":1788962266.3138773,"merged_model_path":"/workspace/code-sft-runs/rstar-eval/official-dev256/v4-q4b-think-mix/scratch/step-000920-tokens-64848450-merged-full","merged_tree_sha256":"4d14b1af017f7e5f113017a3a2e1a29942463afde5eca0d4f4f9faa0c17194ae","receipt_sha256":"defb397b004f96a114242399a45d919ecdc2c88fc3fde9e409e425bac453af12","schema":"CODE_SFT_OFFICIAL_DEV256_MERGE_RECEIPT_V1","token_rows_meta_path":"/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/out/Q4B-THINK-MIX/906bfd4b4dc7f14ee4320094d8b41684abff8539/qwen3-8b-think-lcb-system-v2/fc22e609554e898f2ae570f75bce208ae3428aada9931dc43bc7da3735f95885/step-000920-tokens-64848450/TOKEN_ROWS_META.json","token_rows_meta_worker":"rstar_dual_worker_v4","untied_export":{"lm_head_weight_shard":"model.safetensors","tie_word_embeddings":false}}
README.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ base_model: Qwen/Qwen3-4B-Base
5
+ tags:
6
+ - qwen3
7
+ - merge
8
+ - taskvector
9
+ - code
10
+ - think
11
+ ---
12
+
13
+ # Montalte/qwen4b-code-think-taskvector
14
+
15
+ Unified Qwen3-4B merge artifact for directional math↔code transfer experiments.
16
+
17
+ | Field | Value |
18
+ |-------|-------|
19
+ | Base | `Qwen/Qwen3-4B-Base@906bfd4b4dc7f14ee4320094d8b41684abff8539` |
20
+ | Source specialist | `modrill/code-think-q4b-20260908` |
21
+ | Domain | code |
22
+ | Mode | think |
23
+ | Method | **taskvector** |
24
+
25
+ ## Method
26
+
27
+ **taskvector** = dense source specialist \(\theta_s\) (full SFT weights; equivalent to applying the complete task vector \(\tau_s=\theta_s-\theta_0\)).
28
+
29
+ Uploaded: 2026-09-11.
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,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": 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": null,
60
+ "rms_norm_eps": 1e-06,
61
+ "rope_parameters": {
62
+ "rope_theta": 1000000,
63
+ "rope_type": "default"
64
+ },
65
+ "sliding_window": null,
66
+ "tie_word_embeddings": false,
67
+ "transformers_version": "5.16.1",
68
+ "use_cache": true,
69
+ "use_sliding_window": false,
70
+ "vocab_size": 151936
71
+ }
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.16.1"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e43b8415e406761c7ab73c8225fde51abdb7f51a4b80a9e90c616f53c3ea419
3
+ size 8822894520
provenance/DEV256_COMPLETE.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"adapter":{"adapter_identity":"MERGED_FULL_WEIGHTS_NO_LORA","adapter_path":"/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/out/Q4B-THINK-MIX/906bfd4b4dc7f14ee4320094d8b41684abff8539/qwen3-8b-think-lcb-system-v2/fc22e609554e898f2ae570f75bce208ae3428aada9931dc43bc7da3735f95885/step-000920-tokens-64848450/adapter","adapter_tree_sha256":"467d7c210b6001b8a1c638cce88ebb5112fa2f7d1684000f712b4ccafa814b29","checkpoint":"/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/out/Q4B-THINK-MIX/906bfd4b4dc7f14ee4320094d8b41684abff8539/qwen3-8b-think-lcb-system-v2/fc22e609554e898f2ae570f75bce208ae3428aada9931dc43bc7da3735f95885/step-000920-tokens-64848450","checkpoint_manifest_sha256":"490367bf1e2bd55f5a7381dc4083bcffc18430bcbc26457680c5c17268225bcc","merged_path":"/workspace/code-sft-runs/rstar-eval/official-dev256/v4-q4b-think-mix/scratch/step-000920-tokens-64848450-merged-full"},"arm":"official-v4-q4b-think-mix","base":false,"benchmark_contract":{"date_filter":null,"native_index":{"bytes":2546647101,"immutable_object_uri":"r2mtx:mxx/isolated-backups/full-workspace/20260826T031752Z-8bcbe83efc6607702f6b681b4429d72dc6c1a4c570f18c85e8c7cee5743c682a/objects/sha256/ea/ea66e0d8814490a7e0d7ff555297e43a7d9662405c16609f9df51b42ec1b1cc1","path":"/workspace/code-sft-runs/rstar-eval/contracts/dev256/native_index.jsonl","sha256":"ea66e0d8814490a7e0d7ff555297e43a7d9662405c16609f9df51b42ec1b1cc1"},"ordered_task_ids_sha256":"8f4b14d4af19399ed59a052ef970ad18eb83f19cc5257bcafa4fafd1938315b9","prompts":{"path":"/workspace/code-sft-runs/rstar-eval/contracts/dev256/evalscope_prompts.jsonl","sha256":"b8c2047bf804c01a1cc82d16e07599dea0f4d94a42af6a26386c832a33747695"},"recovery":{"path":"/workspace/code-sft-runs/rstar-eval/contracts/dev256/RECOVERY.json","sha256":"011d8adba4986651a5d83add11626f155270008c9e69e89a4a86e753d71b0906"},"role":"DIAGNOSTIC_ONLY","rows":256,"schema":"CTX_LCDIV_DEV256_RECOVERY_V2","seed":3407,"seed_count":1,"subset_filter":null,"universe_rule":"exact content-addressed ordered task IDs recovered from six frozen test*.jsonl shards; no resampling, shuffle, date filtering, subset filtering, or hub refresh"},"cap_rate":0.53125,"caps":136,"checkpoint":"/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/out/Q4B-THINK-MIX/906bfd4b4dc7f14ee4320094d8b41684abff8539/qwen3-8b-think-lcb-system-v2/fc22e609554e898f2ae570f75bce208ae3428aada9931dc43bc7da3735f95885/step-000920-tokens-64848450","code_plus_stop":73,"first_stop_accounted":256,"first_stop_token":{"100257":0,"100265":0,"151643":0,"151645":0,"length":136,"other":120},"gpu":2,"kind":"merged_full_weights","lora":false,"merged":"/workspace/code-sft-runs/rstar-eval/official-dev256/v4-q4b-think-mix/scratch/step-000920-tokens-64848450-merged-full","mode":"think","native_validation":{"modes":{"functional":109,"stdin":147},"native_index_sha256":"ea66e0d8814490a7e0d7ff555297e43a7d9662405c16609f9df51b42ec1b1cc1","ordered_evaluation_samples_sha256":"811cc4cd88b1863ab973be0b906c12934f1acc67d436f1b48d4a6863f7e0a4c7","ordered_task_ids_sha256":"8f4b14d4af19399ed59a052ef970ad18eb83f19cc5257bcafa4fafd1938315b9","rows":256},"pass_at_1":0.28515625,"passed":73,"pending_infra":0,"per_item":{"document_sha256":"ea2d8faff8649d26c33a83b40fea63e74221e4ce76f22c052259e721495b4b8b","path":"/workspace/code-sft-runs/rstar-eval/official-dev256/v4-q4b-think-mix/results/PER_ITEM.json","sha256":"c21c2587b33b0c6d2ed14da02c463fc26e57a3c64456f4e6c82c9ca8a45cc98a"},"port":18617,"protocol_failure":0,"queue_sha256":"80a75fca2a228428ecac539eb773958b8c38975d9adb727093548aefa27fa39b","receipt_sha256":"2e587612516917f00ff268d1309f1533cb6cb282dc1b25b4ed3170517df70036","renderer_authority":{"path":"/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/tokenizers/qwen3-v4-tail151643.authority.json","sha256":"6b1461404d033b79f05a8cbb373f05a495d506a567b35b18cbf89930f345422a"},"renderer_id":"qwen3-8b-think-lcb-system-v2","rows":256,"runner":{"evalscope_adapter_sha256":"6c4977439b751003d6900c5cec2e7b3244599d3427903f99e3d7300d2c0d7687","evalscope_core_files":{"evaluate_utils.py":"a16167430f636906d15c6540f4640bb72973d9c34cea87928ebe870b51fc9794","extract_utils.py":"1c74c40a9250191cdaa5560104df583a4bec493154a2ea3eb603c35237c2a038","load_utils.py":"7c4cd6cff7d41b08b935cba6e4f35517d8c572e0f01a0b3b56dff5d182811364","testing_util.py":"72ac3f87e288cf39ed882e6f31cfc1192e5027d97d7d9a7730e2aa946effa329"},"evalscope_sandbox_sha256":"fcbbd6ec7634225ce023da194d178206ef778ad8e945e0ac36353934c09186f0","evalscope_version":"1.11.0","library_sha256":"0ab605fc8f758b1507752f19b4266c0a17e562774b1dcbe8e138708fd76ad7df","official_task":{"base":false,"cache_root":"/workspace/code-sft-runs/rstar-eval/official-dev256/v4-q4b-think-mix/cache","checkpoint":"/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/out/Q4B-THINK-MIX/906bfd4b4dc7f14ee4320094d8b41684abff8539/qwen3-8b-think-lcb-system-v2/fc22e609554e898f2ae570f75bce208ae3428aada9931dc43bc7da3735f95885/step-000920-tokens-64848450","label":"v4-q4b-think-mix","mode":"think","student_family":"qwen"},"runner_id":"code-sft-rstar-lcb-handoff-v2","runner_sha256":"5ea2f032337a72c97f0c8cda2310e9f99e649f2bbe8cbcea8e2bcbd5072c6431","sandbox_runtime":{"execution_module_sha256":"cb162f70bb548694ad08372c71399b9011500b198cc7d23bf5dc2f95912189fc","pool_config_sha256":"33de3626e6591d5dcb0b1b99bb8fa53b05acd42a8a9fe65637e2fd2c890b0790","pool_probe_sha256":"6b2a91c4f5ff066ca9617602d166f4e19a9d5228a990ea2aa62b6fd76959ebc0","scope_lease":"CODE_SFT_SANDBOX_SCOPE_LEASE_V1","scope_module_sha256":"d5c0cb716af86aa2bc03c12cce8106046692672eafe6fb7cc7562e4c9752a8bf","transport":"SANDBOX_API_V1_DIRECT_TOOL_EXECUTE"}},"schema":"CODE_SFT_RSTAR_EVAL_SUITE_RECEIPT_V1","scored":256,"seed":3407,"served_model":"v4-q4b-think-mix-dev256","status":"COMPLETE","student_family":"qwen","suite":"dev256","unscored":0}
provenance/MQ0_NEAR_DUP.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mq0": {
3
+ "status": "PASS",
4
+ "coverage": "6_OF_6",
5
+ "intersection": 0,
6
+ "denylist_path": "/workspace/code_selfgen_rstar_20260831_t4b2507/ext/work/BENCHMARK_HASHES.txt",
7
+ "denylist_sha256": "c6ed508202aa5a3d1eb3a49f1791e241e02a8f99e7a81bc4ba1a4164d6f1c2e9"
8
+ },
9
+ "near_dup_hit_hashes": [],
10
+ "near_dup_grey_zone_count": 0,
11
+ "dropped_n": 0,
12
+ "kept_n": 4155
13
+ }
provenance/POLICY.json ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "arms": [
3
+ {
4
+ "arm_id": "Q4B-THINK-MIX",
5
+ "data": {
6
+ "assistant_target_tokens": 64848450,
7
+ "manifest_file_sha256": "fc22e609554e898f2ae570f75bce208ae3428aada9931dc43bc7da3735f95885",
8
+ "manifest_path": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/data/mix_l0.2_s0.8_tail151643_2EP_READY.json",
9
+ "manifest_sha256": "fc22e609554e898f2ae570f75bce208ae3428aada9931dc43bc7da3735f95885",
10
+ "max_assistant_target_tokens_per_example": 16384,
11
+ "payload_rows": 8310,
12
+ "payload_sha256": "6097d7bf8bc18621ed4fbc2c7f4e6a68b65186eb1d25964fd632580f97dabdfd",
13
+ "source_revision": "3a7a0a0636ec96e3c1ec42ebe79ade467caa040d"
14
+ },
15
+ "gpu": 2,
16
+ "model": {
17
+ "config_sha256": "304b2545a258d35620f1d4bf46940c0471d9baa00715ff8e77f84c2fca5057c1",
18
+ "hf_id": "Qwen/Qwen3-4B-Base",
19
+ "local_path": "/workspace/code-sft-infra/models/qwen3-4b-base",
20
+ "revision": "906bfd4b4dc7f14ee4320094d8b41684abff8539",
21
+ "tie_word_embeddings": true,
22
+ "tokenizer_sha256": "c0382117ea329cdf097041132f6d735924b697924d6f6fc3945713e96ce87539"
23
+ },
24
+ "model_id": "qwen3-4b-base",
25
+ "renderer": {
26
+ "assistant_termination": {
27
+ "final_text_suffix": "<|endoftext|>",
28
+ "final_token_suffix": [
29
+ 151643
30
+ ],
31
+ "turn_end_token_id": 151645
32
+ },
33
+ "chat_template_kwargs": {
34
+ "enable_thinking": true
35
+ },
36
+ "chat_template_sha256": "b608d01889daca5f325cc44d1cbabf73ec74d4d53c9950725cc46068a7006a68",
37
+ "encoding_policy": {
38
+ "add_special_tokens": false,
39
+ "assistant_termination_in_loss": true,
40
+ "assistant_termination_in_target_census": true,
41
+ "incomplete_target": "reject",
42
+ "padding_label_mask": "attention_or_pad_positions_never_token_id"
43
+ },
44
+ "eos_token": "<|endoftext|>",
45
+ "eos_token_id": 151643,
46
+ "mode": "think",
47
+ "runtime_tokenizer_manifest_sha256": "66615d472270d50fca0a4b4b299ab2663a9944102f0afd4626fcee46214fe248",
48
+ "runtime_tokenizer_path": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/tokenizers/qwen3-v4-tail151643",
49
+ "stop_token_ids": [
50
+ 151643,
51
+ 151645
52
+ ],
53
+ "system_prompt": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests. You will NOT return anything except for the program.",
54
+ "system_prompt_policy": "exact_evalscope_live_code_bench_system_message",
55
+ "system_prompt_policy_sha256": "209896b91040ef82e511aa0c7c95a2f9f5dadc9d3c4879f7c66da4ddca34295b",
56
+ "system_prompt_sha256": "41b9af0ebedb936e74e0996175f76f0116c334375ec3a7c914166f126c02f489",
57
+ "tokenizer_hf_id": "Qwen/Qwen3-4B-Base",
58
+ "tokenizer_revision": "906bfd4b4dc7f14ee4320094d8b41684abff8539",
59
+ "tokenizer_sha256": "c0382117ea329cdf097041132f6d735924b697924d6f6fc3945713e96ce87539"
60
+ },
61
+ "renderer_authority": {
62
+ "path": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/tokenizers/qwen3-v4-tail151643.authority.json",
63
+ "sha256": "6b1461404d033b79f05a8cbb373f05a495d506a567b35b18cbf89930f345422a"
64
+ },
65
+ "renderer_id": "qwen3-8b-think-lcb-system-v2",
66
+ "source_id": "rstar-coder"
67
+ }
68
+ ],
69
+ "generation_behavior_gate": null,
70
+ "owner_authorization": "PI 2026-09-09 Q4B-THINK-MIX Mix Distillation 0.2:0.8",
71
+ "recipe": {
72
+ "adapter": {
73
+ "alpha": 128,
74
+ "dropout": 0.0,
75
+ "method": "lora",
76
+ "modules_to_save": null,
77
+ "rank": 64,
78
+ "target_modules": [
79
+ "q_proj",
80
+ "k_proj",
81
+ "v_proj",
82
+ "o_proj",
83
+ "gate_proj",
84
+ "up_proj",
85
+ "down_proj"
86
+ ]
87
+ },
88
+ "boundary": {
89
+ "fp32_master": true,
90
+ "mode": "trainable_token_rows_both_sides",
91
+ "row_lr": 0.0001,
92
+ "row_weight_decay": 0.0,
93
+ "token_ids": [
94
+ 151643,
95
+ 151667,
96
+ 151668
97
+ ],
98
+ "untie_tied_embeddings": true
99
+ },
100
+ "checkpoint_target_tokens": [
101
+ 32445505,
102
+ 48759220,
103
+ 64848450
104
+ ],
105
+ "epochs": 2,
106
+ "gradient_checkpointing": true,
107
+ "max_sequence_length": 32768,
108
+ "model_runtime": {
109
+ "bf16": true,
110
+ "finetuning_type": "lora",
111
+ "gradient_checkpointing": true,
112
+ "lora_alpha": 128,
113
+ "lora_dropout": 0.0,
114
+ "lora_rank": 64,
115
+ "lora_targets": [
116
+ "q_proj",
117
+ "k_proj",
118
+ "v_proj",
119
+ "o_proj",
120
+ "gate_proj",
121
+ "up_proj",
122
+ "down_proj"
123
+ ],
124
+ "modules_to_save": null,
125
+ "trainable_dtype": "float32",
126
+ "trainable_token_indices": {
127
+ "embed_tokens": [
128
+ 151643,
129
+ 151667,
130
+ 151668
131
+ ],
132
+ "lm_head": [
133
+ 151643,
134
+ 151667,
135
+ 151668
136
+ ]
137
+ }
138
+ },
139
+ "optimizer": {
140
+ "betas": [
141
+ 0.9,
142
+ 0.95
143
+ ],
144
+ "eps": 1e-08,
145
+ "gradient_clip_norm": 1.0,
146
+ "learning_rate": 0.0001,
147
+ "name": "adamw",
148
+ "weight_decay": 0.1
149
+ },
150
+ "packing": {
151
+ "enabled": false
152
+ },
153
+ "precision": "bfloat16",
154
+ "repeat_examples": false,
155
+ "scheduler": "cosine_by_assistant_target_token_dose",
156
+ "seed": 42,
157
+ "target_assistant_tokens": 64848450,
158
+ "tokens_per_optimizer_update": 65536,
159
+ "trainable_dtype": "float32",
160
+ "truncation": false,
161
+ "warmup_target_tokens": 3890907
162
+ },
163
+ "runtime": {
164
+ "checkpoint_root": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/out",
165
+ "state_root": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX"
166
+ },
167
+ "schema": "CODE_SFT_RSTAR_DUAL_TRAINING_POLICY_V1",
168
+ "status": "SEALED"
169
+ }
provenance/RUN_IDENTITY.json ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "RUN_IDENTITY_V1",
3
+ "run_id": "t30b2507-q4b-think-mix-l0.2-s0.8-v4-tail151643",
4
+ "corrects": "Q4B-THINK Mix Distillation 0.2:0.8 (30B-A3B-Thinking : 4B-Thinking by rows)",
5
+ "notes": "Mix Distillation Mix-Large (Li et al. 2025 arXiv 2502.12143): 30B-A3B-Thinking : 4B-Thinking = 0.2 : 0.8 by row/problem; one teacher trace per problem; dose target 32436894/ep ±1%, actual 1ep 32424225, 2ep 64848450. 30B source=/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/data/THINK_PAIRED_V4_2EP.parquet sha=c160713fea76eae124dbbc3b5c619d3164862da83f61d91d3970ede990a12540 (2EP first half 4715 rows). 4B source=/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-T4BDATA/data/joint-full-t4b_tail151643.parquet sha=d09c4d6272de7e50c9b2df0e401878864f09bda33db05a5833c43575969fa524. V4 recipe unchanged (LoRA r64/α128, lr 1e-4, both-sides B-row [151643,151667,151668], physical 2ep concat, seed 42). PI approved 2026-09-09.",
6
+ "model": {
7
+ "hf_id": "Qwen/Qwen3-4B-Base",
8
+ "revision": "906bfd4b4dc7f14ee4320094d8b41684abff8539",
9
+ "local_path": "/workspace/code-sft-infra/models/qwen3-4b-base",
10
+ "tied_embeddings": true
11
+ },
12
+ "data": {
13
+ "path": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/data/mix_l0.2_s0.8_tail151643_2EP.parquet",
14
+ "rows": 8310,
15
+ "sha256": "6097d7bf8bc18621ed4fbc2c7f4e6a68b65186eb1d25964fd632580f97dabdfd",
16
+ "census": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/data/TOKEN_CENSUS_MIX.json",
17
+ "physical_2ep": "concat(mix, mix) same order; teacher_source 30b/4b; tail 151643",
18
+ "source_1ep_path": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/data/mix_l0.2_s0.8_tail151643.parquet",
19
+ "source_1ep_sha256": "3c5ae286e7e5242df3c011123edaf0727405d3b535e85d77ce6b99afe7c27e77",
20
+ "source_1ep_rows": 4155,
21
+ "teacher_30b_path": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/data/THINK_PAIRED_V4_2EP.parquet",
22
+ "teacher_30b_sha256": "c160713fea76eae124dbbc3b5c619d3164862da83f61d91d3970ede990a12540",
23
+ "teacher_4b_path": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-T4BDATA/data/joint-full-t4b_tail151643.parquet",
24
+ "teacher_4b_sha256": "d09c4d6272de7e50c9b2df0e401878864f09bda33db05a5833c43575969fa524",
25
+ "mix_ratio_rows": "0.2:0.8",
26
+ "n30": 831,
27
+ "n4": 3324,
28
+ "active_tokens_1ep": 32424225
29
+ },
30
+ "seeds": {
31
+ "train": 42,
32
+ "eval": 3407,
33
+ "mix": 42
34
+ },
35
+ "parameters": {
36
+ "epochs": 2,
37
+ "target_assistant_tokens": 64848450,
38
+ "active_tokens_1ep": 32424225,
39
+ "checkpoint_target_tokens": [
40
+ 32445505,
41
+ 48759220,
42
+ 64848450
43
+ ],
44
+ "milestone_updates": [
45
+ 495,
46
+ 744,
47
+ 990
48
+ ],
49
+ "warmup_target_tokens": 3890907,
50
+ "learning_rate": 0.0001,
51
+ "row_lr": 0.0001,
52
+ "optimizer": "adamw",
53
+ "optimizer_betas": [
54
+ 0.9,
55
+ 0.95
56
+ ],
57
+ "optimizer_eps": 1e-08,
58
+ "lora_rank": 64,
59
+ "lora_alpha": 128,
60
+ "lora_dropout": 0.0,
61
+ "lora_target_modules": [
62
+ "q_proj",
63
+ "k_proj",
64
+ "v_proj",
65
+ "o_proj",
66
+ "gate_proj",
67
+ "up_proj",
68
+ "down_proj"
69
+ ],
70
+ "lora_weight_decay": 0.1,
71
+ "row_weight_decay": 0.0,
72
+ "max_grad_norm": 1.0,
73
+ "tokens_per_optimizer_update": 65536,
74
+ "packing": false,
75
+ "truncation": false,
76
+ "repeat_examples": false,
77
+ "precision": "bfloat16",
78
+ "trainable_dtype": "float32",
79
+ "gradient_checkpointing": true,
80
+ "eos_weight": 1.0,
81
+ "scheduler": "cosine_by_assistant_target_token_dose",
82
+ "worker_lr_scale": "rstar_dual_worker_v4._lr_scale",
83
+ "supervised_tail": [
84
+ 151643
85
+ ],
86
+ "trainable_token_indices": {
87
+ "embed_tokens": [
88
+ 151643,
89
+ 151667,
90
+ 151668
91
+ ],
92
+ "lm_head": [
93
+ 151643,
94
+ 151667,
95
+ 151668
96
+ ]
97
+ },
98
+ "untie_tied_embeddings": true,
99
+ "context": 32768,
100
+ "eval": {
101
+ "suite": "DEV256",
102
+ "seed": 3407,
103
+ "temperature": 0.6,
104
+ "top_p": 0.95,
105
+ "top_k": 20,
106
+ "ctx": 32768,
107
+ "stop_ids": [
108
+ 151643,
109
+ 151645
110
+ ],
111
+ "base_reeval_same_mode": true
112
+ }
113
+ },
114
+ "code": {
115
+ "path": "/workspace/tools/rstar_dual_worker_v4.py",
116
+ "commit_or_sha256": "5cbdaca65556cbe0cf9e1374cf122c22511b02781eda6fab4ca780a869562cb7",
117
+ "prep": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/scripts/build_mix_distill_payload.py",
118
+ "prep_sha256": "2ff0f61e200d18dd55b1301f9573e923abd6fe87608220f7126cf709d4cb7288"
119
+ },
120
+ "started_at": "2026-09-09T06:13:03Z",
121
+ "endpoint": "2EP_ONLY @64848450 assistant tokens; no checkpoint picking",
122
+ "status": "RUNNING"
123
+ }
provenance/TRAINING_CONFIG.json ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "code-sixarm-training-config/v4",
3
+ "status": "READY_NOT_STARTED",
4
+ "config_id": "Q4B-THINK-MIX",
5
+ "arm_id": "Q4B-THINK-MIX",
6
+ "corrects": "Q4B-THINK Mix Distillation 0.2:0.8 (30B:4B by rows)",
7
+ "base": {
8
+ "model_id": "Qwen/Qwen3-4B-Base",
9
+ "revision": "906bfd4b4dc7f14ee4320094d8b41684abff8539",
10
+ "local_path": "/workspace/code-sft-infra/models/qwen3-4b-base",
11
+ "pure_base": true,
12
+ "warm_start_adapter": null,
13
+ "tied_embeddings": true,
14
+ "tokenizer_sha256": "c0382117ea329cdf097041132f6d735924b697924d6f6fc3945713e96ce87539",
15
+ "tokenizer_config_sha256": "3c04ed3ca964ea2f6b2b5faf0dc4d31aec1cb1e8b4bcf63f402d295046b422b5"
16
+ },
17
+ "boundary": {
18
+ "mode": "trainable_token_rows_both_sides",
19
+ "token_ids": [
20
+ 151643,
21
+ 151667,
22
+ 151668
23
+ ],
24
+ "token_names": {
25
+ "151643": "<|endoftext|>",
26
+ "151667": "<think>",
27
+ "151668": "</think>"
28
+ },
29
+ "row_lr": 0.0001,
30
+ "row_weight_decay": 0.0,
31
+ "fp32_master": true,
32
+ "untie_tied_embeddings": true
33
+ },
34
+ "context": {
35
+ "model_context": 32768,
36
+ "packing": false,
37
+ "truncation": false
38
+ },
39
+ "checkpoint": {
40
+ "milestone_updates": [
41
+ 495,
42
+ 744,
43
+ 990
44
+ ],
45
+ "checkpoint_target_tokens": [
46
+ 32445505,
47
+ 48759220,
48
+ 64848450
49
+ ],
50
+ "save_only_do_not_pick": true,
51
+ "right_side_3_only": true,
52
+ "primary": "2EP_FINAL_ONLY",
53
+ "note": "right-side: first update fully past 1.0ep, 1.5ep, plus 2ep endpoint"
54
+ },
55
+ "data": {
56
+ "path": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/data/mix_l0.2_s0.8_tail151643_2EP.parquet",
57
+ "sha256": "6097d7bf8bc18621ed4fbc2c7f4e6a68b65186eb1d25964fd632580f97dabdfd",
58
+ "unique_rows": 4155,
59
+ "payload_rows": 8310,
60
+ "physical_rows": 8310,
61
+ "epochs": 2,
62
+ "physical_2ep_rule": "concat(mix_l0.2_s0.8, mix_l0.2_s0.8) same order; 1ep is unique mixed rows",
63
+ "planned_active_tokens": 64848450,
64
+ "active_tokens_1ep": 32424225,
65
+ "full_tokens_1ep": 34594765,
66
+ "optimizer_updates": 990,
67
+ "census": "/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907/arms/Q4B-THINK-MIX/data/TOKEN_CENSUS_MIX.json",
68
+ "duplicate_rows_allowed": true,
69
+ "order_mutation_allowed": false,
70
+ "token_columns_in_parquet": "supervised tail [151643]; matches v4 worker render",
71
+ "source_1ep_sha256": "3c5ae286e7e5242df3c011123edaf0727405d3b535e85d77ce6b99afe7c27e77"
72
+ },
73
+ "model_runtime": {
74
+ "bf16": true,
75
+ "trainable_dtype": "float32",
76
+ "finetuning_type": "lora",
77
+ "lora_rank": 64,
78
+ "lora_alpha": 128,
79
+ "lora_dropout": 0.0,
80
+ "lora_targets": [
81
+ "q_proj",
82
+ "k_proj",
83
+ "v_proj",
84
+ "o_proj",
85
+ "gate_proj",
86
+ "up_proj",
87
+ "down_proj"
88
+ ],
89
+ "modules_to_save": null,
90
+ "gradient_checkpointing": true,
91
+ "trainable_token_indices": {
92
+ "embed_tokens": [
93
+ 151643,
94
+ 151667,
95
+ 151668
96
+ ],
97
+ "lm_head": [
98
+ 151643,
99
+ 151667,
100
+ 151668
101
+ ]
102
+ }
103
+ },
104
+ "optimization": {
105
+ "active_tokens_per_update_target": 65536,
106
+ "betas": [
107
+ 0.9,
108
+ 0.95
109
+ ],
110
+ "epsilon": 1e-08,
111
+ "learning_rate": 0.0001,
112
+ "max_grad_norm": 1.0,
113
+ "optimizer": "adamw",
114
+ "weight_decay": 0.1,
115
+ "whole_row_microsteps": true,
116
+ "warmup_fraction": 0.06,
117
+ "warmup_target_tokens": 3890907,
118
+ "scheduler": "cosine_by_assistant_target_token_dose",
119
+ "min_lr_ratio": 0.0,
120
+ "scheduler_horizon_optimizer_updates": 990,
121
+ "target_assistant_tokens": 64848450,
122
+ "worker_lr_scale": "rstar_dual_worker_v4._lr_scale"
123
+ },
124
+ "performance_recipe": {
125
+ "eos_weight": 1.0,
126
+ "prompt_mask": -100
127
+ },
128
+ "recipe_worker_fields": {
129
+ "tokens_per_optimizer_update": 65536,
130
+ "max_sequence_length": 32768,
131
+ "packing": {
132
+ "enabled": false
133
+ },
134
+ "repeat_examples": false,
135
+ "note": "2EP is physical concat; do not recycle via repeat_examples"
136
+ },
137
+ "reproducibility": {
138
+ "seed": 42
139
+ },
140
+ "runner": {
141
+ "path": "/workspace/tools/rstar_dual_worker_v4.py",
142
+ "sha256": "5cbdaca65556cbe0cf9e1374cf122c22511b02781eda6fab4ca780a869562cb7",
143
+ "rewrite_forbidden": true
144
+ },
145
+ "template": {
146
+ "id": "qwen3-8b-think-lcb-system-v2",
147
+ "mode": "think",
148
+ "enable_thinking": true,
149
+ "generation_prefill": false,
150
+ "target_contains_full_think": true,
151
+ "canonical_empty_think_pair_in_prompt": false,
152
+ "empty_think_pair_in_loss": false,
153
+ "target_forbids_think_tags": false,
154
+ "olmo_nothink_empty_pair_equivalent": null,
155
+ "chat_template_file": null,
156
+ "system_prompt_sha256": "41b9af0ebedb936e74e0996175f76f0116c334375ec3a7c914166f126c02f489",
157
+ "chat_template_sha256": "87a2728cb8dc9fe424d624542f6060ec05a1d285ebbec578bb078900e33396b5",
158
+ "target_tail": [
159
+ 151643
160
+ ],
161
+ "evaluation_stop_ids": [
162
+ 151643,
163
+ 151645
164
+ ],
165
+ "eos_token_ids": [
166
+ 151643
167
+ ],
168
+ "eos_token": "<|endoftext|>",
169
+ "supervision_eos": 151643,
170
+ "forbidden_label_ids": [
171
+ 151645,
172
+ 198
173
+ ]
174
+ },
175
+ "eval": {
176
+ "suite": "DEV256",
177
+ "seed": 3407,
178
+ "enable_thinking": true,
179
+ "canonical_empty_think_pair": false,
180
+ "generated_think_tags": null,
181
+ "temperature": 0.6,
182
+ "top_p": 0.95,
183
+ "top_k": 20,
184
+ "model_context": 32768,
185
+ "max_actual": "ctx-prompt-64",
186
+ "stop_ids": [
187
+ 151643,
188
+ 151645
189
+ ],
190
+ "base_must_reeval_same_mode": true,
191
+ "primary_checkpoint": "2EP_FINAL_ONLY",
192
+ "milestones": "appendix_only",
193
+ "cap_rate": "report_only",
194
+ "do_not_execute": true
195
+ }
196
+ }
provenance/build_mix_distill_payload.py ADDED
@@ -0,0 +1,789 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Build Mix Distillation 1ep/2ep payload for Q4B-THINK-MIX (Li et al. 2025 Mix-Large).
3
+
4
+ 30B-A3B-Thinking : 4B-Thinking = 0.2 : 0.8 by row/problem count. One teacher
5
+ trace per problem. Dose target 32,436,894 assistant tokens/ep (±1%), physical
6
+ 2ep concat same order. V4 recipe otherwise unchanged.
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import hashlib
11
+ import json
12
+ import math
13
+ import random
14
+ import sys
15
+ from datetime import datetime, timezone
16
+ from pathlib import Path
17
+ from typing import Any
18
+
19
+ import pyarrow as pa
20
+ import pyarrow.parquet as pq
21
+
22
+ ROOT = Path("/workspace/code-sft-runs/t30b2507-q4b-tn-v2-lr1e4-e1-20260907")
23
+ ARM = ROOT / "arms" / "Q4B-THINK-MIX"
24
+ DATA = ARM / "data"
25
+ P30_2EP = ROOT / "data" / "THINK_PAIRED_V4_2EP.parquet"
26
+ P30_2EP_SHA = "c160713fea76eae124dbbc3b5c619d3164862da83f61d91d3970ede990a12540"
27
+ P30_1EP_ROWS = 4715
28
+ P4 = ROOT / "arms" / "Q4B-THINK-T4BDATA" / "data" / "joint-full-t4b_tail151643.parquet"
29
+ P4_SHA = "d09c4d6272de7e50c9b2df0e401878864f09bda33db05a5833c43575969fa524"
30
+ P4_ROWS = 3866
31
+ OUT_1EP = DATA / "mix_l0.2_s0.8_tail151643.parquet"
32
+ OUT_2EP = DATA / "mix_l0.2_s0.8_tail151643_2EP.parquet"
33
+ READY = DATA / "mix_l0.2_s0.8_tail151643_2EP_READY.json"
34
+ CENSUS = DATA / "TOKEN_CENSUS_MIX.json"
35
+ MQ0_OUT = DATA / "MQ0_NEAR_DUP.json"
36
+ V4_POLICY = ROOT / "arms" / "Q4B-THINK" / "POLICY.json"
37
+ V4_CFG = ROOT / "arms" / "Q4B-THINK-T4BDATA" / "TRAINING_CONFIG.json"
38
+ V4_LAUNCH = ROOT / "arms" / "Q4B-THINK-T4BDATA" / "control" / "LAUNCH.json"
39
+ WORKER = Path("/workspace/tools/rstar_dual_worker_v4.py")
40
+ RUN_ID = "t30b2507-q4b-think-mix-l0.2-s0.8-v4-tail151643"
41
+ ARM_ID = "Q4B-THINK-MIX"
42
+ SEED = 42
43
+ TARGET_1EP = 32_436_894
44
+ TOL = 0.01
45
+ RATIO_30, RATIO_4 = 1, 4
46
+
47
+ sys.path.insert(0, str(ROOT / "scripts"))
48
+ sys.path.insert(0, "/workspace/code-sft-infra/src")
49
+ sys.path.insert(0, "/workspace/tools")
50
+ sys.path.insert(0, "/workspace/code_think_30b_main_20260906/scripts")
51
+
52
+ from code_sft_infra.contracts import document_digest, sha256_file # noqa: E402
53
+ from code_sft_infra.evaluation import build_lcb_prompt_messages # noqa: E402
54
+ from code_sft_infra.rendering import render_completion_only # noqa: E402
55
+ from code_sft_infra.source_census import load_hash_denylist # noqa: E402
56
+ import materialize_t30b_g2_fenced as think_m # noqa: E402
57
+ import near_dup_scan # noqa: E402
58
+ import select_core # noqa: E402
59
+ import v4_render_lib # noqa: E402
60
+
61
+
62
+ def _sha256_bytes_file(path: Path) -> str:
63
+ digest = hashlib.sha256()
64
+ with path.open("rb") as handle:
65
+ for chunk in iter(lambda: handle.read(8 << 20), b""):
66
+ digest.update(chunk)
67
+ return digest.hexdigest()
68
+
69
+
70
+ def _pct(values: list[int], p: float) -> float:
71
+ if not values:
72
+ return float("nan")
73
+ xs = sorted(values)
74
+ if len(xs) == 1:
75
+ return float(xs[0])
76
+ k = (len(xs) - 1) * p / 100.0
77
+ lo = int(math.floor(k))
78
+ hi = int(math.ceil(k))
79
+ if lo == hi:
80
+ return float(xs[lo])
81
+ return xs[lo] + (xs[hi] - xs[lo]) * (k - lo)
82
+
83
+
84
+ def mq0_all_hits(rows: list[dict[str, Any]]) -> tuple[dict[str, Any], list[dict[str, Any]]]:
85
+ summary = think_m.run_mq0(rows)
86
+ if summary.get("coverage") != "6_OF_6":
87
+ raise SystemExit(f"MQ0 coverage not 6_OF_6: {summary}")
88
+ if summary.get("status") in {"blocked_before_train"}:
89
+ raise SystemExit(f"MQ0 blocked: {summary}")
90
+ denylist, _ = load_hash_denylist(think_m.DENYLIST_PATH)
91
+ extra, _ = think_m.load_eval_extra_signatures()
92
+ union = set(denylist) | extra
93
+ hits: list[dict[str, Any]] = []
94
+ for row in rows:
95
+ overlap = sorted(think_m.train_signatures(row) & union)
96
+ if overlap:
97
+ hits.append(
98
+ {
99
+ "problem_hash": row["problem_hash"],
100
+ "problem_id": row.get("problem_id"),
101
+ "overlap_n": len(overlap),
102
+ "overlap_head": overlap[:3],
103
+ "reason": "mq0_intersection",
104
+ }
105
+ )
106
+ if len(hits) != int(summary.get("intersection") or 0):
107
+ raise SystemExit(
108
+ f"MQ0 hit count mismatch full={len(hits)} summary={summary.get('intersection')}"
109
+ )
110
+ return summary, hits
111
+
112
+
113
+ def _index(rows: list[dict[str, Any]], label: str) -> dict[str, dict[str, Any]]:
114
+ out: dict[str, dict[str, Any]] = {}
115
+ pids: dict[str, str] = {}
116
+ for row in rows:
117
+ h = str(row["problem_hash"])
118
+ pid = str(row["problem_id"])
119
+ if h in out:
120
+ raise SystemExit(f"{label} duplicate problem_hash {h}")
121
+ if pid in pids:
122
+ raise SystemExit(f"{label} duplicate problem_id {pid}")
123
+ out[h] = row
124
+ pids[pid] = h
125
+ return out
126
+
127
+
128
+ def _fill(
129
+ union: list[str],
130
+ preferred: dict[str, str],
131
+ only30: set[str],
132
+ only4: set[str],
133
+ n30: int,
134
+ n4: int,
135
+ ) -> tuple[list[str], list[str]]:
136
+ picked_30: list[str] = []
137
+ picked_4: list[str] = []
138
+ for h in union:
139
+ if len(picked_30) >= n30 and len(picked_4) >= n4:
140
+ break
141
+ if h in only30:
142
+ if len(picked_30) < n30:
143
+ picked_30.append(h)
144
+ continue
145
+ if h in only4:
146
+ if len(picked_4) < n4:
147
+ picked_4.append(h)
148
+ continue
149
+ pref = preferred[h]
150
+ if pref == "30b" and len(picked_30) < n30:
151
+ picked_30.append(h)
152
+ elif pref == "4b" and len(picked_4) < n4:
153
+ picked_4.append(h)
154
+ elif pref == "30b" and len(picked_4) < n4:
155
+ picked_4.append(h)
156
+ elif pref == "4b" and len(picked_30) < n30:
157
+ picked_30.append(h)
158
+ return picked_30, picked_4
159
+
160
+
161
+ def _sample_record(i: int, row: dict[str, Any], tok: Any) -> dict[str, Any]:
162
+ reason = str(row.get("reasoning") or "")
163
+ answer = str(row.get("final_answer") or "")
164
+ rendered = v4_render_lib.render_qwen(
165
+ tok,
166
+ mode="think",
167
+ prompt=str(row["prompt"] or ""),
168
+ reasoning=reason,
169
+ answer=answer,
170
+ )
171
+ rec = {
172
+ "i": i,
173
+ "teacher_source": row["teacher_source"],
174
+ "problem_id": row["problem_id"],
175
+ "problem_hash": row["problem_hash"],
176
+ "prompt_head": str(row["prompt"])[:160].replace("\n", " "),
177
+ "think_in_reason": "<think>" in reason,
178
+ "think_close_in_reason": "</think>" in reason,
179
+ "code_fence_in_answer": "```" in answer,
180
+ "final_answer_head": answer[:120].replace("\n", "\\n"),
181
+ "assistant_target_tokens": int(row["assistant_target_tokens"]),
182
+ "full_tokens": int(row["full_tokens"]),
183
+ "rendered_think_open": rendered.target_text.lower().count("<think>"),
184
+ "rendered_think_close": rendered.target_text.lower().count("</think>"),
185
+ "rendered_code_fence": "```" in rendered.target_text,
186
+ "last_token": rendered.last_token_id,
187
+ "active_match": rendered.active_tokens == int(row["assistant_target_tokens"]),
188
+ "full_match": rendered.full_tokens == int(row["full_tokens"]),
189
+ }
190
+ if rec["rendered_think_open"] != 1 or rec["rendered_think_close"] != 1:
191
+ raise SystemExit(f"think pair not 1/1 i={i} {rec}")
192
+ if not rec["rendered_code_fence"]:
193
+ raise SystemExit(f"missing code fence i={i} {rec}")
194
+ if rec["last_token"] != 151643:
195
+ raise SystemExit(f"tail not 151643 i={i} last={rec['last_token']}")
196
+ return rec
197
+
198
+
199
+ def main() -> int:
200
+ DATA.mkdir(parents=True, exist_ok=True)
201
+ for sub in ("out", "status", "logs", "control"):
202
+ (ARM / sub).mkdir(parents=True, exist_ok=True)
203
+
204
+ sha30 = _sha256_bytes_file(P30_2EP)
205
+ if sha30 != P30_2EP_SHA:
206
+ raise SystemExit(f"30B 2EP sha mismatch {sha30} != {P30_2EP_SHA}")
207
+ sha4 = _sha256_bytes_file(P4)
208
+ if sha4 != P4_SHA:
209
+ raise SystemExit(f"4B 1ep sha mismatch {sha4} != {P4_SHA}")
210
+
211
+ t30_all = pq.read_table(P30_2EP)
212
+ if t30_all.num_rows != P30_1EP_ROWS * 2:
213
+ raise SystemExit(f"30B 2EP rows {t30_all.num_rows} != {P30_1EP_ROWS * 2}")
214
+ t30 = t30_all.slice(0, P30_1EP_ROWS)
215
+ t4 = pq.read_table(P4)
216
+ if t4.num_rows != P4_ROWS:
217
+ raise SystemExit(f"4B rows {t4.num_rows} != {P4_ROWS}")
218
+ if list(t30.schema.names) != list(t4.schema.names):
219
+ raise SystemExit(f"schema names differ 30B={t30.schema.names} 4B={t4.schema.names}")
220
+ for name in t30.schema.names:
221
+ if str(t30.schema.field(name).type) != str(t4.schema.field(name).type):
222
+ raise SystemExit(f"schema type differ {name}")
223
+
224
+ rows30 = t30.to_pylist()
225
+ rows4 = t4.to_pylist()
226
+ tok30 = sum(int(r["assistant_target_tokens"]) for r in rows30)
227
+ tok4_pool = sum(int(r["assistant_target_tokens"]) for r in rows4)
228
+ if tok30 != TARGET_1EP:
229
+ raise SystemExit(f"30B 1ep tokens {tok30} != {TARGET_1EP}")
230
+ if tok4_pool != 30_327_765:
231
+ raise SystemExit(f"4B 1ep tokens {tok4_pool} != 30327765")
232
+
233
+ map30 = _index(rows30, "30B")
234
+ map4 = _index(rows4, "4B")
235
+ h30, h4 = set(map30), set(map4)
236
+ inter = h30 & h4
237
+ only30 = h30 - h4
238
+ only4 = h4 - h30
239
+ union_set = h30 | h4
240
+ pid30 = {str(map30[h]["problem_id"]) for h in h30}
241
+ pid4 = {str(map4[h]["problem_id"]) for h in h4}
242
+ if len(pid30 & pid4) != len(inter):
243
+ raise SystemExit("problem_id intersection size != problem_hash intersection")
244
+ for h in inter:
245
+ if str(map30[h]["problem_id"]) != str(map4[h]["problem_id"]):
246
+ raise SystemExit(f"hash/id mismatch {h}")
247
+
248
+ print(
249
+ "UNIVERSE",
250
+ json.dumps(
251
+ {
252
+ "union": len(union_set),
253
+ "intersect": len(inter),
254
+ "only30": len(only30),
255
+ "only4": len(only4),
256
+ "pid_intersect": len(pid30 & pid4),
257
+ "pid_only30": len(pid30 - pid4),
258
+ "pid_only4": len(pid4 - pid30),
259
+ }
260
+ ),
261
+ )
262
+
263
+ mean30 = tok30 / len(rows30)
264
+ mean4 = tok4_pool / len(rows4)
265
+ n30_est = max(1, int(round(TARGET_1EP / (mean30 * RATIO_30 + mean4 * RATIO_4))))
266
+ n4_est = n30_est * RATIO_4
267
+ print("EST", n30_est, n4_est, "mean30", mean30, "mean4", mean4)
268
+ need4_tok = 0.8 * TARGET_1EP
269
+ shortfall_notes: list[str] = []
270
+ if n4_est > len(h4):
271
+ shortfall_notes.append(
272
+ f"4B pool rows {len(h4)} < needed {n4_est} for 1:4; not changing ratio"
273
+ )
274
+ if tok4_pool < need4_tok:
275
+ shortfall_notes.append(
276
+ f"4B pool tokens {tok4_pool} < 0.8*target {need4_tok}; not changing ratio"
277
+ )
278
+ if shortfall_notes:
279
+ print("SHORTFALL", shortfall_notes)
280
+
281
+ rng = random.Random(SEED)
282
+ union = sorted(union_set)
283
+ rng.shuffle(union)
284
+ preferred: dict[str, str] = {}
285
+ for h in union:
286
+ if h in inter:
287
+ preferred[h] = "30b" if rng.choice((0, 1)) == 0 else "4b"
288
+
289
+ def tokens_of(p30: list[str], p4: list[str]) -> int:
290
+ return sum(int(map30[h]["assistant_target_tokens"]) for h in p30) + sum(
291
+ int(map4[h]["assistant_target_tokens"]) for h in p4
292
+ )
293
+
294
+ candidates: list[tuple[int, int, list[str], list[str], int]] = []
295
+ n30_max = min(len(h30), len(h4) // RATIO_4)
296
+ for n30 in range(1, n30_max + 1):
297
+ n4 = n30 * RATIO_4
298
+ p30, p4 = _fill(union, preferred, only30, only4, n30, n4)
299
+ if len(p30) != n30 or len(p4) != n4:
300
+ continue
301
+ tok = tokens_of(p30, p4)
302
+ candidates.append((abs(tok - TARGET_1EP), n30, p30, p4, tok))
303
+
304
+ if not candidates:
305
+ raise SystemExit("no exact 1:4 fill succeeded")
306
+ in_band = [c for c in candidates if abs(c[4] - TARGET_1EP) <= TARGET_1EP * TOL]
307
+ pool = in_band if in_band else candidates
308
+ pool.sort(key=lambda c: (c[0], abs(c[1] - n30_est)))
309
+ _, n30, picked_30, picked_4, active_1ep = pool[0]
310
+ n4 = n30 * RATIO_4
311
+ rel = abs(active_1ep - TARGET_1EP) / TARGET_1EP
312
+ print(
313
+ "PICKED",
314
+ json.dumps(
315
+ {
316
+ "n30": n30,
317
+ "n4": n4,
318
+ "active_1ep": active_1ep,
319
+ "rel_err": rel,
320
+ "in_band": rel <= TOL,
321
+ "n30_est": n30_est,
322
+ "candidates_in_band": len(in_band),
323
+ }
324
+ ),
325
+ )
326
+ if rel > TOL:
327
+ raise SystemExit(f"token dose {active_1ep} outside ±1% of {TARGET_1EP}")
328
+
329
+ mixed: list[dict[str, Any]] = []
330
+ for h in picked_30:
331
+ row = dict(map30[h])
332
+ row["teacher_source"] = "30b"
333
+ mixed.append(row)
334
+ for h in picked_4:
335
+ row = dict(map4[h])
336
+ row["teacher_source"] = "4b"
337
+ mixed.append(row)
338
+ if len({r["problem_hash"] for r in mixed}) != len(mixed):
339
+ raise SystemExit("duplicate problem in mix")
340
+ order_rng = random.Random(SEED)
341
+ order_rng.shuffle(mixed)
342
+
343
+ mq0_summary, mq0_hits = mq0_all_hits(mixed)
344
+ print(
345
+ "mq0",
346
+ mq0_summary.get("status"),
347
+ "intersection",
348
+ mq0_summary.get("intersection"),
349
+ "coverage",
350
+ mq0_summary.get("coverage"),
351
+ )
352
+ if mq0_hits or int(mq0_summary.get("intersection") or 0) != 0:
353
+ raise SystemExit(f"MQ0 intersection nonzero: {mq0_hits[:5]}")
354
+ if mq0_summary.get("coverage") != "6_OF_6":
355
+ raise SystemExit(f"MQ0 coverage {mq0_summary.get('coverage')}")
356
+
357
+ near = near_dup_scan.scan_training_rows(mixed)
358
+ print("near_dup hits", len(near["hit_hashes"]), "grey", near["grey_zone_count"])
359
+ if near["hit_hashes"]:
360
+ raise SystemExit(f"near-dup hits: {near['hit_hashes']}")
361
+
362
+ tok = v4_render_lib.load_qwen_tokenizer()
363
+ idx30 = [i for i, r in enumerate(mixed) if r["teacher_source"] == "30b"][:3]
364
+ idx4 = [i for i, r in enumerate(mixed) if r["teacher_source"] == "4b"][:3]
365
+ samples = [_sample_record(i, mixed[i], tok) for i in idx30 + idx4]
366
+ if len(samples) != 6:
367
+ raise SystemExit(f"expected 6 samples, got {len(samples)}")
368
+
369
+ v4_policy = json.loads(V4_POLICY.read_text())
370
+ renderer = v4_policy["arms"][0]["renderer"]
371
+ authority = v4_policy["arms"][0]["renderer_authority"]
372
+ contract = {"renderer": renderer, "sequence": {"max_sequence_length": 32768}}
373
+ for rec in samples:
374
+ row = mixed[rec["i"]]
375
+ worker = render_completion_only(
376
+ contract,
377
+ renderer_id="qwen3-8b-think-lcb-system-v2",
378
+ prompt_messages=build_lcb_prompt_messages(contract, row["prompt"]),
379
+ reasoning=row["reasoning"],
380
+ answer=row["final_answer"],
381
+ )
382
+ if worker.labels[-1] != 151643:
383
+ raise SystemExit(f"worker last label {worker.labels[-1]} i={rec['i']}")
384
+ rec["worker_last"] = worker.labels[-1]
385
+ rec["worker_active"] = sum(x != -100 for x in worker.labels)
386
+ rec["worker_full"] = len(worker.input_ids)
387
+ print("SAMPLE", json.dumps(rec, ensure_ascii=False))
388
+
389
+ schema = t30.schema
390
+ arrays = []
391
+ for name in schema.names:
392
+ arrays.append(pa.array([r[name] for r in mixed], type=schema.field(name).type))
393
+ arrays.append(pa.array([r["teacher_source"] for r in mixed], type=pa.string()))
394
+ names = list(schema.names) + ["teacher_source"]
395
+ one = pa.table(arrays, names=names)
396
+ two = pa.concat_tables([one, one])
397
+ if OUT_1EP.exists() or OUT_2EP.exists():
398
+ raise SystemExit("refusing to overwrite existing mix parquet")
399
+ pq.write_table(one, OUT_1EP)
400
+ pq.write_table(two, OUT_2EP)
401
+ sha1 = _sha256_bytes_file(OUT_1EP)
402
+ sha2 = _sha256_bytes_file(OUT_2EP)
403
+ actives = [int(r["assistant_target_tokens"]) for r in mixed]
404
+ fulls = [int(r["full_tokens"]) for r in mixed]
405
+ actives30 = [int(r["assistant_target_tokens"]) for r in mixed if r["teacher_source"] == "30b"]
406
+ actives4 = [int(r["assistant_target_tokens"]) for r in mixed if r["teacher_source"] == "4b"]
407
+ active_2ep = active_1ep * 2
408
+ print("wrote", OUT_1EP, one.num_rows, sha1, "active1ep", active_1ep)
409
+ print("wrote", OUT_2EP, two.num_rows, sha2, "active2ep", active_2ep)
410
+
411
+ stream_rows = [
412
+ {"problem_hash": r["problem_hash"], "active_tokens": int(r["assistant_target_tokens"])}
413
+ for r in mixed
414
+ ]
415
+ derived = select_core.derive_after_materialize(stream_rows)
416
+ if derived["planned_active_tokens_2ep"] != active_2ep:
417
+ raise SystemExit("derived 2ep tokens != 2*1ep")
418
+ print(
419
+ "derived",
420
+ json.dumps(
421
+ {
422
+ k: derived[k]
423
+ for k in (
424
+ "unique_rows",
425
+ "physical_rows_2ep",
426
+ "unique_1ep_think_active_tokens",
427
+ "planned_active_tokens_2ep",
428
+ "optimizer_updates",
429
+ "warmup_target_tokens",
430
+ "milestone_updates_right_3",
431
+ "checkpoint_target_tokens_right_3",
432
+ )
433
+ }
434
+ ),
435
+ )
436
+
437
+ mq0_body = {
438
+ "mq0": {
439
+ "status": mq0_summary.get("status"),
440
+ "coverage": mq0_summary.get("coverage"),
441
+ "intersection": mq0_summary.get("intersection"),
442
+ "denylist_path": mq0_summary.get("denylist_path"),
443
+ "denylist_sha256": mq0_summary.get("denylist_sha256"),
444
+ },
445
+ "near_dup_hit_hashes": near["hit_hashes"],
446
+ "near_dup_grey_zone_count": near["grey_zone_count"],
447
+ "dropped_n": 0,
448
+ "kept_n": len(mixed),
449
+ }
450
+ MQ0_OUT.write_text(json.dumps(mq0_body, indent=2, ensure_ascii=False) + "\n")
451
+
452
+ census = {
453
+ "schema": "TOKEN_CENSUS_MIX_L0.2_S0.8_TAIL151643",
454
+ "seed": SEED,
455
+ "n_rows": len(mixed),
456
+ "n_problems": len(mixed),
457
+ "parquet_1ep": str(OUT_1EP),
458
+ "parquet_1ep_sha256": sha1,
459
+ "parquet_2ep": str(OUT_2EP),
460
+ "parquet_2ep_sha256": sha2,
461
+ "supervised_tail": [151643],
462
+ "active_1ep": active_1ep,
463
+ "active_2ep": active_2ep,
464
+ "full_1ep": int(sum(fulls)),
465
+ "target_1ep": TARGET_1EP,
466
+ "rel_err": rel,
467
+ "ratio_rows_30_to_4": f"{n30}:{n4}",
468
+ "universe": {
469
+ "union": len(union_set),
470
+ "intersect": len(inter),
471
+ "only30": len(only30),
472
+ "only4": len(only4),
473
+ },
474
+ "teacher": {
475
+ "n30": n30,
476
+ "n4": n4,
477
+ "tok30": int(sum(actives30)),
478
+ "tok4": int(sum(actives4)),
479
+ "row_frac_30": n30 / len(mixed),
480
+ "row_frac_4": n4 / len(mixed),
481
+ "tok_frac_30": sum(actives30) / active_1ep,
482
+ "tok_frac_4": sum(actives4) / active_1ep,
483
+ "n30_from_intersect": sum(1 for h in picked_30 if h in inter),
484
+ "n30_from_only30": sum(1 for h in picked_30 if h in only30),
485
+ "n4_from_intersect": sum(1 for h in picked_4 if h in inter),
486
+ "n4_from_only4": sum(1 for h in picked_4 if h in only4),
487
+ },
488
+ "shortfall_notes": shortfall_notes,
489
+ "active": {
490
+ "n": len(actives),
491
+ "sum": active_1ep,
492
+ "min": min(actives),
493
+ "p10": _pct(actives, 10),
494
+ "p50": _pct(actives, 50),
495
+ "p90": _pct(actives, 90),
496
+ "p95": _pct(actives, 95),
497
+ "max": max(actives),
498
+ },
499
+ "active_30b": {
500
+ "n": len(actives30),
501
+ "sum": int(sum(actives30)),
502
+ "min": min(actives30),
503
+ "p50": _pct(actives30, 50),
504
+ "max": max(actives30),
505
+ },
506
+ "active_4b": {
507
+ "n": len(actives4),
508
+ "sum": int(sum(actives4)),
509
+ "min": min(actives4),
510
+ "p50": _pct(actives4, 50),
511
+ "max": max(actives4),
512
+ },
513
+ "derived": {
514
+ k: derived[k]
515
+ for k in (
516
+ "unique_rows",
517
+ "physical_rows_2ep",
518
+ "unique_1ep_think_active_tokens",
519
+ "planned_active_tokens_2ep",
520
+ "optimizer_updates",
521
+ "warmup_target_tokens",
522
+ "milestone_updates_right_3",
523
+ "checkpoint_target_tokens_right_3",
524
+ )
525
+ },
526
+ "samples": samples,
527
+ "sources": {
528
+ "30b_2ep": str(P30_2EP),
529
+ "30b_2ep_sha256": sha30,
530
+ "30b_1ep_rows_used": P30_1EP_ROWS,
531
+ "4b_1ep": str(P4),
532
+ "4b_1ep_sha256": sha4,
533
+ },
534
+ }
535
+ CENSUS.write_text(json.dumps(census, indent=2, ensure_ascii=False) + "\n")
536
+
537
+ ready_body = {
538
+ "physical_2ep": "concat(mix_table, mix_table) same order; tail [151643]; teacher_source kept",
539
+ "schema": "CODE_SFT_OR1RECIPE_READY_V1",
540
+ "status": "READY",
541
+ "training_payload": {
542
+ "active_tokens": active_2ep,
543
+ "path": OUT_2EP.name,
544
+ "rows": two.num_rows,
545
+ "sha256": sha2,
546
+ },
547
+ }
548
+ READY.write_text(json.dumps(ready_body, indent=2, sort_keys=True) + "\n")
549
+ ready_sha = sha256_file(READY)
550
+
551
+ cfg = json.loads(V4_CFG.read_text())
552
+ cfg["status"] = "READY_NOT_STARTED"
553
+ cfg["config_id"] = ARM_ID
554
+ cfg["arm_id"] = ARM_ID
555
+ cfg["corrects"] = "Q4B-THINK Mix Distillation 0.2:0.8 (30B:4B by rows)"
556
+ cfg["checkpoint"]["milestone_updates"] = derived["milestone_updates_right_3"]
557
+ cfg["checkpoint"]["checkpoint_target_tokens"] = derived["checkpoint_target_tokens_right_3"]
558
+ cfg["data"]["path"] = str(OUT_2EP)
559
+ cfg["data"]["sha256"] = sha2
560
+ cfg["data"]["unique_rows"] = len(mixed)
561
+ cfg["data"]["payload_rows"] = two.num_rows
562
+ cfg["data"]["physical_rows"] = two.num_rows
563
+ cfg["data"]["physical_2ep_rule"] = (
564
+ "concat(mix_l0.2_s0.8, mix_l0.2_s0.8) same order; 1ep is unique mixed rows"
565
+ )
566
+ cfg["data"]["planned_active_tokens"] = active_2ep
567
+ cfg["data"]["active_tokens_1ep"] = active_1ep
568
+ cfg["data"]["full_tokens_1ep"] = int(sum(fulls))
569
+ cfg["data"]["optimizer_updates"] = derived["optimizer_updates"]
570
+ cfg["data"]["census"] = str(CENSUS)
571
+ cfg["data"]["token_columns_in_parquet"] = "supervised tail [151643]; matches v4 worker render"
572
+ cfg["data"]["source_1ep_sha256"] = sha1
573
+ cfg["data"].pop("source_old_payload", None)
574
+ cfg["data"].pop("source_old_sha256", None)
575
+ cfg["optimization"]["warmup_target_tokens"] = derived["warmup_target_tokens"]
576
+ cfg["optimization"]["scheduler_horizon_optimizer_updates"] = derived["optimizer_updates"]
577
+ cfg["optimization"]["target_assistant_tokens"] = active_2ep
578
+ worker_sha = _sha256_bytes_file(WORKER)
579
+ cfg["runner"]["sha256"] = worker_sha
580
+ (ARM / "TRAINING_CONFIG.json").write_text(json.dumps(cfg, indent=2, ensure_ascii=False) + "\n")
581
+
582
+ (ARM / "TOKEN_ROWS_META.json").write_text(
583
+ json.dumps(
584
+ {
585
+ "schema": "TOKEN_ROWS_META_V1",
586
+ "ids": [151643, 151667, 151668],
587
+ "dtype": "float32",
588
+ "tied_before": True,
589
+ "untied": True,
590
+ "worker": "rstar_dual_worker_v4",
591
+ "hidden": 2560,
592
+ "base_rev": "906bfd4b4dc7f14ee4320094d8b41684abff8539",
593
+ },
594
+ indent=2,
595
+ )
596
+ + "\n"
597
+ )
598
+
599
+ identity = {
600
+ "schema": "RUN_IDENTITY_V1",
601
+ "run_id": RUN_ID,
602
+ "corrects": "Q4B-THINK Mix Distillation 0.2:0.8 (30B-A3B-Thinking : 4B-Thinking by rows)",
603
+ "notes": (
604
+ "Mix Distillation Mix-Large (Li et al. 2025 arXiv 2502.12143): "
605
+ "30B-A3B-Thinking : 4B-Thinking = 0.2 : 0.8 by row/problem; one teacher "
606
+ f"trace per problem; dose target {TARGET_1EP}/ep ±1%, actual 1ep "
607
+ f"{active_1ep}, 2ep {active_2ep}. 30B source={P30_2EP} sha={sha30} "
608
+ f"(2EP first half {P30_1EP_ROWS} rows). 4B source={P4} sha={sha4}. "
609
+ "V4 recipe unchanged (LoRA r64/α128, lr 1e-4, both-sides B-row "
610
+ "[151643,151667,151668], physical 2ep concat, seed 42). "
611
+ "PI approved 2026-09-09."
612
+ ),
613
+ "model": {
614
+ "hf_id": "Qwen/Qwen3-4B-Base",
615
+ "revision": "906bfd4b4dc7f14ee4320094d8b41684abff8539",
616
+ "local_path": "/workspace/code-sft-infra/models/qwen3-4b-base",
617
+ "tied_embeddings": True,
618
+ },
619
+ "data": {
620
+ "path": str(OUT_2EP),
621
+ "rows": two.num_rows,
622
+ "sha256": sha2,
623
+ "census": str(CENSUS),
624
+ "physical_2ep": "concat(mix, mix) same order; teacher_source 30b/4b; tail 151643",
625
+ "source_1ep_path": str(OUT_1EP),
626
+ "source_1ep_sha256": sha1,
627
+ "source_1ep_rows": one.num_rows,
628
+ "teacher_30b_path": str(P30_2EP),
629
+ "teacher_30b_sha256": sha30,
630
+ "teacher_4b_path": str(P4),
631
+ "teacher_4b_sha256": sha4,
632
+ "mix_ratio_rows": "0.2:0.8",
633
+ "n30": n30,
634
+ "n4": n4,
635
+ "active_tokens_1ep": active_1ep,
636
+ },
637
+ "seeds": {"train": 42, "eval": 3407, "mix": 42},
638
+ "parameters": {
639
+ "epochs": 2,
640
+ "target_assistant_tokens": active_2ep,
641
+ "active_tokens_1ep": active_1ep,
642
+ "checkpoint_target_tokens": derived["checkpoint_target_tokens_right_3"],
643
+ "milestone_updates": derived["milestone_updates_right_3"],
644
+ "warmup_target_tokens": derived["warmup_target_tokens"],
645
+ "learning_rate": 0.0001,
646
+ "row_lr": 0.0001,
647
+ "optimizer": "adamw",
648
+ "optimizer_betas": [0.9, 0.95],
649
+ "optimizer_eps": 1e-08,
650
+ "lora_rank": 64,
651
+ "lora_alpha": 128,
652
+ "lora_dropout": 0.0,
653
+ "lora_target_modules": [
654
+ "q_proj",
655
+ "k_proj",
656
+ "v_proj",
657
+ "o_proj",
658
+ "gate_proj",
659
+ "up_proj",
660
+ "down_proj",
661
+ ],
662
+ "lora_weight_decay": 0.1,
663
+ "row_weight_decay": 0.0,
664
+ "max_grad_norm": 1.0,
665
+ "tokens_per_optimizer_update": 65536,
666
+ "packing": False,
667
+ "truncation": False,
668
+ "repeat_examples": False,
669
+ "precision": "bfloat16",
670
+ "trainable_dtype": "float32",
671
+ "gradient_checkpointing": True,
672
+ "eos_weight": 1.0,
673
+ "scheduler": "cosine_by_assistant_target_token_dose",
674
+ "worker_lr_scale": "rstar_dual_worker_v4._lr_scale",
675
+ "supervised_tail": [151643],
676
+ "trainable_token_indices": {
677
+ "embed_tokens": [151643, 151667, 151668],
678
+ "lm_head": [151643, 151667, 151668],
679
+ },
680
+ "untie_tied_embeddings": True,
681
+ "context": 32768,
682
+ "eval": {
683
+ "suite": "DEV256",
684
+ "seed": 3407,
685
+ "temperature": 0.6,
686
+ "top_p": 0.95,
687
+ "top_k": 20,
688
+ "ctx": 32768,
689
+ "stop_ids": [151643, 151645],
690
+ "base_reeval_same_mode": True,
691
+ },
692
+ },
693
+ "code": {
694
+ "path": str(WORKER),
695
+ "commit_or_sha256": worker_sha,
696
+ "prep": str(Path(__file__).resolve()),
697
+ "prep_sha256": _sha256_bytes_file(Path(__file__).resolve()),
698
+ },
699
+ "started_at": None,
700
+ "endpoint": f"2EP_ONLY @{active_2ep} assistant tokens; no checkpoint picking",
701
+ "status": "READY_NOT_STARTED",
702
+ }
703
+ (ARM / "RUN_IDENTITY.json").write_text(json.dumps(identity, indent=2, ensure_ascii=False) + "\n")
704
+
705
+ v4_launch = json.loads(V4_LAUNCH.read_text())
706
+ policy = {
707
+ "schema": "CODE_SFT_RSTAR_DUAL_TRAINING_POLICY_V1",
708
+ "status": "SEALED",
709
+ "owner_authorization": "PI 2026-09-09 Q4B-THINK-MIX Mix Distillation 0.2:0.8",
710
+ "generation_behavior_gate": None,
711
+ "arms": [
712
+ {
713
+ "arm_id": ARM_ID,
714
+ "gpu": 2,
715
+ "model_id": "qwen3-4b-base",
716
+ "source_id": "rstar-coder",
717
+ "renderer_id": "qwen3-8b-think-lcb-system-v2",
718
+ "renderer": renderer,
719
+ "renderer_authority": authority,
720
+ "model": json.loads(json.dumps(v4_policy["arms"][0]["model"])),
721
+ "data": {
722
+ "assistant_target_tokens": active_2ep,
723
+ "manifest_path": str(READY),
724
+ "manifest_file_sha256": ready_sha,
725
+ "manifest_sha256": ready_sha,
726
+ "payload_rows": two.num_rows,
727
+ "payload_sha256": sha2,
728
+ "source_revision": "3a7a0a0636ec96e3c1ec42ebe79ade467caa040d",
729
+ "max_assistant_target_tokens_per_example": 16384,
730
+ },
731
+ }
732
+ ],
733
+ "recipe": json.loads(json.dumps(v4_policy["recipe"])),
734
+ "runtime": {
735
+ "state_root": str(ARM),
736
+ "checkpoint_root": str(ARM / "out"),
737
+ },
738
+ }
739
+ policy["recipe"]["target_assistant_tokens"] = active_2ep
740
+ policy["recipe"]["warmup_target_tokens"] = derived["warmup_target_tokens"]
741
+ policy["recipe"]["checkpoint_target_tokens"] = derived["checkpoint_target_tokens_right_3"]
742
+ policy_path = ARM / "POLICY.json"
743
+ policy_path.write_text(json.dumps(policy, indent=2, sort_keys=True) + "\n")
744
+ policy_sha = sha256_file(policy_path)
745
+
746
+ job = {
747
+ "arm_id": ARM_ID,
748
+ "assistant_target_tokens": active_2ep,
749
+ "gpu": 2,
750
+ "materialized_manifest_path": str(READY),
751
+ "materialized_manifest_sha256": ready_sha,
752
+ "model_hf_id": "Qwen/Qwen3-4B-Base",
753
+ "model_revision": "906bfd4b4dc7f14ee4320094d8b41684abff8539",
754
+ "payload_sha256": sha2,
755
+ "renderer_authority_sha256": authority["sha256"],
756
+ "renderer_id": "qwen3-8b-think-lcb-system-v2",
757
+ "source_id": "rstar-coder",
758
+ }
759
+ job["job_sha256"] = document_digest(job, "job_sha256")
760
+ launch = {
761
+ "schema": "CODE_SFT_RSTAR_DUAL_LAUNCH_V1",
762
+ "status": "ATOMICALLY_RELEASED",
763
+ "run_id": RUN_ID,
764
+ "automation_policy_sha256": v4_launch["automation_policy_sha256"],
765
+ "delegation_sha256": v4_launch["delegation_sha256"],
766
+ "launch_critical_go_sha256": v4_launch["launch_critical_go_sha256"],
767
+ "release_sha256": v4_launch["release_sha256"],
768
+ "release_nonce": v4_launch["release_nonce"],
769
+ "release_claim_path": v4_launch["release_claim_path"],
770
+ "release_claim_file_sha256": v4_launch["release_claim_file_sha256"],
771
+ "evidence_path": v4_launch["evidence_path"],
772
+ "evidence_file_sha256": v4_launch["evidence_file_sha256"],
773
+ "training_policy_path": str(policy_path),
774
+ "training_policy_sha256": policy_sha,
775
+ "jobs": [job],
776
+ }
777
+ launch["launch_sha256"] = document_digest(launch, "launch_sha256")
778
+ launch_path = ARM / "control" / "LAUNCH.json"
779
+ launch_path.write_text(json.dumps(launch, indent=2, sort_keys=True) + "\n")
780
+ if document_digest(json.loads(launch_path.read_text()), "launch_sha256") != launch["launch_sha256"]:
781
+ raise SystemExit("launch digest drifted after write")
782
+ print("wrote", policy_path, policy_sha)
783
+ print("wrote", launch_path, launch["launch_sha256"])
784
+ print("PREP_OK", datetime.now(timezone.utc).isoformat())
785
+ return 0
786
+
787
+
788
+ if __name__ == "__main__":
789
+ raise SystemExit(main())
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,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "model_max_length": 131072,
24
+ "pad_token": "<|endoftext|>",
25
+ "split_special_tokens": false,
26
+ "tokenizer_class": "Qwen2Tokenizer",
27
+ "unk_token": null
28
+ }