N8Programs commited on
Commit
c179c12
·
verified ·
1 Parent(s): cd314c1

Add MLX-VLM runtime, configuration, and model card

Browse files
.gitattributes CHANGED
@@ -1,35 +1,4 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
  *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  *.safetensors filter=lfs diff=lfs merge=lfs -text
2
+ assets/loophard_four_settings.png filter=lfs diff=lfs merge=lfs -text
3
+ assets/looping_vs_gpqa.png filter=lfs diff=lfs merge=lfs -text
4
+ 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 2026 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.
README.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: mlx
3
+ license: apache-2.0
4
+ license_link: https://huggingface.co/Qwen/Qwen3.6-35B-A3B/blob/995ad96eacd98c81ed38be0c5b274b04031597b0/LICENSE
5
+ base_model:
6
+ - nvidia/Qwen3.6-35B-A3B-NVFP4
7
+ - N8Programs/Qwen3.6-35B-A3B-AntiLoop
8
+ pipeline_tag: image-text-to-text
9
+ tags:
10
+ - mlx
11
+ - mlx-vlm
12
+ - image-text-to-text
13
+ - qwen3.6
14
+ - moe
15
+ - modelopt
16
+ - quantized
17
+ - nvfp4
18
+ - fp4
19
+ - fp8
20
+ - lora
21
+ - merged
22
+ - antidoom
23
+ ---
24
+
25
+ # Qwen3.6-35B-A3B-AntiLoop-NVFP4 for MLX-VLM
26
+
27
+ ![AntiLoop looping rate versus GPQA capability](assets/looping_vs_gpqa.png)
28
+
29
+ ![LoopHard judged-loop rates across four inference settings](assets/loophard_four_settings.png)
30
+
31
+ This is the Apple-silicon MLX-VLM conversion of
32
+ [`N8Programs/Qwen3.6-35B-A3B-AntiLoop-NVFP4`](https://huggingface.co/N8Programs/Qwen3.6-35B-A3B-AntiLoop-NVFP4).
33
+ It supports both text and vision inputs, including Qwen thinking controls.
34
+
35
+ The conversion does not re-quantize the mixed NVIDIA ModelOpt language
36
+ checkpoint. Its FP8 and NVFP4 payloads and scales are re-expressed for MLX's
37
+ native MXFP8/NVFP4 kernels, while the source tensor-level scales are applied by
38
+ the included runtime. Activations remain in the model dtype. The vision tower
39
+ is the original BF16 data, byte-for-byte rather than quantized.
40
+
41
+ - 1,808 tensors across 42 safetensors shards
42
+ - 130 scaled MXFP8 dense modules
43
+ - 121 scaled NVFP4 dense modules
44
+ - 120 scaled NVFP4 expert projections
45
+ - 333 BF16 vision tensors (893,142,496 tensor-data bytes)
46
+
47
+ The checkpoint was converted and smoke-tested with `mlx==0.31.2`,
48
+ `mlx-lm==0.31.3`, and `mlx-vlm==0.6.4`.
49
+
50
+ ## Use with MLX-VLM
51
+
52
+ Install MLX-VLM and download the repository:
53
+
54
+ ```bash
55
+ pip install -U "mlx-vlm==0.6.4"
56
+ hf download mlx-community/Qwen3.6-35B-A3B-AntiLoop-NVFP4 \
57
+ --local-dir Qwen3.6-35B-A3B-AntiLoop-NVFP4
58
+ cd Qwen3.6-35B-A3B-AntiLoop-NVFP4
59
+ ```
60
+
61
+ Image + text generation:
62
+
63
+ ```bash
64
+ python run_mlx_vlm.py \
65
+ --model . \
66
+ --trust-remote-code \
67
+ --image /path/to/image.png \
68
+ --prompt "Describe this image." \
69
+ --max-tokens 256
70
+ ```
71
+
72
+ Text-only generation with thinking enabled:
73
+
74
+ ```bash
75
+ python run_mlx_vlm.py \
76
+ --model . \
77
+ --trust-remote-code \
78
+ --enable-thinking \
79
+ --prompt "Solve: 27 * 43" \
80
+ --max-tokens 512
81
+ ```
82
+
83
+ For programmatic loading from the downloaded repository:
84
+
85
+ ```python
86
+ from mlx_vlm_model_file_loader import load
87
+
88
+ model, processor = load(".")
89
+ ```
90
+
91
+ MLX-VLM 0.6.4 does not yet natively consult a model-local
92
+ `vlm_model_file`. `run_mlx_vlm.py` installs that single lookup inside the
93
+ current process without modifying the installed package. The local runtime is
94
+ executed only when `--trust-remote-code` (or `trust_remote_code=True`) is
95
+ explicitly enabled. Review the included Python files before trusting them.
96
+
97
+ An HTTP server can be started similarly:
98
+
99
+ ```bash
100
+ python run_mlx_vlm_server.py \
101
+ --model . \
102
+ --trust-remote-code \
103
+ --enable-thinking
104
+ ```
105
+
106
+ ## Original model card
107
+
108
+ This is a mixed-precision NVIDIA ModelOpt deployment checkpoint for
109
+ [`Qwen3.6-35B-A3B-AntiLoop`](https://huggingface.co/N8Programs/Qwen3.6-35B-A3B-AntiLoop),
110
+ a narrow fine-tune intended to recover from pathological self-verification and
111
+ enumeration loops while preserving ordinary long-form reasoning.
112
+
113
+ No PEFT adapter is required at inference time. The MLX conversion retains the
114
+ upstream multimodal architecture, tokenizer, chat template, and 262,144-token
115
+ native context configuration. It does not include the source checkpoint's MTP
116
+ draft weights.
117
+
118
+ ## Training data
119
+
120
+ The exact 178 masked supervised targets used for the final AntiLoop training
121
+ round are published in the
122
+ [`Qwen3.6-35B-A3B-AntiLoop-SFT` dataset](https://huggingface.co/datasets/N8Programs/Qwen3.6-35B-A3B-AntiLoop-SFT).
123
+ The dataset preserves each `loss_start_char` boundary so the pathological loop
124
+ prefix remains conditioning context rather than a supervised target. It
125
+ intentionally excludes the separately generated KL-regularization anchors.
126
+
127
+ ## Training procedure
128
+
129
+ The AntiLoop adapter was trained on the 178 masked supervised targets using a
130
+ standard supervised fine-tuning procedure, but regularized via KL-loss on separately generated non-loop anchors from the base model on everyday prompts.
131
+
132
+ ## Benchmark results
133
+
134
+ ### LoopHard
135
+
136
+ **LoopHard** is our held-out set of 285 enumeration prompts designed to elicit
137
+ futile recall, recounting, and self-verification loops. The primary metric is
138
+ **judged loops**: whether the model's reasoning trace remains stuck in a futile
139
+ cycle when generation ends.
140
+
141
+ | Model | Judged loops | Loop rate |
142
+ |---|---:|---:|
143
+ | NVIDIA NVFP4 | 72 / 285 | 25.26% |
144
+ | **AntiLoop NVFP4** | **10 / 285** | **3.51%** |
145
+ | NVIDIA NVFP4 + `presence_penalty=1.5` | 30 / 285 | 10.53% |
146
+ | **AntiLoop NVFP4 + `presence_penalty=1.5`** | **1 / 285** | **0.35%** |
147
+
148
+ The matched `presence_penalty=1.5` comparison converted all 30 control loops to
149
+ clean completions while introducing one different loop. Exact two-sided
150
+ McNemar `p = 2.98e-8`.
151
+
152
+ Generation used thinking mode, `temperature=0.7`, `top_p=0.95`, `top_k=20`, a
153
+ 6,144-token completion limit, and concurrency 24. The two
154
+ `presence_penalty=1.5` arms used the exact original and AntiLoop NVFP4
155
+ checkpoints with the same vLLM build and serving configuration: TP1, FP8 KV
156
+ cache, FlashInfer attention, Marlin NVFP4 MoE, and MTP speculative decoding
157
+ with three draft tokens.
158
+
159
+ LoopHard is judged by GLM-5.2 using a convergence-aware rubric: systematic
160
+ reasoning and verification that reaches a conclusion are not loops, and a trace
161
+ that notices its own circling and exits is classified as recovered. The
162
+ calibration set contained 42 manually labeled traces. Across three judge runs,
163
+ accuracy was 88.1%, 92.9%, and 95.2%; all three runs identified all 17 labeled
164
+ loops, with 2–5 false positives among the 25 non-loop traces.
165
+
166
+ The 285 prompts, metadata, and GLM-5.2 evaluation code are published in the
167
+ [LoopHard dataset](https://huggingface.co/datasets/N8Programs/LoopHard) on
168
+ Hugging Face.
169
+
170
+ ### Capability preservation
171
+
172
+ The capability checks below compare the same round-2 AntiLoop adapter against
173
+ its FP8 reference model under a matched runtime-LoRA setup. These runs used the
174
+ default presence penalty and should not be interpreted as evaluations of the
175
+ exact mixed-precision artifact at `presence_penalty=1.5`.
176
+
177
+ #### GPQA Diamond
178
+
179
+ | Model | Accuracy |
180
+ |---|---:|
181
+ | Qwen3.6-35B-A3B official model card | 86.0% |
182
+ | FP8 reference, our matched harness | 167 / 198 (84.34%) |
183
+ | **AntiLoop FP8, our matched harness** | **166 / 198 (83.84%)** |
184
+
185
+ The official-model-card number is included for context and was not produced by
186
+ our harness.
187
+
188
+ Our GPQA run used thinking mode, paired per-question seeds,
189
+ `temperature=0.7`, `top_p=0.95`, `top_k=20`, MTP3 speculative decoding, a
190
+ 65,536-token reasoning budget, and 4,096 tokens of answer headroom. The difference was not significant.
191
+
192
+ Source for the published 86.0% result:
193
+ [`Qwen/Qwen3.6-35B-A3B` model card](https://huggingface.co/Qwen/Qwen3.6-35B-A3B).
194
+
195
+ #### GSM8K
196
+
197
+ | Model | Accuracy |
198
+ |---|---:|
199
+ | FP8 reference | 1273 / 1319 (96.51%) |
200
+ | **AntiLoop FP8** | **1270 / 1319 (96.29%)** |
201
+
202
+ The GSM8K run used the exact 1,319-example `openai/gsm8k` `main` test split,
203
+ thinking mode, paired seeds, `temperature=0.7`, `top_p=0.95`, `top_k=20`, MTP3,
204
+ an 8,192-token reasoning budget and 1,024 tokens of answer headroom. The difference was not significant.
205
+
206
+ Taken together, the matched GPQA and GSM8K results show no material or
207
+ statistically detectable capability loss at these sample sizes. They do not
208
+ establish equivalence across other tasks, modalities, or sampling settings.
209
+
210
+ ## Original NVIDIA ModelOpt usage
211
+
212
+ Use a recent vLLM build with ModelOpt mixed-precision support:
213
+
214
+ ```bash
215
+ vllm serve N8Programs/Qwen3.6-35B-A3B-AntiLoop-NVFP4 \
216
+ --quantization modelopt \
217
+ --trust-remote-code \
218
+ --max-model-len 262144 \
219
+ --kv-cache-dtype fp8 \
220
+ --reasoning-parser qwen3
221
+ ```
222
+
223
+ MTP speculative decoding can be enabled on a compatible build with:
224
+
225
+ ```bash
226
+ --speculative-config '{"method":"mtp","num_speculative_tokens":3}'
227
+ ```
228
+
229
+ For the measured LoopHard setting, send the following sampling parameters:
230
+
231
+ ```json
232
+ {
233
+ "temperature": 0.7,
234
+ "top_p": 0.95,
235
+ "top_k": 20,
236
+ "presence_penalty": 1.5
237
+ }
238
+ ```
239
+
240
+ The capability-preservation results above used the default presence penalty;
241
+ `presence_penalty=1.5` has not yet been evaluated on GPQA or GSM8K.
242
+
243
+ Follow the
244
+ [`nvidia/Qwen3.6-35B-A3B-NVFP4` model card](https://huggingface.co/nvidia/Qwen3.6-35B-A3B-NVFP4)
245
+ for deployment requirements and the
246
+ [`Qwen/Qwen3.6-35B-A3B` model card](https://huggingface.co/Qwen/Qwen3.6-35B-A3B)
247
+ for chat templating, thinking controls, multimodal inputs, and base-model
248
+ limitations.
249
+
250
+ ## Limitations
251
+
252
+ - This is a narrow behavioral fine-tune, not a general alignment or safety model.
253
+ - The MLX conversion does not include an MTP speculative drafter.
254
+ - LoopHard is a task-specific, judge-based benchmark; its loop rate should not
255
+ be interpreted as a general safety, truthfulness, or factuality score.
256
+ - The GPQA and GSM8K checks used runtime LoRA on an FP8 base, not this exact
257
+ mixed-precision artifact.
258
+ - Capability preservation has not been tested at `presence_penalty=1.5`.
259
+ - Fixed-scale FP8 re-quantization approximates the exact BF16 LoRA merge; small
260
+ adapter updates can round away or clip at the original E4M3 range.
261
+ - Runtime validation used a 65,536-token configured context, not the full native
262
+ 262,144-token context.
263
+ - Multimodal generation quality has not been evaluated on this artifact.
264
+ - Outputs may still be incorrect, overconfident, repetitive, biased, toxic, or
265
+ unsafe.
266
+
267
+ ## License
268
+
269
+ Apache 2.0, following both the underlying Qwen checkpoint and NVIDIA's
270
+ quantized derivative. See the
271
+ [pinned Qwen license](https://huggingface.co/Qwen/Qwen3.6-35B-A3B/blob/995ad96eacd98c81ed38be0c5b274b04031597b0/LICENSE),
272
+ the [Qwen model card](https://huggingface.co/Qwen/Qwen3.6-35B-A3B), and the
273
+ [NVIDIA ModelOpt checkpoint card](https://huggingface.co/nvidia/Qwen3.6-35B-A3B-NVFP4).
274
+
275
+ (co-written with GPT-5.6-Sol)
assets/loophard_four_settings.png ADDED

Git LFS Details

  • SHA256: cd818749c8fad04b607879bda4474fd67d6a492227c0fea7b23905220f38d0e6
  • Pointer size: 131 Bytes
  • Size of remote file: 149 kB
assets/looping_vs_gpqa.png ADDED

Git LFS Details

  • SHA256: 2b67bd61bd6025c25330f9499ff1a4bb5703e7826ad330bbd1e0596df9a01586
  • Pointer size: 131 Bytes
  • Size of remote file: 165 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 (preserve_thinking is defined and preserve_thinking is true) or (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 | string if args_value is string else args_value | tojson | safe %}
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,1880 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5MoeForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "image_token_id": 248056,
7
+ "mlx_hybrid_format": {
8
+ "activations": "model_dtype_weight_only_quantized_matmul",
9
+ "format": "modelopt_fp8_nvfp4_v1",
10
+ "fp8_storage": "mxfp8_carrier_with_unit_e8m0_scales",
11
+ "nvfp4_storage": "native_e2m1_e4m3_with_output_tensor_scale",
12
+ "source_activation_scales_retained": false,
13
+ "source_quantization_config": {
14
+ "config_groups": {
15
+ "group_0": {
16
+ "input_activations": {
17
+ "dynamic": false,
18
+ "num_bits": 8,
19
+ "type": "float"
20
+ },
21
+ "targets": [
22
+ "model.language_model.layers.0.linear_attn.in_proj_qkv",
23
+ "model.language_model.layers.0.linear_attn.in_proj_z",
24
+ "model.language_model.layers.0.linear_attn.out_proj",
25
+ "model.language_model.layers.1.linear_attn.in_proj_qkv",
26
+ "model.language_model.layers.1.linear_attn.in_proj_z",
27
+ "model.language_model.layers.1.linear_attn.out_proj",
28
+ "model.language_model.layers.10.linear_attn.in_proj_qkv",
29
+ "model.language_model.layers.10.linear_attn.in_proj_z",
30
+ "model.language_model.layers.10.linear_attn.out_proj",
31
+ "model.language_model.layers.11.self_attn.k_proj",
32
+ "model.language_model.layers.11.self_attn.o_proj",
33
+ "model.language_model.layers.11.self_attn.q_proj",
34
+ "model.language_model.layers.11.self_attn.v_proj",
35
+ "model.language_model.layers.12.linear_attn.in_proj_qkv",
36
+ "model.language_model.layers.12.linear_attn.in_proj_z",
37
+ "model.language_model.layers.12.linear_attn.out_proj",
38
+ "model.language_model.layers.13.linear_attn.in_proj_qkv",
39
+ "model.language_model.layers.13.linear_attn.in_proj_z",
40
+ "model.language_model.layers.13.linear_attn.out_proj",
41
+ "model.language_model.layers.14.linear_attn.in_proj_qkv",
42
+ "model.language_model.layers.14.linear_attn.in_proj_z",
43
+ "model.language_model.layers.14.linear_attn.out_proj",
44
+ "model.language_model.layers.15.self_attn.k_proj",
45
+ "model.language_model.layers.15.self_attn.o_proj",
46
+ "model.language_model.layers.15.self_attn.q_proj",
47
+ "model.language_model.layers.15.self_attn.v_proj",
48
+ "model.language_model.layers.16.linear_attn.in_proj_qkv",
49
+ "model.language_model.layers.16.linear_attn.in_proj_z",
50
+ "model.language_model.layers.16.linear_attn.out_proj",
51
+ "model.language_model.layers.17.linear_attn.in_proj_qkv",
52
+ "model.language_model.layers.17.linear_attn.in_proj_z",
53
+ "model.language_model.layers.17.linear_attn.out_proj",
54
+ "model.language_model.layers.18.linear_attn.in_proj_qkv",
55
+ "model.language_model.layers.18.linear_attn.in_proj_z",
56
+ "model.language_model.layers.18.linear_attn.out_proj",
57
+ "model.language_model.layers.19.self_attn.k_proj",
58
+ "model.language_model.layers.19.self_attn.o_proj",
59
+ "model.language_model.layers.19.self_attn.q_proj",
60
+ "model.language_model.layers.19.self_attn.v_proj",
61
+ "model.language_model.layers.2.linear_attn.in_proj_qkv",
62
+ "model.language_model.layers.2.linear_attn.in_proj_z",
63
+ "model.language_model.layers.2.linear_attn.out_proj",
64
+ "model.language_model.layers.20.linear_attn.in_proj_qkv",
65
+ "model.language_model.layers.20.linear_attn.in_proj_z",
66
+ "model.language_model.layers.20.linear_attn.out_proj",
67
+ "model.language_model.layers.21.linear_attn.in_proj_qkv",
68
+ "model.language_model.layers.21.linear_attn.in_proj_z",
69
+ "model.language_model.layers.21.linear_attn.out_proj",
70
+ "model.language_model.layers.22.linear_attn.in_proj_qkv",
71
+ "model.language_model.layers.22.linear_attn.in_proj_z",
72
+ "model.language_model.layers.22.linear_attn.out_proj",
73
+ "model.language_model.layers.23.self_attn.k_proj",
74
+ "model.language_model.layers.23.self_attn.o_proj",
75
+ "model.language_model.layers.23.self_attn.q_proj",
76
+ "model.language_model.layers.23.self_attn.v_proj",
77
+ "model.language_model.layers.24.linear_attn.in_proj_qkv",
78
+ "model.language_model.layers.24.linear_attn.in_proj_z",
79
+ "model.language_model.layers.24.linear_attn.out_proj",
80
+ "model.language_model.layers.25.linear_attn.in_proj_qkv",
81
+ "model.language_model.layers.25.linear_attn.in_proj_z",
82
+ "model.language_model.layers.25.linear_attn.out_proj",
83
+ "model.language_model.layers.26.linear_attn.in_proj_qkv",
84
+ "model.language_model.layers.26.linear_attn.in_proj_z",
85
+ "model.language_model.layers.26.linear_attn.out_proj",
86
+ "model.language_model.layers.27.self_attn.k_proj",
87
+ "model.language_model.layers.27.self_attn.o_proj",
88
+ "model.language_model.layers.27.self_attn.q_proj",
89
+ "model.language_model.layers.27.self_attn.v_proj",
90
+ "model.language_model.layers.28.linear_attn.in_proj_qkv",
91
+ "model.language_model.layers.28.linear_attn.in_proj_z",
92
+ "model.language_model.layers.28.linear_attn.out_proj",
93
+ "model.language_model.layers.29.linear_attn.in_proj_qkv",
94
+ "model.language_model.layers.29.linear_attn.in_proj_z",
95
+ "model.language_model.layers.29.linear_attn.out_proj",
96
+ "model.language_model.layers.3.self_attn.k_proj",
97
+ "model.language_model.layers.3.self_attn.o_proj",
98
+ "model.language_model.layers.3.self_attn.q_proj",
99
+ "model.language_model.layers.3.self_attn.v_proj",
100
+ "model.language_model.layers.30.linear_attn.in_proj_qkv",
101
+ "model.language_model.layers.30.linear_attn.in_proj_z",
102
+ "model.language_model.layers.30.linear_attn.out_proj",
103
+ "model.language_model.layers.31.self_attn.k_proj",
104
+ "model.language_model.layers.31.self_attn.o_proj",
105
+ "model.language_model.layers.31.self_attn.q_proj",
106
+ "model.language_model.layers.31.self_attn.v_proj",
107
+ "model.language_model.layers.32.linear_attn.in_proj_qkv",
108
+ "model.language_model.layers.32.linear_attn.in_proj_z",
109
+ "model.language_model.layers.32.linear_attn.out_proj",
110
+ "model.language_model.layers.33.linear_attn.in_proj_qkv",
111
+ "model.language_model.layers.33.linear_attn.in_proj_z",
112
+ "model.language_model.layers.33.linear_attn.out_proj",
113
+ "model.language_model.layers.34.linear_attn.in_proj_qkv",
114
+ "model.language_model.layers.34.linear_attn.in_proj_z",
115
+ "model.language_model.layers.34.linear_attn.out_proj",
116
+ "model.language_model.layers.35.self_attn.k_proj",
117
+ "model.language_model.layers.35.self_attn.o_proj",
118
+ "model.language_model.layers.35.self_attn.q_proj",
119
+ "model.language_model.layers.35.self_attn.v_proj",
120
+ "model.language_model.layers.36.linear_attn.in_proj_qkv",
121
+ "model.language_model.layers.36.linear_attn.in_proj_z",
122
+ "model.language_model.layers.36.linear_attn.out_proj",
123
+ "model.language_model.layers.37.linear_attn.in_proj_qkv",
124
+ "model.language_model.layers.37.linear_attn.in_proj_z",
125
+ "model.language_model.layers.37.linear_attn.out_proj",
126
+ "model.language_model.layers.38.linear_attn.in_proj_qkv",
127
+ "model.language_model.layers.38.linear_attn.in_proj_z",
128
+ "model.language_model.layers.38.linear_attn.out_proj",
129
+ "model.language_model.layers.39.self_attn.k_proj",
130
+ "model.language_model.layers.39.self_attn.o_proj",
131
+ "model.language_model.layers.39.self_attn.q_proj",
132
+ "model.language_model.layers.39.self_attn.v_proj",
133
+ "model.language_model.layers.4.linear_attn.in_proj_qkv",
134
+ "model.language_model.layers.4.linear_attn.in_proj_z",
135
+ "model.language_model.layers.4.linear_attn.out_proj",
136
+ "model.language_model.layers.5.linear_attn.in_proj_qkv",
137
+ "model.language_model.layers.5.linear_attn.in_proj_z",
138
+ "model.language_model.layers.5.linear_attn.out_proj",
139
+ "model.language_model.layers.6.linear_attn.in_proj_qkv",
140
+ "model.language_model.layers.6.linear_attn.in_proj_z",
141
+ "model.language_model.layers.6.linear_attn.out_proj",
142
+ "model.language_model.layers.7.self_attn.k_proj",
143
+ "model.language_model.layers.7.self_attn.o_proj",
144
+ "model.language_model.layers.7.self_attn.q_proj",
145
+ "model.language_model.layers.7.self_attn.v_proj",
146
+ "model.language_model.layers.8.linear_attn.in_proj_qkv",
147
+ "model.language_model.layers.8.linear_attn.in_proj_z",
148
+ "model.language_model.layers.8.linear_attn.out_proj",
149
+ "model.language_model.layers.9.linear_attn.in_proj_qkv",
150
+ "model.language_model.layers.9.linear_attn.in_proj_z",
151
+ "model.language_model.layers.9.linear_attn.out_proj"
152
+ ],
153
+ "weights": {
154
+ "dynamic": false,
155
+ "num_bits": 8,
156
+ "type": "float"
157
+ }
158
+ },
159
+ "group_1": {
160
+ "input_activations": {
161
+ "dynamic": false,
162
+ "group_size": 16,
163
+ "num_bits": 4,
164
+ "type": "float"
165
+ },
166
+ "targets": [
167
+ "lm_head",
168
+ "model.language_model.layers.0.mlp.experts",
169
+ "model.language_model.layers.0.mlp.shared_expert.down_proj",
170
+ "model.language_model.layers.0.mlp.shared_expert.gate_proj",
171
+ "model.language_model.layers.0.mlp.shared_expert.up_proj",
172
+ "model.language_model.layers.1.mlp.experts",
173
+ "model.language_model.layers.1.mlp.shared_expert.down_proj",
174
+ "model.language_model.layers.1.mlp.shared_expert.gate_proj",
175
+ "model.language_model.layers.1.mlp.shared_expert.up_proj",
176
+ "model.language_model.layers.10.mlp.experts",
177
+ "model.language_model.layers.10.mlp.shared_expert.down_proj",
178
+ "model.language_model.layers.10.mlp.shared_expert.gate_proj",
179
+ "model.language_model.layers.10.mlp.shared_expert.up_proj",
180
+ "model.language_model.layers.11.mlp.experts",
181
+ "model.language_model.layers.11.mlp.shared_expert.down_proj",
182
+ "model.language_model.layers.11.mlp.shared_expert.gate_proj",
183
+ "model.language_model.layers.11.mlp.shared_expert.up_proj",
184
+ "model.language_model.layers.12.mlp.experts",
185
+ "model.language_model.layers.12.mlp.shared_expert.down_proj",
186
+ "model.language_model.layers.12.mlp.shared_expert.gate_proj",
187
+ "model.language_model.layers.12.mlp.shared_expert.up_proj",
188
+ "model.language_model.layers.13.mlp.experts",
189
+ "model.language_model.layers.13.mlp.shared_expert.down_proj",
190
+ "model.language_model.layers.13.mlp.shared_expert.gate_proj",
191
+ "model.language_model.layers.13.mlp.shared_expert.up_proj",
192
+ "model.language_model.layers.14.mlp.experts",
193
+ "model.language_model.layers.14.mlp.shared_expert.down_proj",
194
+ "model.language_model.layers.14.mlp.shared_expert.gate_proj",
195
+ "model.language_model.layers.14.mlp.shared_expert.up_proj",
196
+ "model.language_model.layers.15.mlp.experts",
197
+ "model.language_model.layers.15.mlp.shared_expert.down_proj",
198
+ "model.language_model.layers.15.mlp.shared_expert.gate_proj",
199
+ "model.language_model.layers.15.mlp.shared_expert.up_proj",
200
+ "model.language_model.layers.16.mlp.experts",
201
+ "model.language_model.layers.16.mlp.shared_expert.down_proj",
202
+ "model.language_model.layers.16.mlp.shared_expert.gate_proj",
203
+ "model.language_model.layers.16.mlp.shared_expert.up_proj",
204
+ "model.language_model.layers.17.mlp.experts",
205
+ "model.language_model.layers.17.mlp.shared_expert.down_proj",
206
+ "model.language_model.layers.17.mlp.shared_expert.gate_proj",
207
+ "model.language_model.layers.17.mlp.shared_expert.up_proj",
208
+ "model.language_model.layers.18.mlp.experts",
209
+ "model.language_model.layers.18.mlp.shared_expert.down_proj",
210
+ "model.language_model.layers.18.mlp.shared_expert.gate_proj",
211
+ "model.language_model.layers.18.mlp.shared_expert.up_proj",
212
+ "model.language_model.layers.19.mlp.experts",
213
+ "model.language_model.layers.19.mlp.shared_expert.down_proj",
214
+ "model.language_model.layers.19.mlp.shared_expert.gate_proj",
215
+ "model.language_model.layers.19.mlp.shared_expert.up_proj",
216
+ "model.language_model.layers.2.mlp.experts",
217
+ "model.language_model.layers.2.mlp.shared_expert.down_proj",
218
+ "model.language_model.layers.2.mlp.shared_expert.gate_proj",
219
+ "model.language_model.layers.2.mlp.shared_expert.up_proj",
220
+ "model.language_model.layers.20.mlp.experts",
221
+ "model.language_model.layers.20.mlp.shared_expert.down_proj",
222
+ "model.language_model.layers.20.mlp.shared_expert.gate_proj",
223
+ "model.language_model.layers.20.mlp.shared_expert.up_proj",
224
+ "model.language_model.layers.21.mlp.experts",
225
+ "model.language_model.layers.21.mlp.shared_expert.down_proj",
226
+ "model.language_model.layers.21.mlp.shared_expert.gate_proj",
227
+ "model.language_model.layers.21.mlp.shared_expert.up_proj",
228
+ "model.language_model.layers.22.mlp.experts",
229
+ "model.language_model.layers.22.mlp.shared_expert.down_proj",
230
+ "model.language_model.layers.22.mlp.shared_expert.gate_proj",
231
+ "model.language_model.layers.22.mlp.shared_expert.up_proj",
232
+ "model.language_model.layers.23.mlp.experts",
233
+ "model.language_model.layers.23.mlp.shared_expert.down_proj",
234
+ "model.language_model.layers.23.mlp.shared_expert.gate_proj",
235
+ "model.language_model.layers.23.mlp.shared_expert.up_proj",
236
+ "model.language_model.layers.24.mlp.experts",
237
+ "model.language_model.layers.24.mlp.shared_expert.down_proj",
238
+ "model.language_model.layers.24.mlp.shared_expert.gate_proj",
239
+ "model.language_model.layers.24.mlp.shared_expert.up_proj",
240
+ "model.language_model.layers.25.mlp.experts",
241
+ "model.language_model.layers.25.mlp.shared_expert.down_proj",
242
+ "model.language_model.layers.25.mlp.shared_expert.gate_proj",
243
+ "model.language_model.layers.25.mlp.shared_expert.up_proj",
244
+ "model.language_model.layers.26.mlp.experts",
245
+ "model.language_model.layers.26.mlp.shared_expert.down_proj",
246
+ "model.language_model.layers.26.mlp.shared_expert.gate_proj",
247
+ "model.language_model.layers.26.mlp.shared_expert.up_proj",
248
+ "model.language_model.layers.27.mlp.experts",
249
+ "model.language_model.layers.27.mlp.shared_expert.down_proj",
250
+ "model.language_model.layers.27.mlp.shared_expert.gate_proj",
251
+ "model.language_model.layers.27.mlp.shared_expert.up_proj",
252
+ "model.language_model.layers.28.mlp.experts",
253
+ "model.language_model.layers.28.mlp.shared_expert.down_proj",
254
+ "model.language_model.layers.28.mlp.shared_expert.gate_proj",
255
+ "model.language_model.layers.28.mlp.shared_expert.up_proj",
256
+ "model.language_model.layers.29.mlp.experts",
257
+ "model.language_model.layers.29.mlp.shared_expert.down_proj",
258
+ "model.language_model.layers.29.mlp.shared_expert.gate_proj",
259
+ "model.language_model.layers.29.mlp.shared_expert.up_proj",
260
+ "model.language_model.layers.3.mlp.experts",
261
+ "model.language_model.layers.3.mlp.shared_expert.down_proj",
262
+ "model.language_model.layers.3.mlp.shared_expert.gate_proj",
263
+ "model.language_model.layers.3.mlp.shared_expert.up_proj",
264
+ "model.language_model.layers.30.mlp.experts",
265
+ "model.language_model.layers.30.mlp.shared_expert.down_proj",
266
+ "model.language_model.layers.30.mlp.shared_expert.gate_proj",
267
+ "model.language_model.layers.30.mlp.shared_expert.up_proj",
268
+ "model.language_model.layers.31.mlp.experts",
269
+ "model.language_model.layers.31.mlp.shared_expert.down_proj",
270
+ "model.language_model.layers.31.mlp.shared_expert.gate_proj",
271
+ "model.language_model.layers.31.mlp.shared_expert.up_proj",
272
+ "model.language_model.layers.32.mlp.experts",
273
+ "model.language_model.layers.32.mlp.shared_expert.down_proj",
274
+ "model.language_model.layers.32.mlp.shared_expert.gate_proj",
275
+ "model.language_model.layers.32.mlp.shared_expert.up_proj",
276
+ "model.language_model.layers.33.mlp.experts",
277
+ "model.language_model.layers.33.mlp.shared_expert.down_proj",
278
+ "model.language_model.layers.33.mlp.shared_expert.gate_proj",
279
+ "model.language_model.layers.33.mlp.shared_expert.up_proj",
280
+ "model.language_model.layers.34.mlp.experts",
281
+ "model.language_model.layers.34.mlp.shared_expert.down_proj",
282
+ "model.language_model.layers.34.mlp.shared_expert.gate_proj",
283
+ "model.language_model.layers.34.mlp.shared_expert.up_proj",
284
+ "model.language_model.layers.35.mlp.experts",
285
+ "model.language_model.layers.35.mlp.shared_expert.down_proj",
286
+ "model.language_model.layers.35.mlp.shared_expert.gate_proj",
287
+ "model.language_model.layers.35.mlp.shared_expert.up_proj",
288
+ "model.language_model.layers.36.mlp.experts",
289
+ "model.language_model.layers.36.mlp.shared_expert.down_proj",
290
+ "model.language_model.layers.36.mlp.shared_expert.gate_proj",
291
+ "model.language_model.layers.36.mlp.shared_expert.up_proj",
292
+ "model.language_model.layers.37.mlp.experts",
293
+ "model.language_model.layers.37.mlp.shared_expert.down_proj",
294
+ "model.language_model.layers.37.mlp.shared_expert.gate_proj",
295
+ "model.language_model.layers.37.mlp.shared_expert.up_proj",
296
+ "model.language_model.layers.38.mlp.experts",
297
+ "model.language_model.layers.38.mlp.shared_expert.down_proj",
298
+ "model.language_model.layers.38.mlp.shared_expert.gate_proj",
299
+ "model.language_model.layers.38.mlp.shared_expert.up_proj",
300
+ "model.language_model.layers.39.mlp.experts",
301
+ "model.language_model.layers.39.mlp.shared_expert.down_proj",
302
+ "model.language_model.layers.39.mlp.shared_expert.gate_proj",
303
+ "model.language_model.layers.39.mlp.shared_expert.up_proj",
304
+ "model.language_model.layers.4.mlp.experts",
305
+ "model.language_model.layers.4.mlp.shared_expert.down_proj",
306
+ "model.language_model.layers.4.mlp.shared_expert.gate_proj",
307
+ "model.language_model.layers.4.mlp.shared_expert.up_proj",
308
+ "model.language_model.layers.5.mlp.experts",
309
+ "model.language_model.layers.5.mlp.shared_expert.down_proj",
310
+ "model.language_model.layers.5.mlp.shared_expert.gate_proj",
311
+ "model.language_model.layers.5.mlp.shared_expert.up_proj",
312
+ "model.language_model.layers.6.mlp.experts",
313
+ "model.language_model.layers.6.mlp.shared_expert.down_proj",
314
+ "model.language_model.layers.6.mlp.shared_expert.gate_proj",
315
+ "model.language_model.layers.6.mlp.shared_expert.up_proj",
316
+ "model.language_model.layers.7.mlp.experts",
317
+ "model.language_model.layers.7.mlp.shared_expert.down_proj",
318
+ "model.language_model.layers.7.mlp.shared_expert.gate_proj",
319
+ "model.language_model.layers.7.mlp.shared_expert.up_proj",
320
+ "model.language_model.layers.8.mlp.experts",
321
+ "model.language_model.layers.8.mlp.shared_expert.down_proj",
322
+ "model.language_model.layers.8.mlp.shared_expert.gate_proj",
323
+ "model.language_model.layers.8.mlp.shared_expert.up_proj",
324
+ "model.language_model.layers.9.mlp.experts",
325
+ "model.language_model.layers.9.mlp.shared_expert.down_proj",
326
+ "model.language_model.layers.9.mlp.shared_expert.gate_proj",
327
+ "model.language_model.layers.9.mlp.shared_expert.up_proj"
328
+ ],
329
+ "weights": {
330
+ "dynamic": false,
331
+ "group_size": 16,
332
+ "num_bits": 4,
333
+ "type": "float"
334
+ }
335
+ }
336
+ },
337
+ "ignore": [
338
+ "mtp.layers.0*",
339
+ "mtp*"
340
+ ],
341
+ "producer": {
342
+ "name": "modelopt",
343
+ "version": "0.37.0"
344
+ },
345
+ "quant_algo": "MIXED_PRECISION",
346
+ "quant_method": "modelopt",
347
+ "quantized_layers": {
348
+ "lm_head": {
349
+ "group_size": 16,
350
+ "quant_algo": "W4A16_NVFP4"
351
+ },
352
+ "model.language_model.layers.0.linear_attn.in_proj_qkv": {
353
+ "quant_algo": "FP8"
354
+ },
355
+ "model.language_model.layers.0.linear_attn.in_proj_z": {
356
+ "quant_algo": "FP8"
357
+ },
358
+ "model.language_model.layers.0.linear_attn.out_proj": {
359
+ "quant_algo": "FP8"
360
+ },
361
+ "model.language_model.layers.0.mlp.experts": {
362
+ "group_size": 16,
363
+ "quant_algo": "W4A16_NVFP4"
364
+ },
365
+ "model.language_model.layers.0.mlp.shared_expert.down_proj": {
366
+ "group_size": 16,
367
+ "quant_algo": "W4A16_NVFP4"
368
+ },
369
+ "model.language_model.layers.0.mlp.shared_expert.gate_proj": {
370
+ "group_size": 16,
371
+ "quant_algo": "W4A16_NVFP4"
372
+ },
373
+ "model.language_model.layers.0.mlp.shared_expert.up_proj": {
374
+ "group_size": 16,
375
+ "quant_algo": "W4A16_NVFP4"
376
+ },
377
+ "model.language_model.layers.1.linear_attn.in_proj_qkv": {
378
+ "quant_algo": "FP8"
379
+ },
380
+ "model.language_model.layers.1.linear_attn.in_proj_z": {
381
+ "quant_algo": "FP8"
382
+ },
383
+ "model.language_model.layers.1.linear_attn.out_proj": {
384
+ "quant_algo": "FP8"
385
+ },
386
+ "model.language_model.layers.1.mlp.experts": {
387
+ "group_size": 16,
388
+ "quant_algo": "W4A16_NVFP4"
389
+ },
390
+ "model.language_model.layers.1.mlp.shared_expert.down_proj": {
391
+ "group_size": 16,
392
+ "quant_algo": "W4A16_NVFP4"
393
+ },
394
+ "model.language_model.layers.1.mlp.shared_expert.gate_proj": {
395
+ "group_size": 16,
396
+ "quant_algo": "W4A16_NVFP4"
397
+ },
398
+ "model.language_model.layers.1.mlp.shared_expert.up_proj": {
399
+ "group_size": 16,
400
+ "quant_algo": "W4A16_NVFP4"
401
+ },
402
+ "model.language_model.layers.10.linear_attn.in_proj_qkv": {
403
+ "quant_algo": "FP8"
404
+ },
405
+ "model.language_model.layers.10.linear_attn.in_proj_z": {
406
+ "quant_algo": "FP8"
407
+ },
408
+ "model.language_model.layers.10.linear_attn.out_proj": {
409
+ "quant_algo": "FP8"
410
+ },
411
+ "model.language_model.layers.10.mlp.experts": {
412
+ "group_size": 16,
413
+ "quant_algo": "W4A16_NVFP4"
414
+ },
415
+ "model.language_model.layers.10.mlp.shared_expert.down_proj": {
416
+ "group_size": 16,
417
+ "quant_algo": "W4A16_NVFP4"
418
+ },
419
+ "model.language_model.layers.10.mlp.shared_expert.gate_proj": {
420
+ "group_size": 16,
421
+ "quant_algo": "W4A16_NVFP4"
422
+ },
423
+ "model.language_model.layers.10.mlp.shared_expert.up_proj": {
424
+ "group_size": 16,
425
+ "quant_algo": "W4A16_NVFP4"
426
+ },
427
+ "model.language_model.layers.11.mlp.experts": {
428
+ "group_size": 16,
429
+ "quant_algo": "W4A16_NVFP4"
430
+ },
431
+ "model.language_model.layers.11.mlp.shared_expert.down_proj": {
432
+ "group_size": 16,
433
+ "quant_algo": "W4A16_NVFP4"
434
+ },
435
+ "model.language_model.layers.11.mlp.shared_expert.gate_proj": {
436
+ "group_size": 16,
437
+ "quant_algo": "W4A16_NVFP4"
438
+ },
439
+ "model.language_model.layers.11.mlp.shared_expert.up_proj": {
440
+ "group_size": 16,
441
+ "quant_algo": "W4A16_NVFP4"
442
+ },
443
+ "model.language_model.layers.11.self_attn.k_proj": {
444
+ "quant_algo": "FP8"
445
+ },
446
+ "model.language_model.layers.11.self_attn.o_proj": {
447
+ "quant_algo": "FP8"
448
+ },
449
+ "model.language_model.layers.11.self_attn.q_proj": {
450
+ "quant_algo": "FP8"
451
+ },
452
+ "model.language_model.layers.11.self_attn.v_proj": {
453
+ "quant_algo": "FP8"
454
+ },
455
+ "model.language_model.layers.12.linear_attn.in_proj_qkv": {
456
+ "quant_algo": "FP8"
457
+ },
458
+ "model.language_model.layers.12.linear_attn.in_proj_z": {
459
+ "quant_algo": "FP8"
460
+ },
461
+ "model.language_model.layers.12.linear_attn.out_proj": {
462
+ "quant_algo": "FP8"
463
+ },
464
+ "model.language_model.layers.12.mlp.experts": {
465
+ "group_size": 16,
466
+ "quant_algo": "W4A16_NVFP4"
467
+ },
468
+ "model.language_model.layers.12.mlp.shared_expert.down_proj": {
469
+ "group_size": 16,
470
+ "quant_algo": "W4A16_NVFP4"
471
+ },
472
+ "model.language_model.layers.12.mlp.shared_expert.gate_proj": {
473
+ "group_size": 16,
474
+ "quant_algo": "W4A16_NVFP4"
475
+ },
476
+ "model.language_model.layers.12.mlp.shared_expert.up_proj": {
477
+ "group_size": 16,
478
+ "quant_algo": "W4A16_NVFP4"
479
+ },
480
+ "model.language_model.layers.13.linear_attn.in_proj_qkv": {
481
+ "quant_algo": "FP8"
482
+ },
483
+ "model.language_model.layers.13.linear_attn.in_proj_z": {
484
+ "quant_algo": "FP8"
485
+ },
486
+ "model.language_model.layers.13.linear_attn.out_proj": {
487
+ "quant_algo": "FP8"
488
+ },
489
+ "model.language_model.layers.13.mlp.experts": {
490
+ "group_size": 16,
491
+ "quant_algo": "W4A16_NVFP4"
492
+ },
493
+ "model.language_model.layers.13.mlp.shared_expert.down_proj": {
494
+ "group_size": 16,
495
+ "quant_algo": "W4A16_NVFP4"
496
+ },
497
+ "model.language_model.layers.13.mlp.shared_expert.gate_proj": {
498
+ "group_size": 16,
499
+ "quant_algo": "W4A16_NVFP4"
500
+ },
501
+ "model.language_model.layers.13.mlp.shared_expert.up_proj": {
502
+ "group_size": 16,
503
+ "quant_algo": "W4A16_NVFP4"
504
+ },
505
+ "model.language_model.layers.14.linear_attn.in_proj_qkv": {
506
+ "quant_algo": "FP8"
507
+ },
508
+ "model.language_model.layers.14.linear_attn.in_proj_z": {
509
+ "quant_algo": "FP8"
510
+ },
511
+ "model.language_model.layers.14.linear_attn.out_proj": {
512
+ "quant_algo": "FP8"
513
+ },
514
+ "model.language_model.layers.14.mlp.experts": {
515
+ "group_size": 16,
516
+ "quant_algo": "W4A16_NVFP4"
517
+ },
518
+ "model.language_model.layers.14.mlp.shared_expert.down_proj": {
519
+ "group_size": 16,
520
+ "quant_algo": "W4A16_NVFP4"
521
+ },
522
+ "model.language_model.layers.14.mlp.shared_expert.gate_proj": {
523
+ "group_size": 16,
524
+ "quant_algo": "W4A16_NVFP4"
525
+ },
526
+ "model.language_model.layers.14.mlp.shared_expert.up_proj": {
527
+ "group_size": 16,
528
+ "quant_algo": "W4A16_NVFP4"
529
+ },
530
+ "model.language_model.layers.15.mlp.experts": {
531
+ "group_size": 16,
532
+ "quant_algo": "W4A16_NVFP4"
533
+ },
534
+ "model.language_model.layers.15.mlp.shared_expert.down_proj": {
535
+ "group_size": 16,
536
+ "quant_algo": "W4A16_NVFP4"
537
+ },
538
+ "model.language_model.layers.15.mlp.shared_expert.gate_proj": {
539
+ "group_size": 16,
540
+ "quant_algo": "W4A16_NVFP4"
541
+ },
542
+ "model.language_model.layers.15.mlp.shared_expert.up_proj": {
543
+ "group_size": 16,
544
+ "quant_algo": "W4A16_NVFP4"
545
+ },
546
+ "model.language_model.layers.15.self_attn.k_proj": {
547
+ "quant_algo": "FP8"
548
+ },
549
+ "model.language_model.layers.15.self_attn.o_proj": {
550
+ "quant_algo": "FP8"
551
+ },
552
+ "model.language_model.layers.15.self_attn.q_proj": {
553
+ "quant_algo": "FP8"
554
+ },
555
+ "model.language_model.layers.15.self_attn.v_proj": {
556
+ "quant_algo": "FP8"
557
+ },
558
+ "model.language_model.layers.16.linear_attn.in_proj_qkv": {
559
+ "quant_algo": "FP8"
560
+ },
561
+ "model.language_model.layers.16.linear_attn.in_proj_z": {
562
+ "quant_algo": "FP8"
563
+ },
564
+ "model.language_model.layers.16.linear_attn.out_proj": {
565
+ "quant_algo": "FP8"
566
+ },
567
+ "model.language_model.layers.16.mlp.experts": {
568
+ "group_size": 16,
569
+ "quant_algo": "W4A16_NVFP4"
570
+ },
571
+ "model.language_model.layers.16.mlp.shared_expert.down_proj": {
572
+ "group_size": 16,
573
+ "quant_algo": "W4A16_NVFP4"
574
+ },
575
+ "model.language_model.layers.16.mlp.shared_expert.gate_proj": {
576
+ "group_size": 16,
577
+ "quant_algo": "W4A16_NVFP4"
578
+ },
579
+ "model.language_model.layers.16.mlp.shared_expert.up_proj": {
580
+ "group_size": 16,
581
+ "quant_algo": "W4A16_NVFP4"
582
+ },
583
+ "model.language_model.layers.17.linear_attn.in_proj_qkv": {
584
+ "quant_algo": "FP8"
585
+ },
586
+ "model.language_model.layers.17.linear_attn.in_proj_z": {
587
+ "quant_algo": "FP8"
588
+ },
589
+ "model.language_model.layers.17.linear_attn.out_proj": {
590
+ "quant_algo": "FP8"
591
+ },
592
+ "model.language_model.layers.17.mlp.experts": {
593
+ "group_size": 16,
594
+ "quant_algo": "W4A16_NVFP4"
595
+ },
596
+ "model.language_model.layers.17.mlp.shared_expert.down_proj": {
597
+ "group_size": 16,
598
+ "quant_algo": "W4A16_NVFP4"
599
+ },
600
+ "model.language_model.layers.17.mlp.shared_expert.gate_proj": {
601
+ "group_size": 16,
602
+ "quant_algo": "W4A16_NVFP4"
603
+ },
604
+ "model.language_model.layers.17.mlp.shared_expert.up_proj": {
605
+ "group_size": 16,
606
+ "quant_algo": "W4A16_NVFP4"
607
+ },
608
+ "model.language_model.layers.18.linear_attn.in_proj_qkv": {
609
+ "quant_algo": "FP8"
610
+ },
611
+ "model.language_model.layers.18.linear_attn.in_proj_z": {
612
+ "quant_algo": "FP8"
613
+ },
614
+ "model.language_model.layers.18.linear_attn.out_proj": {
615
+ "quant_algo": "FP8"
616
+ },
617
+ "model.language_model.layers.18.mlp.experts": {
618
+ "group_size": 16,
619
+ "quant_algo": "W4A16_NVFP4"
620
+ },
621
+ "model.language_model.layers.18.mlp.shared_expert.down_proj": {
622
+ "group_size": 16,
623
+ "quant_algo": "W4A16_NVFP4"
624
+ },
625
+ "model.language_model.layers.18.mlp.shared_expert.gate_proj": {
626
+ "group_size": 16,
627
+ "quant_algo": "W4A16_NVFP4"
628
+ },
629
+ "model.language_model.layers.18.mlp.shared_expert.up_proj": {
630
+ "group_size": 16,
631
+ "quant_algo": "W4A16_NVFP4"
632
+ },
633
+ "model.language_model.layers.19.mlp.experts": {
634
+ "group_size": 16,
635
+ "quant_algo": "W4A16_NVFP4"
636
+ },
637
+ "model.language_model.layers.19.mlp.shared_expert.down_proj": {
638
+ "group_size": 16,
639
+ "quant_algo": "W4A16_NVFP4"
640
+ },
641
+ "model.language_model.layers.19.mlp.shared_expert.gate_proj": {
642
+ "group_size": 16,
643
+ "quant_algo": "W4A16_NVFP4"
644
+ },
645
+ "model.language_model.layers.19.mlp.shared_expert.up_proj": {
646
+ "group_size": 16,
647
+ "quant_algo": "W4A16_NVFP4"
648
+ },
649
+ "model.language_model.layers.19.self_attn.k_proj": {
650
+ "quant_algo": "FP8"
651
+ },
652
+ "model.language_model.layers.19.self_attn.o_proj": {
653
+ "quant_algo": "FP8"
654
+ },
655
+ "model.language_model.layers.19.self_attn.q_proj": {
656
+ "quant_algo": "FP8"
657
+ },
658
+ "model.language_model.layers.19.self_attn.v_proj": {
659
+ "quant_algo": "FP8"
660
+ },
661
+ "model.language_model.layers.2.linear_attn.in_proj_qkv": {
662
+ "quant_algo": "FP8"
663
+ },
664
+ "model.language_model.layers.2.linear_attn.in_proj_z": {
665
+ "quant_algo": "FP8"
666
+ },
667
+ "model.language_model.layers.2.linear_attn.out_proj": {
668
+ "quant_algo": "FP8"
669
+ },
670
+ "model.language_model.layers.2.mlp.experts": {
671
+ "group_size": 16,
672
+ "quant_algo": "W4A16_NVFP4"
673
+ },
674
+ "model.language_model.layers.2.mlp.shared_expert.down_proj": {
675
+ "group_size": 16,
676
+ "quant_algo": "W4A16_NVFP4"
677
+ },
678
+ "model.language_model.layers.2.mlp.shared_expert.gate_proj": {
679
+ "group_size": 16,
680
+ "quant_algo": "W4A16_NVFP4"
681
+ },
682
+ "model.language_model.layers.2.mlp.shared_expert.up_proj": {
683
+ "group_size": 16,
684
+ "quant_algo": "W4A16_NVFP4"
685
+ },
686
+ "model.language_model.layers.20.linear_attn.in_proj_qkv": {
687
+ "quant_algo": "FP8"
688
+ },
689
+ "model.language_model.layers.20.linear_attn.in_proj_z": {
690
+ "quant_algo": "FP8"
691
+ },
692
+ "model.language_model.layers.20.linear_attn.out_proj": {
693
+ "quant_algo": "FP8"
694
+ },
695
+ "model.language_model.layers.20.mlp.experts": {
696
+ "group_size": 16,
697
+ "quant_algo": "W4A16_NVFP4"
698
+ },
699
+ "model.language_model.layers.20.mlp.shared_expert.down_proj": {
700
+ "group_size": 16,
701
+ "quant_algo": "W4A16_NVFP4"
702
+ },
703
+ "model.language_model.layers.20.mlp.shared_expert.gate_proj": {
704
+ "group_size": 16,
705
+ "quant_algo": "W4A16_NVFP4"
706
+ },
707
+ "model.language_model.layers.20.mlp.shared_expert.up_proj": {
708
+ "group_size": 16,
709
+ "quant_algo": "W4A16_NVFP4"
710
+ },
711
+ "model.language_model.layers.21.linear_attn.in_proj_qkv": {
712
+ "quant_algo": "FP8"
713
+ },
714
+ "model.language_model.layers.21.linear_attn.in_proj_z": {
715
+ "quant_algo": "FP8"
716
+ },
717
+ "model.language_model.layers.21.linear_attn.out_proj": {
718
+ "quant_algo": "FP8"
719
+ },
720
+ "model.language_model.layers.21.mlp.experts": {
721
+ "group_size": 16,
722
+ "quant_algo": "W4A16_NVFP4"
723
+ },
724
+ "model.language_model.layers.21.mlp.shared_expert.down_proj": {
725
+ "group_size": 16,
726
+ "quant_algo": "W4A16_NVFP4"
727
+ },
728
+ "model.language_model.layers.21.mlp.shared_expert.gate_proj": {
729
+ "group_size": 16,
730
+ "quant_algo": "W4A16_NVFP4"
731
+ },
732
+ "model.language_model.layers.21.mlp.shared_expert.up_proj": {
733
+ "group_size": 16,
734
+ "quant_algo": "W4A16_NVFP4"
735
+ },
736
+ "model.language_model.layers.22.linear_attn.in_proj_qkv": {
737
+ "quant_algo": "FP8"
738
+ },
739
+ "model.language_model.layers.22.linear_attn.in_proj_z": {
740
+ "quant_algo": "FP8"
741
+ },
742
+ "model.language_model.layers.22.linear_attn.out_proj": {
743
+ "quant_algo": "FP8"
744
+ },
745
+ "model.language_model.layers.22.mlp.experts": {
746
+ "group_size": 16,
747
+ "quant_algo": "W4A16_NVFP4"
748
+ },
749
+ "model.language_model.layers.22.mlp.shared_expert.down_proj": {
750
+ "group_size": 16,
751
+ "quant_algo": "W4A16_NVFP4"
752
+ },
753
+ "model.language_model.layers.22.mlp.shared_expert.gate_proj": {
754
+ "group_size": 16,
755
+ "quant_algo": "W4A16_NVFP4"
756
+ },
757
+ "model.language_model.layers.22.mlp.shared_expert.up_proj": {
758
+ "group_size": 16,
759
+ "quant_algo": "W4A16_NVFP4"
760
+ },
761
+ "model.language_model.layers.23.mlp.experts": {
762
+ "group_size": 16,
763
+ "quant_algo": "W4A16_NVFP4"
764
+ },
765
+ "model.language_model.layers.23.mlp.shared_expert.down_proj": {
766
+ "group_size": 16,
767
+ "quant_algo": "W4A16_NVFP4"
768
+ },
769
+ "model.language_model.layers.23.mlp.shared_expert.gate_proj": {
770
+ "group_size": 16,
771
+ "quant_algo": "W4A16_NVFP4"
772
+ },
773
+ "model.language_model.layers.23.mlp.shared_expert.up_proj": {
774
+ "group_size": 16,
775
+ "quant_algo": "W4A16_NVFP4"
776
+ },
777
+ "model.language_model.layers.23.self_attn.k_proj": {
778
+ "quant_algo": "FP8"
779
+ },
780
+ "model.language_model.layers.23.self_attn.o_proj": {
781
+ "quant_algo": "FP8"
782
+ },
783
+ "model.language_model.layers.23.self_attn.q_proj": {
784
+ "quant_algo": "FP8"
785
+ },
786
+ "model.language_model.layers.23.self_attn.v_proj": {
787
+ "quant_algo": "FP8"
788
+ },
789
+ "model.language_model.layers.24.linear_attn.in_proj_qkv": {
790
+ "quant_algo": "FP8"
791
+ },
792
+ "model.language_model.layers.24.linear_attn.in_proj_z": {
793
+ "quant_algo": "FP8"
794
+ },
795
+ "model.language_model.layers.24.linear_attn.out_proj": {
796
+ "quant_algo": "FP8"
797
+ },
798
+ "model.language_model.layers.24.mlp.experts": {
799
+ "group_size": 16,
800
+ "quant_algo": "W4A16_NVFP4"
801
+ },
802
+ "model.language_model.layers.24.mlp.shared_expert.down_proj": {
803
+ "group_size": 16,
804
+ "quant_algo": "W4A16_NVFP4"
805
+ },
806
+ "model.language_model.layers.24.mlp.shared_expert.gate_proj": {
807
+ "group_size": 16,
808
+ "quant_algo": "W4A16_NVFP4"
809
+ },
810
+ "model.language_model.layers.24.mlp.shared_expert.up_proj": {
811
+ "group_size": 16,
812
+ "quant_algo": "W4A16_NVFP4"
813
+ },
814
+ "model.language_model.layers.25.linear_attn.in_proj_qkv": {
815
+ "quant_algo": "FP8"
816
+ },
817
+ "model.language_model.layers.25.linear_attn.in_proj_z": {
818
+ "quant_algo": "FP8"
819
+ },
820
+ "model.language_model.layers.25.linear_attn.out_proj": {
821
+ "quant_algo": "FP8"
822
+ },
823
+ "model.language_model.layers.25.mlp.experts": {
824
+ "group_size": 16,
825
+ "quant_algo": "W4A16_NVFP4"
826
+ },
827
+ "model.language_model.layers.25.mlp.shared_expert.down_proj": {
828
+ "group_size": 16,
829
+ "quant_algo": "W4A16_NVFP4"
830
+ },
831
+ "model.language_model.layers.25.mlp.shared_expert.gate_proj": {
832
+ "group_size": 16,
833
+ "quant_algo": "W4A16_NVFP4"
834
+ },
835
+ "model.language_model.layers.25.mlp.shared_expert.up_proj": {
836
+ "group_size": 16,
837
+ "quant_algo": "W4A16_NVFP4"
838
+ },
839
+ "model.language_model.layers.26.linear_attn.in_proj_qkv": {
840
+ "quant_algo": "FP8"
841
+ },
842
+ "model.language_model.layers.26.linear_attn.in_proj_z": {
843
+ "quant_algo": "FP8"
844
+ },
845
+ "model.language_model.layers.26.linear_attn.out_proj": {
846
+ "quant_algo": "FP8"
847
+ },
848
+ "model.language_model.layers.26.mlp.experts": {
849
+ "group_size": 16,
850
+ "quant_algo": "W4A16_NVFP4"
851
+ },
852
+ "model.language_model.layers.26.mlp.shared_expert.down_proj": {
853
+ "group_size": 16,
854
+ "quant_algo": "W4A16_NVFP4"
855
+ },
856
+ "model.language_model.layers.26.mlp.shared_expert.gate_proj": {
857
+ "group_size": 16,
858
+ "quant_algo": "W4A16_NVFP4"
859
+ },
860
+ "model.language_model.layers.26.mlp.shared_expert.up_proj": {
861
+ "group_size": 16,
862
+ "quant_algo": "W4A16_NVFP4"
863
+ },
864
+ "model.language_model.layers.27.mlp.experts": {
865
+ "group_size": 16,
866
+ "quant_algo": "W4A16_NVFP4"
867
+ },
868
+ "model.language_model.layers.27.mlp.shared_expert.down_proj": {
869
+ "group_size": 16,
870
+ "quant_algo": "W4A16_NVFP4"
871
+ },
872
+ "model.language_model.layers.27.mlp.shared_expert.gate_proj": {
873
+ "group_size": 16,
874
+ "quant_algo": "W4A16_NVFP4"
875
+ },
876
+ "model.language_model.layers.27.mlp.shared_expert.up_proj": {
877
+ "group_size": 16,
878
+ "quant_algo": "W4A16_NVFP4"
879
+ },
880
+ "model.language_model.layers.27.self_attn.k_proj": {
881
+ "quant_algo": "FP8"
882
+ },
883
+ "model.language_model.layers.27.self_attn.o_proj": {
884
+ "quant_algo": "FP8"
885
+ },
886
+ "model.language_model.layers.27.self_attn.q_proj": {
887
+ "quant_algo": "FP8"
888
+ },
889
+ "model.language_model.layers.27.self_attn.v_proj": {
890
+ "quant_algo": "FP8"
891
+ },
892
+ "model.language_model.layers.28.linear_attn.in_proj_qkv": {
893
+ "quant_algo": "FP8"
894
+ },
895
+ "model.language_model.layers.28.linear_attn.in_proj_z": {
896
+ "quant_algo": "FP8"
897
+ },
898
+ "model.language_model.layers.28.linear_attn.out_proj": {
899
+ "quant_algo": "FP8"
900
+ },
901
+ "model.language_model.layers.28.mlp.experts": {
902
+ "group_size": 16,
903
+ "quant_algo": "W4A16_NVFP4"
904
+ },
905
+ "model.language_model.layers.28.mlp.shared_expert.down_proj": {
906
+ "group_size": 16,
907
+ "quant_algo": "W4A16_NVFP4"
908
+ },
909
+ "model.language_model.layers.28.mlp.shared_expert.gate_proj": {
910
+ "group_size": 16,
911
+ "quant_algo": "W4A16_NVFP4"
912
+ },
913
+ "model.language_model.layers.28.mlp.shared_expert.up_proj": {
914
+ "group_size": 16,
915
+ "quant_algo": "W4A16_NVFP4"
916
+ },
917
+ "model.language_model.layers.29.linear_attn.in_proj_qkv": {
918
+ "quant_algo": "FP8"
919
+ },
920
+ "model.language_model.layers.29.linear_attn.in_proj_z": {
921
+ "quant_algo": "FP8"
922
+ },
923
+ "model.language_model.layers.29.linear_attn.out_proj": {
924
+ "quant_algo": "FP8"
925
+ },
926
+ "model.language_model.layers.29.mlp.experts": {
927
+ "group_size": 16,
928
+ "quant_algo": "W4A16_NVFP4"
929
+ },
930
+ "model.language_model.layers.29.mlp.shared_expert.down_proj": {
931
+ "group_size": 16,
932
+ "quant_algo": "W4A16_NVFP4"
933
+ },
934
+ "model.language_model.layers.29.mlp.shared_expert.gate_proj": {
935
+ "group_size": 16,
936
+ "quant_algo": "W4A16_NVFP4"
937
+ },
938
+ "model.language_model.layers.29.mlp.shared_expert.up_proj": {
939
+ "group_size": 16,
940
+ "quant_algo": "W4A16_NVFP4"
941
+ },
942
+ "model.language_model.layers.3.mlp.experts": {
943
+ "group_size": 16,
944
+ "quant_algo": "W4A16_NVFP4"
945
+ },
946
+ "model.language_model.layers.3.mlp.shared_expert.down_proj": {
947
+ "group_size": 16,
948
+ "quant_algo": "W4A16_NVFP4"
949
+ },
950
+ "model.language_model.layers.3.mlp.shared_expert.gate_proj": {
951
+ "group_size": 16,
952
+ "quant_algo": "W4A16_NVFP4"
953
+ },
954
+ "model.language_model.layers.3.mlp.shared_expert.up_proj": {
955
+ "group_size": 16,
956
+ "quant_algo": "W4A16_NVFP4"
957
+ },
958
+ "model.language_model.layers.3.self_attn.k_proj": {
959
+ "quant_algo": "FP8"
960
+ },
961
+ "model.language_model.layers.3.self_attn.o_proj": {
962
+ "quant_algo": "FP8"
963
+ },
964
+ "model.language_model.layers.3.self_attn.q_proj": {
965
+ "quant_algo": "FP8"
966
+ },
967
+ "model.language_model.layers.3.self_attn.v_proj": {
968
+ "quant_algo": "FP8"
969
+ },
970
+ "model.language_model.layers.30.linear_attn.in_proj_qkv": {
971
+ "quant_algo": "FP8"
972
+ },
973
+ "model.language_model.layers.30.linear_attn.in_proj_z": {
974
+ "quant_algo": "FP8"
975
+ },
976
+ "model.language_model.layers.30.linear_attn.out_proj": {
977
+ "quant_algo": "FP8"
978
+ },
979
+ "model.language_model.layers.30.mlp.experts": {
980
+ "group_size": 16,
981
+ "quant_algo": "W4A16_NVFP4"
982
+ },
983
+ "model.language_model.layers.30.mlp.shared_expert.down_proj": {
984
+ "group_size": 16,
985
+ "quant_algo": "W4A16_NVFP4"
986
+ },
987
+ "model.language_model.layers.30.mlp.shared_expert.gate_proj": {
988
+ "group_size": 16,
989
+ "quant_algo": "W4A16_NVFP4"
990
+ },
991
+ "model.language_model.layers.30.mlp.shared_expert.up_proj": {
992
+ "group_size": 16,
993
+ "quant_algo": "W4A16_NVFP4"
994
+ },
995
+ "model.language_model.layers.31.mlp.experts": {
996
+ "group_size": 16,
997
+ "quant_algo": "W4A16_NVFP4"
998
+ },
999
+ "model.language_model.layers.31.mlp.shared_expert.down_proj": {
1000
+ "group_size": 16,
1001
+ "quant_algo": "W4A16_NVFP4"
1002
+ },
1003
+ "model.language_model.layers.31.mlp.shared_expert.gate_proj": {
1004
+ "group_size": 16,
1005
+ "quant_algo": "W4A16_NVFP4"
1006
+ },
1007
+ "model.language_model.layers.31.mlp.shared_expert.up_proj": {
1008
+ "group_size": 16,
1009
+ "quant_algo": "W4A16_NVFP4"
1010
+ },
1011
+ "model.language_model.layers.31.self_attn.k_proj": {
1012
+ "quant_algo": "FP8"
1013
+ },
1014
+ "model.language_model.layers.31.self_attn.o_proj": {
1015
+ "quant_algo": "FP8"
1016
+ },
1017
+ "model.language_model.layers.31.self_attn.q_proj": {
1018
+ "quant_algo": "FP8"
1019
+ },
1020
+ "model.language_model.layers.31.self_attn.v_proj": {
1021
+ "quant_algo": "FP8"
1022
+ },
1023
+ "model.language_model.layers.32.linear_attn.in_proj_qkv": {
1024
+ "quant_algo": "FP8"
1025
+ },
1026
+ "model.language_model.layers.32.linear_attn.in_proj_z": {
1027
+ "quant_algo": "FP8"
1028
+ },
1029
+ "model.language_model.layers.32.linear_attn.out_proj": {
1030
+ "quant_algo": "FP8"
1031
+ },
1032
+ "model.language_model.layers.32.mlp.experts": {
1033
+ "group_size": 16,
1034
+ "quant_algo": "W4A16_NVFP4"
1035
+ },
1036
+ "model.language_model.layers.32.mlp.shared_expert.down_proj": {
1037
+ "group_size": 16,
1038
+ "quant_algo": "W4A16_NVFP4"
1039
+ },
1040
+ "model.language_model.layers.32.mlp.shared_expert.gate_proj": {
1041
+ "group_size": 16,
1042
+ "quant_algo": "W4A16_NVFP4"
1043
+ },
1044
+ "model.language_model.layers.32.mlp.shared_expert.up_proj": {
1045
+ "group_size": 16,
1046
+ "quant_algo": "W4A16_NVFP4"
1047
+ },
1048
+ "model.language_model.layers.33.linear_attn.in_proj_qkv": {
1049
+ "quant_algo": "FP8"
1050
+ },
1051
+ "model.language_model.layers.33.linear_attn.in_proj_z": {
1052
+ "quant_algo": "FP8"
1053
+ },
1054
+ "model.language_model.layers.33.linear_attn.out_proj": {
1055
+ "quant_algo": "FP8"
1056
+ },
1057
+ "model.language_model.layers.33.mlp.experts": {
1058
+ "group_size": 16,
1059
+ "quant_algo": "W4A16_NVFP4"
1060
+ },
1061
+ "model.language_model.layers.33.mlp.shared_expert.down_proj": {
1062
+ "group_size": 16,
1063
+ "quant_algo": "W4A16_NVFP4"
1064
+ },
1065
+ "model.language_model.layers.33.mlp.shared_expert.gate_proj": {
1066
+ "group_size": 16,
1067
+ "quant_algo": "W4A16_NVFP4"
1068
+ },
1069
+ "model.language_model.layers.33.mlp.shared_expert.up_proj": {
1070
+ "group_size": 16,
1071
+ "quant_algo": "W4A16_NVFP4"
1072
+ },
1073
+ "model.language_model.layers.34.linear_attn.in_proj_qkv": {
1074
+ "quant_algo": "FP8"
1075
+ },
1076
+ "model.language_model.layers.34.linear_attn.in_proj_z": {
1077
+ "quant_algo": "FP8"
1078
+ },
1079
+ "model.language_model.layers.34.linear_attn.out_proj": {
1080
+ "quant_algo": "FP8"
1081
+ },
1082
+ "model.language_model.layers.34.mlp.experts": {
1083
+ "group_size": 16,
1084
+ "quant_algo": "W4A16_NVFP4"
1085
+ },
1086
+ "model.language_model.layers.34.mlp.shared_expert.down_proj": {
1087
+ "group_size": 16,
1088
+ "quant_algo": "W4A16_NVFP4"
1089
+ },
1090
+ "model.language_model.layers.34.mlp.shared_expert.gate_proj": {
1091
+ "group_size": 16,
1092
+ "quant_algo": "W4A16_NVFP4"
1093
+ },
1094
+ "model.language_model.layers.34.mlp.shared_expert.up_proj": {
1095
+ "group_size": 16,
1096
+ "quant_algo": "W4A16_NVFP4"
1097
+ },
1098
+ "model.language_model.layers.35.mlp.experts": {
1099
+ "group_size": 16,
1100
+ "quant_algo": "W4A16_NVFP4"
1101
+ },
1102
+ "model.language_model.layers.35.mlp.shared_expert.down_proj": {
1103
+ "group_size": 16,
1104
+ "quant_algo": "W4A16_NVFP4"
1105
+ },
1106
+ "model.language_model.layers.35.mlp.shared_expert.gate_proj": {
1107
+ "group_size": 16,
1108
+ "quant_algo": "W4A16_NVFP4"
1109
+ },
1110
+ "model.language_model.layers.35.mlp.shared_expert.up_proj": {
1111
+ "group_size": 16,
1112
+ "quant_algo": "W4A16_NVFP4"
1113
+ },
1114
+ "model.language_model.layers.35.self_attn.k_proj": {
1115
+ "quant_algo": "FP8"
1116
+ },
1117
+ "model.language_model.layers.35.self_attn.o_proj": {
1118
+ "quant_algo": "FP8"
1119
+ },
1120
+ "model.language_model.layers.35.self_attn.q_proj": {
1121
+ "quant_algo": "FP8"
1122
+ },
1123
+ "model.language_model.layers.35.self_attn.v_proj": {
1124
+ "quant_algo": "FP8"
1125
+ },
1126
+ "model.language_model.layers.36.linear_attn.in_proj_qkv": {
1127
+ "quant_algo": "FP8"
1128
+ },
1129
+ "model.language_model.layers.36.linear_attn.in_proj_z": {
1130
+ "quant_algo": "FP8"
1131
+ },
1132
+ "model.language_model.layers.36.linear_attn.out_proj": {
1133
+ "quant_algo": "FP8"
1134
+ },
1135
+ "model.language_model.layers.36.mlp.experts": {
1136
+ "group_size": 16,
1137
+ "quant_algo": "W4A16_NVFP4"
1138
+ },
1139
+ "model.language_model.layers.36.mlp.shared_expert.down_proj": {
1140
+ "group_size": 16,
1141
+ "quant_algo": "W4A16_NVFP4"
1142
+ },
1143
+ "model.language_model.layers.36.mlp.shared_expert.gate_proj": {
1144
+ "group_size": 16,
1145
+ "quant_algo": "W4A16_NVFP4"
1146
+ },
1147
+ "model.language_model.layers.36.mlp.shared_expert.up_proj": {
1148
+ "group_size": 16,
1149
+ "quant_algo": "W4A16_NVFP4"
1150
+ },
1151
+ "model.language_model.layers.37.linear_attn.in_proj_qkv": {
1152
+ "quant_algo": "FP8"
1153
+ },
1154
+ "model.language_model.layers.37.linear_attn.in_proj_z": {
1155
+ "quant_algo": "FP8"
1156
+ },
1157
+ "model.language_model.layers.37.linear_attn.out_proj": {
1158
+ "quant_algo": "FP8"
1159
+ },
1160
+ "model.language_model.layers.37.mlp.experts": {
1161
+ "group_size": 16,
1162
+ "quant_algo": "W4A16_NVFP4"
1163
+ },
1164
+ "model.language_model.layers.37.mlp.shared_expert.down_proj": {
1165
+ "group_size": 16,
1166
+ "quant_algo": "W4A16_NVFP4"
1167
+ },
1168
+ "model.language_model.layers.37.mlp.shared_expert.gate_proj": {
1169
+ "group_size": 16,
1170
+ "quant_algo": "W4A16_NVFP4"
1171
+ },
1172
+ "model.language_model.layers.37.mlp.shared_expert.up_proj": {
1173
+ "group_size": 16,
1174
+ "quant_algo": "W4A16_NVFP4"
1175
+ },
1176
+ "model.language_model.layers.38.linear_attn.in_proj_qkv": {
1177
+ "quant_algo": "FP8"
1178
+ },
1179
+ "model.language_model.layers.38.linear_attn.in_proj_z": {
1180
+ "quant_algo": "FP8"
1181
+ },
1182
+ "model.language_model.layers.38.linear_attn.out_proj": {
1183
+ "quant_algo": "FP8"
1184
+ },
1185
+ "model.language_model.layers.38.mlp.experts": {
1186
+ "group_size": 16,
1187
+ "quant_algo": "W4A16_NVFP4"
1188
+ },
1189
+ "model.language_model.layers.38.mlp.shared_expert.down_proj": {
1190
+ "group_size": 16,
1191
+ "quant_algo": "W4A16_NVFP4"
1192
+ },
1193
+ "model.language_model.layers.38.mlp.shared_expert.gate_proj": {
1194
+ "group_size": 16,
1195
+ "quant_algo": "W4A16_NVFP4"
1196
+ },
1197
+ "model.language_model.layers.38.mlp.shared_expert.up_proj": {
1198
+ "group_size": 16,
1199
+ "quant_algo": "W4A16_NVFP4"
1200
+ },
1201
+ "model.language_model.layers.39.mlp.experts": {
1202
+ "group_size": 16,
1203
+ "quant_algo": "W4A16_NVFP4"
1204
+ },
1205
+ "model.language_model.layers.39.mlp.shared_expert.down_proj": {
1206
+ "group_size": 16,
1207
+ "quant_algo": "W4A16_NVFP4"
1208
+ },
1209
+ "model.language_model.layers.39.mlp.shared_expert.gate_proj": {
1210
+ "group_size": 16,
1211
+ "quant_algo": "W4A16_NVFP4"
1212
+ },
1213
+ "model.language_model.layers.39.mlp.shared_expert.up_proj": {
1214
+ "group_size": 16,
1215
+ "quant_algo": "W4A16_NVFP4"
1216
+ },
1217
+ "model.language_model.layers.39.self_attn.k_proj": {
1218
+ "quant_algo": "FP8"
1219
+ },
1220
+ "model.language_model.layers.39.self_attn.o_proj": {
1221
+ "quant_algo": "FP8"
1222
+ },
1223
+ "model.language_model.layers.39.self_attn.q_proj": {
1224
+ "quant_algo": "FP8"
1225
+ },
1226
+ "model.language_model.layers.39.self_attn.v_proj": {
1227
+ "quant_algo": "FP8"
1228
+ },
1229
+ "model.language_model.layers.4.linear_attn.in_proj_qkv": {
1230
+ "quant_algo": "FP8"
1231
+ },
1232
+ "model.language_model.layers.4.linear_attn.in_proj_z": {
1233
+ "quant_algo": "FP8"
1234
+ },
1235
+ "model.language_model.layers.4.linear_attn.out_proj": {
1236
+ "quant_algo": "FP8"
1237
+ },
1238
+ "model.language_model.layers.4.mlp.experts": {
1239
+ "group_size": 16,
1240
+ "quant_algo": "W4A16_NVFP4"
1241
+ },
1242
+ "model.language_model.layers.4.mlp.shared_expert.down_proj": {
1243
+ "group_size": 16,
1244
+ "quant_algo": "W4A16_NVFP4"
1245
+ },
1246
+ "model.language_model.layers.4.mlp.shared_expert.gate_proj": {
1247
+ "group_size": 16,
1248
+ "quant_algo": "W4A16_NVFP4"
1249
+ },
1250
+ "model.language_model.layers.4.mlp.shared_expert.up_proj": {
1251
+ "group_size": 16,
1252
+ "quant_algo": "W4A16_NVFP4"
1253
+ },
1254
+ "model.language_model.layers.5.linear_attn.in_proj_qkv": {
1255
+ "quant_algo": "FP8"
1256
+ },
1257
+ "model.language_model.layers.5.linear_attn.in_proj_z": {
1258
+ "quant_algo": "FP8"
1259
+ },
1260
+ "model.language_model.layers.5.linear_attn.out_proj": {
1261
+ "quant_algo": "FP8"
1262
+ },
1263
+ "model.language_model.layers.5.mlp.experts": {
1264
+ "group_size": 16,
1265
+ "quant_algo": "W4A16_NVFP4"
1266
+ },
1267
+ "model.language_model.layers.5.mlp.shared_expert.down_proj": {
1268
+ "group_size": 16,
1269
+ "quant_algo": "W4A16_NVFP4"
1270
+ },
1271
+ "model.language_model.layers.5.mlp.shared_expert.gate_proj": {
1272
+ "group_size": 16,
1273
+ "quant_algo": "W4A16_NVFP4"
1274
+ },
1275
+ "model.language_model.layers.5.mlp.shared_expert.up_proj": {
1276
+ "group_size": 16,
1277
+ "quant_algo": "W4A16_NVFP4"
1278
+ },
1279
+ "model.language_model.layers.6.linear_attn.in_proj_qkv": {
1280
+ "quant_algo": "FP8"
1281
+ },
1282
+ "model.language_model.layers.6.linear_attn.in_proj_z": {
1283
+ "quant_algo": "FP8"
1284
+ },
1285
+ "model.language_model.layers.6.linear_attn.out_proj": {
1286
+ "quant_algo": "FP8"
1287
+ },
1288
+ "model.language_model.layers.6.mlp.experts": {
1289
+ "group_size": 16,
1290
+ "quant_algo": "W4A16_NVFP4"
1291
+ },
1292
+ "model.language_model.layers.6.mlp.shared_expert.down_proj": {
1293
+ "group_size": 16,
1294
+ "quant_algo": "W4A16_NVFP4"
1295
+ },
1296
+ "model.language_model.layers.6.mlp.shared_expert.gate_proj": {
1297
+ "group_size": 16,
1298
+ "quant_algo": "W4A16_NVFP4"
1299
+ },
1300
+ "model.language_model.layers.6.mlp.shared_expert.up_proj": {
1301
+ "group_size": 16,
1302
+ "quant_algo": "W4A16_NVFP4"
1303
+ },
1304
+ "model.language_model.layers.7.mlp.experts": {
1305
+ "group_size": 16,
1306
+ "quant_algo": "W4A16_NVFP4"
1307
+ },
1308
+ "model.language_model.layers.7.mlp.shared_expert.down_proj": {
1309
+ "group_size": 16,
1310
+ "quant_algo": "W4A16_NVFP4"
1311
+ },
1312
+ "model.language_model.layers.7.mlp.shared_expert.gate_proj": {
1313
+ "group_size": 16,
1314
+ "quant_algo": "W4A16_NVFP4"
1315
+ },
1316
+ "model.language_model.layers.7.mlp.shared_expert.up_proj": {
1317
+ "group_size": 16,
1318
+ "quant_algo": "W4A16_NVFP4"
1319
+ },
1320
+ "model.language_model.layers.7.self_attn.k_proj": {
1321
+ "quant_algo": "FP8"
1322
+ },
1323
+ "model.language_model.layers.7.self_attn.o_proj": {
1324
+ "quant_algo": "FP8"
1325
+ },
1326
+ "model.language_model.layers.7.self_attn.q_proj": {
1327
+ "quant_algo": "FP8"
1328
+ },
1329
+ "model.language_model.layers.7.self_attn.v_proj": {
1330
+ "quant_algo": "FP8"
1331
+ },
1332
+ "model.language_model.layers.8.linear_attn.in_proj_qkv": {
1333
+ "quant_algo": "FP8"
1334
+ },
1335
+ "model.language_model.layers.8.linear_attn.in_proj_z": {
1336
+ "quant_algo": "FP8"
1337
+ },
1338
+ "model.language_model.layers.8.linear_attn.out_proj": {
1339
+ "quant_algo": "FP8"
1340
+ },
1341
+ "model.language_model.layers.8.mlp.experts": {
1342
+ "group_size": 16,
1343
+ "quant_algo": "W4A16_NVFP4"
1344
+ },
1345
+ "model.language_model.layers.8.mlp.shared_expert.down_proj": {
1346
+ "group_size": 16,
1347
+ "quant_algo": "W4A16_NVFP4"
1348
+ },
1349
+ "model.language_model.layers.8.mlp.shared_expert.gate_proj": {
1350
+ "group_size": 16,
1351
+ "quant_algo": "W4A16_NVFP4"
1352
+ },
1353
+ "model.language_model.layers.8.mlp.shared_expert.up_proj": {
1354
+ "group_size": 16,
1355
+ "quant_algo": "W4A16_NVFP4"
1356
+ },
1357
+ "model.language_model.layers.9.linear_attn.in_proj_qkv": {
1358
+ "quant_algo": "FP8"
1359
+ },
1360
+ "model.language_model.layers.9.linear_attn.in_proj_z": {
1361
+ "quant_algo": "FP8"
1362
+ },
1363
+ "model.language_model.layers.9.linear_attn.out_proj": {
1364
+ "quant_algo": "FP8"
1365
+ },
1366
+ "model.language_model.layers.9.mlp.experts": {
1367
+ "group_size": 16,
1368
+ "quant_algo": "W4A16_NVFP4"
1369
+ },
1370
+ "model.language_model.layers.9.mlp.shared_expert.down_proj": {
1371
+ "group_size": 16,
1372
+ "quant_algo": "W4A16_NVFP4"
1373
+ },
1374
+ "model.language_model.layers.9.mlp.shared_expert.gate_proj": {
1375
+ "group_size": 16,
1376
+ "quant_algo": "W4A16_NVFP4"
1377
+ },
1378
+ "model.language_model.layers.9.mlp.shared_expert.up_proj": {
1379
+ "group_size": 16,
1380
+ "quant_algo": "W4A16_NVFP4"
1381
+ }
1382
+ }
1383
+ },
1384
+ "vision": {
1385
+ "storage": "bf16_exact_source_weights",
1386
+ "tensor_count": 333,
1387
+ "tensor_data_bytes": 893142496,
1388
+ "weight_bytes_requantized": false
1389
+ }
1390
+ },
1391
+ "mlx_modelopt_quantization": {
1392
+ "language_model.lm_head": "scaled_nvfp4",
1393
+ "language_model.model.layers.0.linear_attn.in_proj_qkv": "scaled_mxfp8",
1394
+ "language_model.model.layers.0.linear_attn.in_proj_z": "scaled_mxfp8",
1395
+ "language_model.model.layers.0.linear_attn.out_proj": "scaled_mxfp8",
1396
+ "language_model.model.layers.0.mlp.shared_expert.down_proj": "scaled_nvfp4",
1397
+ "language_model.model.layers.0.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1398
+ "language_model.model.layers.0.mlp.shared_expert.up_proj": "scaled_nvfp4",
1399
+ "language_model.model.layers.0.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1400
+ "language_model.model.layers.0.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1401
+ "language_model.model.layers.0.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1402
+ "language_model.model.layers.1.linear_attn.in_proj_qkv": "scaled_mxfp8",
1403
+ "language_model.model.layers.1.linear_attn.in_proj_z": "scaled_mxfp8",
1404
+ "language_model.model.layers.1.linear_attn.out_proj": "scaled_mxfp8",
1405
+ "language_model.model.layers.1.mlp.shared_expert.down_proj": "scaled_nvfp4",
1406
+ "language_model.model.layers.1.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1407
+ "language_model.model.layers.1.mlp.shared_expert.up_proj": "scaled_nvfp4",
1408
+ "language_model.model.layers.1.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1409
+ "language_model.model.layers.1.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1410
+ "language_model.model.layers.1.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1411
+ "language_model.model.layers.10.linear_attn.in_proj_qkv": "scaled_mxfp8",
1412
+ "language_model.model.layers.10.linear_attn.in_proj_z": "scaled_mxfp8",
1413
+ "language_model.model.layers.10.linear_attn.out_proj": "scaled_mxfp8",
1414
+ "language_model.model.layers.10.mlp.shared_expert.down_proj": "scaled_nvfp4",
1415
+ "language_model.model.layers.10.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1416
+ "language_model.model.layers.10.mlp.shared_expert.up_proj": "scaled_nvfp4",
1417
+ "language_model.model.layers.10.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1418
+ "language_model.model.layers.10.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1419
+ "language_model.model.layers.10.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1420
+ "language_model.model.layers.11.mlp.shared_expert.down_proj": "scaled_nvfp4",
1421
+ "language_model.model.layers.11.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1422
+ "language_model.model.layers.11.mlp.shared_expert.up_proj": "scaled_nvfp4",
1423
+ "language_model.model.layers.11.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1424
+ "language_model.model.layers.11.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1425
+ "language_model.model.layers.11.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1426
+ "language_model.model.layers.11.self_attn.k_proj": "scaled_mxfp8",
1427
+ "language_model.model.layers.11.self_attn.o_proj": "scaled_mxfp8",
1428
+ "language_model.model.layers.11.self_attn.q_proj": "scaled_mxfp8",
1429
+ "language_model.model.layers.11.self_attn.v_proj": "scaled_mxfp8",
1430
+ "language_model.model.layers.12.linear_attn.in_proj_qkv": "scaled_mxfp8",
1431
+ "language_model.model.layers.12.linear_attn.in_proj_z": "scaled_mxfp8",
1432
+ "language_model.model.layers.12.linear_attn.out_proj": "scaled_mxfp8",
1433
+ "language_model.model.layers.12.mlp.shared_expert.down_proj": "scaled_nvfp4",
1434
+ "language_model.model.layers.12.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1435
+ "language_model.model.layers.12.mlp.shared_expert.up_proj": "scaled_nvfp4",
1436
+ "language_model.model.layers.12.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1437
+ "language_model.model.layers.12.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1438
+ "language_model.model.layers.12.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1439
+ "language_model.model.layers.13.linear_attn.in_proj_qkv": "scaled_mxfp8",
1440
+ "language_model.model.layers.13.linear_attn.in_proj_z": "scaled_mxfp8",
1441
+ "language_model.model.layers.13.linear_attn.out_proj": "scaled_mxfp8",
1442
+ "language_model.model.layers.13.mlp.shared_expert.down_proj": "scaled_nvfp4",
1443
+ "language_model.model.layers.13.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1444
+ "language_model.model.layers.13.mlp.shared_expert.up_proj": "scaled_nvfp4",
1445
+ "language_model.model.layers.13.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1446
+ "language_model.model.layers.13.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1447
+ "language_model.model.layers.13.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1448
+ "language_model.model.layers.14.linear_attn.in_proj_qkv": "scaled_mxfp8",
1449
+ "language_model.model.layers.14.linear_attn.in_proj_z": "scaled_mxfp8",
1450
+ "language_model.model.layers.14.linear_attn.out_proj": "scaled_mxfp8",
1451
+ "language_model.model.layers.14.mlp.shared_expert.down_proj": "scaled_nvfp4",
1452
+ "language_model.model.layers.14.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1453
+ "language_model.model.layers.14.mlp.shared_expert.up_proj": "scaled_nvfp4",
1454
+ "language_model.model.layers.14.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1455
+ "language_model.model.layers.14.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1456
+ "language_model.model.layers.14.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1457
+ "language_model.model.layers.15.mlp.shared_expert.down_proj": "scaled_nvfp4",
1458
+ "language_model.model.layers.15.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1459
+ "language_model.model.layers.15.mlp.shared_expert.up_proj": "scaled_nvfp4",
1460
+ "language_model.model.layers.15.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1461
+ "language_model.model.layers.15.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1462
+ "language_model.model.layers.15.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1463
+ "language_model.model.layers.15.self_attn.k_proj": "scaled_mxfp8",
1464
+ "language_model.model.layers.15.self_attn.o_proj": "scaled_mxfp8",
1465
+ "language_model.model.layers.15.self_attn.q_proj": "scaled_mxfp8",
1466
+ "language_model.model.layers.15.self_attn.v_proj": "scaled_mxfp8",
1467
+ "language_model.model.layers.16.linear_attn.in_proj_qkv": "scaled_mxfp8",
1468
+ "language_model.model.layers.16.linear_attn.in_proj_z": "scaled_mxfp8",
1469
+ "language_model.model.layers.16.linear_attn.out_proj": "scaled_mxfp8",
1470
+ "language_model.model.layers.16.mlp.shared_expert.down_proj": "scaled_nvfp4",
1471
+ "language_model.model.layers.16.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1472
+ "language_model.model.layers.16.mlp.shared_expert.up_proj": "scaled_nvfp4",
1473
+ "language_model.model.layers.16.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1474
+ "language_model.model.layers.16.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1475
+ "language_model.model.layers.16.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1476
+ "language_model.model.layers.17.linear_attn.in_proj_qkv": "scaled_mxfp8",
1477
+ "language_model.model.layers.17.linear_attn.in_proj_z": "scaled_mxfp8",
1478
+ "language_model.model.layers.17.linear_attn.out_proj": "scaled_mxfp8",
1479
+ "language_model.model.layers.17.mlp.shared_expert.down_proj": "scaled_nvfp4",
1480
+ "language_model.model.layers.17.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1481
+ "language_model.model.layers.17.mlp.shared_expert.up_proj": "scaled_nvfp4",
1482
+ "language_model.model.layers.17.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1483
+ "language_model.model.layers.17.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1484
+ "language_model.model.layers.17.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1485
+ "language_model.model.layers.18.linear_attn.in_proj_qkv": "scaled_mxfp8",
1486
+ "language_model.model.layers.18.linear_attn.in_proj_z": "scaled_mxfp8",
1487
+ "language_model.model.layers.18.linear_attn.out_proj": "scaled_mxfp8",
1488
+ "language_model.model.layers.18.mlp.shared_expert.down_proj": "scaled_nvfp4",
1489
+ "language_model.model.layers.18.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1490
+ "language_model.model.layers.18.mlp.shared_expert.up_proj": "scaled_nvfp4",
1491
+ "language_model.model.layers.18.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1492
+ "language_model.model.layers.18.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1493
+ "language_model.model.layers.18.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1494
+ "language_model.model.layers.19.mlp.shared_expert.down_proj": "scaled_nvfp4",
1495
+ "language_model.model.layers.19.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1496
+ "language_model.model.layers.19.mlp.shared_expert.up_proj": "scaled_nvfp4",
1497
+ "language_model.model.layers.19.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1498
+ "language_model.model.layers.19.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1499
+ "language_model.model.layers.19.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1500
+ "language_model.model.layers.19.self_attn.k_proj": "scaled_mxfp8",
1501
+ "language_model.model.layers.19.self_attn.o_proj": "scaled_mxfp8",
1502
+ "language_model.model.layers.19.self_attn.q_proj": "scaled_mxfp8",
1503
+ "language_model.model.layers.19.self_attn.v_proj": "scaled_mxfp8",
1504
+ "language_model.model.layers.2.linear_attn.in_proj_qkv": "scaled_mxfp8",
1505
+ "language_model.model.layers.2.linear_attn.in_proj_z": "scaled_mxfp8",
1506
+ "language_model.model.layers.2.linear_attn.out_proj": "scaled_mxfp8",
1507
+ "language_model.model.layers.2.mlp.shared_expert.down_proj": "scaled_nvfp4",
1508
+ "language_model.model.layers.2.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1509
+ "language_model.model.layers.2.mlp.shared_expert.up_proj": "scaled_nvfp4",
1510
+ "language_model.model.layers.2.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1511
+ "language_model.model.layers.2.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1512
+ "language_model.model.layers.2.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1513
+ "language_model.model.layers.20.linear_attn.in_proj_qkv": "scaled_mxfp8",
1514
+ "language_model.model.layers.20.linear_attn.in_proj_z": "scaled_mxfp8",
1515
+ "language_model.model.layers.20.linear_attn.out_proj": "scaled_mxfp8",
1516
+ "language_model.model.layers.20.mlp.shared_expert.down_proj": "scaled_nvfp4",
1517
+ "language_model.model.layers.20.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1518
+ "language_model.model.layers.20.mlp.shared_expert.up_proj": "scaled_nvfp4",
1519
+ "language_model.model.layers.20.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1520
+ "language_model.model.layers.20.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1521
+ "language_model.model.layers.20.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1522
+ "language_model.model.layers.21.linear_attn.in_proj_qkv": "scaled_mxfp8",
1523
+ "language_model.model.layers.21.linear_attn.in_proj_z": "scaled_mxfp8",
1524
+ "language_model.model.layers.21.linear_attn.out_proj": "scaled_mxfp8",
1525
+ "language_model.model.layers.21.mlp.shared_expert.down_proj": "scaled_nvfp4",
1526
+ "language_model.model.layers.21.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1527
+ "language_model.model.layers.21.mlp.shared_expert.up_proj": "scaled_nvfp4",
1528
+ "language_model.model.layers.21.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1529
+ "language_model.model.layers.21.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1530
+ "language_model.model.layers.21.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1531
+ "language_model.model.layers.22.linear_attn.in_proj_qkv": "scaled_mxfp8",
1532
+ "language_model.model.layers.22.linear_attn.in_proj_z": "scaled_mxfp8",
1533
+ "language_model.model.layers.22.linear_attn.out_proj": "scaled_mxfp8",
1534
+ "language_model.model.layers.22.mlp.shared_expert.down_proj": "scaled_nvfp4",
1535
+ "language_model.model.layers.22.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1536
+ "language_model.model.layers.22.mlp.shared_expert.up_proj": "scaled_nvfp4",
1537
+ "language_model.model.layers.22.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1538
+ "language_model.model.layers.22.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1539
+ "language_model.model.layers.22.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1540
+ "language_model.model.layers.23.mlp.shared_expert.down_proj": "scaled_nvfp4",
1541
+ "language_model.model.layers.23.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1542
+ "language_model.model.layers.23.mlp.shared_expert.up_proj": "scaled_nvfp4",
1543
+ "language_model.model.layers.23.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1544
+ "language_model.model.layers.23.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1545
+ "language_model.model.layers.23.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1546
+ "language_model.model.layers.23.self_attn.k_proj": "scaled_mxfp8",
1547
+ "language_model.model.layers.23.self_attn.o_proj": "scaled_mxfp8",
1548
+ "language_model.model.layers.23.self_attn.q_proj": "scaled_mxfp8",
1549
+ "language_model.model.layers.23.self_attn.v_proj": "scaled_mxfp8",
1550
+ "language_model.model.layers.24.linear_attn.in_proj_qkv": "scaled_mxfp8",
1551
+ "language_model.model.layers.24.linear_attn.in_proj_z": "scaled_mxfp8",
1552
+ "language_model.model.layers.24.linear_attn.out_proj": "scaled_mxfp8",
1553
+ "language_model.model.layers.24.mlp.shared_expert.down_proj": "scaled_nvfp4",
1554
+ "language_model.model.layers.24.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1555
+ "language_model.model.layers.24.mlp.shared_expert.up_proj": "scaled_nvfp4",
1556
+ "language_model.model.layers.24.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1557
+ "language_model.model.layers.24.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1558
+ "language_model.model.layers.24.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1559
+ "language_model.model.layers.25.linear_attn.in_proj_qkv": "scaled_mxfp8",
1560
+ "language_model.model.layers.25.linear_attn.in_proj_z": "scaled_mxfp8",
1561
+ "language_model.model.layers.25.linear_attn.out_proj": "scaled_mxfp8",
1562
+ "language_model.model.layers.25.mlp.shared_expert.down_proj": "scaled_nvfp4",
1563
+ "language_model.model.layers.25.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1564
+ "language_model.model.layers.25.mlp.shared_expert.up_proj": "scaled_nvfp4",
1565
+ "language_model.model.layers.25.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1566
+ "language_model.model.layers.25.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1567
+ "language_model.model.layers.25.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1568
+ "language_model.model.layers.26.linear_attn.in_proj_qkv": "scaled_mxfp8",
1569
+ "language_model.model.layers.26.linear_attn.in_proj_z": "scaled_mxfp8",
1570
+ "language_model.model.layers.26.linear_attn.out_proj": "scaled_mxfp8",
1571
+ "language_model.model.layers.26.mlp.shared_expert.down_proj": "scaled_nvfp4",
1572
+ "language_model.model.layers.26.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1573
+ "language_model.model.layers.26.mlp.shared_expert.up_proj": "scaled_nvfp4",
1574
+ "language_model.model.layers.26.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1575
+ "language_model.model.layers.26.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1576
+ "language_model.model.layers.26.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1577
+ "language_model.model.layers.27.mlp.shared_expert.down_proj": "scaled_nvfp4",
1578
+ "language_model.model.layers.27.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1579
+ "language_model.model.layers.27.mlp.shared_expert.up_proj": "scaled_nvfp4",
1580
+ "language_model.model.layers.27.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1581
+ "language_model.model.layers.27.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1582
+ "language_model.model.layers.27.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1583
+ "language_model.model.layers.27.self_attn.k_proj": "scaled_mxfp8",
1584
+ "language_model.model.layers.27.self_attn.o_proj": "scaled_mxfp8",
1585
+ "language_model.model.layers.27.self_attn.q_proj": "scaled_mxfp8",
1586
+ "language_model.model.layers.27.self_attn.v_proj": "scaled_mxfp8",
1587
+ "language_model.model.layers.28.linear_attn.in_proj_qkv": "scaled_mxfp8",
1588
+ "language_model.model.layers.28.linear_attn.in_proj_z": "scaled_mxfp8",
1589
+ "language_model.model.layers.28.linear_attn.out_proj": "scaled_mxfp8",
1590
+ "language_model.model.layers.28.mlp.shared_expert.down_proj": "scaled_nvfp4",
1591
+ "language_model.model.layers.28.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1592
+ "language_model.model.layers.28.mlp.shared_expert.up_proj": "scaled_nvfp4",
1593
+ "language_model.model.layers.28.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1594
+ "language_model.model.layers.28.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1595
+ "language_model.model.layers.28.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1596
+ "language_model.model.layers.29.linear_attn.in_proj_qkv": "scaled_mxfp8",
1597
+ "language_model.model.layers.29.linear_attn.in_proj_z": "scaled_mxfp8",
1598
+ "language_model.model.layers.29.linear_attn.out_proj": "scaled_mxfp8",
1599
+ "language_model.model.layers.29.mlp.shared_expert.down_proj": "scaled_nvfp4",
1600
+ "language_model.model.layers.29.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1601
+ "language_model.model.layers.29.mlp.shared_expert.up_proj": "scaled_nvfp4",
1602
+ "language_model.model.layers.29.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1603
+ "language_model.model.layers.29.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1604
+ "language_model.model.layers.29.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1605
+ "language_model.model.layers.3.mlp.shared_expert.down_proj": "scaled_nvfp4",
1606
+ "language_model.model.layers.3.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1607
+ "language_model.model.layers.3.mlp.shared_expert.up_proj": "scaled_nvfp4",
1608
+ "language_model.model.layers.3.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1609
+ "language_model.model.layers.3.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1610
+ "language_model.model.layers.3.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1611
+ "language_model.model.layers.3.self_attn.k_proj": "scaled_mxfp8",
1612
+ "language_model.model.layers.3.self_attn.o_proj": "scaled_mxfp8",
1613
+ "language_model.model.layers.3.self_attn.q_proj": "scaled_mxfp8",
1614
+ "language_model.model.layers.3.self_attn.v_proj": "scaled_mxfp8",
1615
+ "language_model.model.layers.30.linear_attn.in_proj_qkv": "scaled_mxfp8",
1616
+ "language_model.model.layers.30.linear_attn.in_proj_z": "scaled_mxfp8",
1617
+ "language_model.model.layers.30.linear_attn.out_proj": "scaled_mxfp8",
1618
+ "language_model.model.layers.30.mlp.shared_expert.down_proj": "scaled_nvfp4",
1619
+ "language_model.model.layers.30.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1620
+ "language_model.model.layers.30.mlp.shared_expert.up_proj": "scaled_nvfp4",
1621
+ "language_model.model.layers.30.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1622
+ "language_model.model.layers.30.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1623
+ "language_model.model.layers.30.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1624
+ "language_model.model.layers.31.mlp.shared_expert.down_proj": "scaled_nvfp4",
1625
+ "language_model.model.layers.31.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1626
+ "language_model.model.layers.31.mlp.shared_expert.up_proj": "scaled_nvfp4",
1627
+ "language_model.model.layers.31.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1628
+ "language_model.model.layers.31.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1629
+ "language_model.model.layers.31.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1630
+ "language_model.model.layers.31.self_attn.k_proj": "scaled_mxfp8",
1631
+ "language_model.model.layers.31.self_attn.o_proj": "scaled_mxfp8",
1632
+ "language_model.model.layers.31.self_attn.q_proj": "scaled_mxfp8",
1633
+ "language_model.model.layers.31.self_attn.v_proj": "scaled_mxfp8",
1634
+ "language_model.model.layers.32.linear_attn.in_proj_qkv": "scaled_mxfp8",
1635
+ "language_model.model.layers.32.linear_attn.in_proj_z": "scaled_mxfp8",
1636
+ "language_model.model.layers.32.linear_attn.out_proj": "scaled_mxfp8",
1637
+ "language_model.model.layers.32.mlp.shared_expert.down_proj": "scaled_nvfp4",
1638
+ "language_model.model.layers.32.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1639
+ "language_model.model.layers.32.mlp.shared_expert.up_proj": "scaled_nvfp4",
1640
+ "language_model.model.layers.32.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1641
+ "language_model.model.layers.32.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1642
+ "language_model.model.layers.32.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1643
+ "language_model.model.layers.33.linear_attn.in_proj_qkv": "scaled_mxfp8",
1644
+ "language_model.model.layers.33.linear_attn.in_proj_z": "scaled_mxfp8",
1645
+ "language_model.model.layers.33.linear_attn.out_proj": "scaled_mxfp8",
1646
+ "language_model.model.layers.33.mlp.shared_expert.down_proj": "scaled_nvfp4",
1647
+ "language_model.model.layers.33.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1648
+ "language_model.model.layers.33.mlp.shared_expert.up_proj": "scaled_nvfp4",
1649
+ "language_model.model.layers.33.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1650
+ "language_model.model.layers.33.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1651
+ "language_model.model.layers.33.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1652
+ "language_model.model.layers.34.linear_attn.in_proj_qkv": "scaled_mxfp8",
1653
+ "language_model.model.layers.34.linear_attn.in_proj_z": "scaled_mxfp8",
1654
+ "language_model.model.layers.34.linear_attn.out_proj": "scaled_mxfp8",
1655
+ "language_model.model.layers.34.mlp.shared_expert.down_proj": "scaled_nvfp4",
1656
+ "language_model.model.layers.34.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1657
+ "language_model.model.layers.34.mlp.shared_expert.up_proj": "scaled_nvfp4",
1658
+ "language_model.model.layers.34.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1659
+ "language_model.model.layers.34.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1660
+ "language_model.model.layers.34.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1661
+ "language_model.model.layers.35.mlp.shared_expert.down_proj": "scaled_nvfp4",
1662
+ "language_model.model.layers.35.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1663
+ "language_model.model.layers.35.mlp.shared_expert.up_proj": "scaled_nvfp4",
1664
+ "language_model.model.layers.35.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1665
+ "language_model.model.layers.35.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1666
+ "language_model.model.layers.35.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1667
+ "language_model.model.layers.35.self_attn.k_proj": "scaled_mxfp8",
1668
+ "language_model.model.layers.35.self_attn.o_proj": "scaled_mxfp8",
1669
+ "language_model.model.layers.35.self_attn.q_proj": "scaled_mxfp8",
1670
+ "language_model.model.layers.35.self_attn.v_proj": "scaled_mxfp8",
1671
+ "language_model.model.layers.36.linear_attn.in_proj_qkv": "scaled_mxfp8",
1672
+ "language_model.model.layers.36.linear_attn.in_proj_z": "scaled_mxfp8",
1673
+ "language_model.model.layers.36.linear_attn.out_proj": "scaled_mxfp8",
1674
+ "language_model.model.layers.36.mlp.shared_expert.down_proj": "scaled_nvfp4",
1675
+ "language_model.model.layers.36.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1676
+ "language_model.model.layers.36.mlp.shared_expert.up_proj": "scaled_nvfp4",
1677
+ "language_model.model.layers.36.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1678
+ "language_model.model.layers.36.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1679
+ "language_model.model.layers.36.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1680
+ "language_model.model.layers.37.linear_attn.in_proj_qkv": "scaled_mxfp8",
1681
+ "language_model.model.layers.37.linear_attn.in_proj_z": "scaled_mxfp8",
1682
+ "language_model.model.layers.37.linear_attn.out_proj": "scaled_mxfp8",
1683
+ "language_model.model.layers.37.mlp.shared_expert.down_proj": "scaled_nvfp4",
1684
+ "language_model.model.layers.37.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1685
+ "language_model.model.layers.37.mlp.shared_expert.up_proj": "scaled_nvfp4",
1686
+ "language_model.model.layers.37.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1687
+ "language_model.model.layers.37.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1688
+ "language_model.model.layers.37.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1689
+ "language_model.model.layers.38.linear_attn.in_proj_qkv": "scaled_mxfp8",
1690
+ "language_model.model.layers.38.linear_attn.in_proj_z": "scaled_mxfp8",
1691
+ "language_model.model.layers.38.linear_attn.out_proj": "scaled_mxfp8",
1692
+ "language_model.model.layers.38.mlp.shared_expert.down_proj": "scaled_nvfp4",
1693
+ "language_model.model.layers.38.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1694
+ "language_model.model.layers.38.mlp.shared_expert.up_proj": "scaled_nvfp4",
1695
+ "language_model.model.layers.38.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1696
+ "language_model.model.layers.38.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1697
+ "language_model.model.layers.38.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1698
+ "language_model.model.layers.39.mlp.shared_expert.down_proj": "scaled_nvfp4",
1699
+ "language_model.model.layers.39.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1700
+ "language_model.model.layers.39.mlp.shared_expert.up_proj": "scaled_nvfp4",
1701
+ "language_model.model.layers.39.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1702
+ "language_model.model.layers.39.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1703
+ "language_model.model.layers.39.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1704
+ "language_model.model.layers.39.self_attn.k_proj": "scaled_mxfp8",
1705
+ "language_model.model.layers.39.self_attn.o_proj": "scaled_mxfp8",
1706
+ "language_model.model.layers.39.self_attn.q_proj": "scaled_mxfp8",
1707
+ "language_model.model.layers.39.self_attn.v_proj": "scaled_mxfp8",
1708
+ "language_model.model.layers.4.linear_attn.in_proj_qkv": "scaled_mxfp8",
1709
+ "language_model.model.layers.4.linear_attn.in_proj_z": "scaled_mxfp8",
1710
+ "language_model.model.layers.4.linear_attn.out_proj": "scaled_mxfp8",
1711
+ "language_model.model.layers.4.mlp.shared_expert.down_proj": "scaled_nvfp4",
1712
+ "language_model.model.layers.4.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1713
+ "language_model.model.layers.4.mlp.shared_expert.up_proj": "scaled_nvfp4",
1714
+ "language_model.model.layers.4.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1715
+ "language_model.model.layers.4.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1716
+ "language_model.model.layers.4.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1717
+ "language_model.model.layers.5.linear_attn.in_proj_qkv": "scaled_mxfp8",
1718
+ "language_model.model.layers.5.linear_attn.in_proj_z": "scaled_mxfp8",
1719
+ "language_model.model.layers.5.linear_attn.out_proj": "scaled_mxfp8",
1720
+ "language_model.model.layers.5.mlp.shared_expert.down_proj": "scaled_nvfp4",
1721
+ "language_model.model.layers.5.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1722
+ "language_model.model.layers.5.mlp.shared_expert.up_proj": "scaled_nvfp4",
1723
+ "language_model.model.layers.5.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1724
+ "language_model.model.layers.5.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1725
+ "language_model.model.layers.5.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1726
+ "language_model.model.layers.6.linear_attn.in_proj_qkv": "scaled_mxfp8",
1727
+ "language_model.model.layers.6.linear_attn.in_proj_z": "scaled_mxfp8",
1728
+ "language_model.model.layers.6.linear_attn.out_proj": "scaled_mxfp8",
1729
+ "language_model.model.layers.6.mlp.shared_expert.down_proj": "scaled_nvfp4",
1730
+ "language_model.model.layers.6.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1731
+ "language_model.model.layers.6.mlp.shared_expert.up_proj": "scaled_nvfp4",
1732
+ "language_model.model.layers.6.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1733
+ "language_model.model.layers.6.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1734
+ "language_model.model.layers.6.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1735
+ "language_model.model.layers.7.mlp.shared_expert.down_proj": "scaled_nvfp4",
1736
+ "language_model.model.layers.7.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1737
+ "language_model.model.layers.7.mlp.shared_expert.up_proj": "scaled_nvfp4",
1738
+ "language_model.model.layers.7.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1739
+ "language_model.model.layers.7.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1740
+ "language_model.model.layers.7.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1741
+ "language_model.model.layers.7.self_attn.k_proj": "scaled_mxfp8",
1742
+ "language_model.model.layers.7.self_attn.o_proj": "scaled_mxfp8",
1743
+ "language_model.model.layers.7.self_attn.q_proj": "scaled_mxfp8",
1744
+ "language_model.model.layers.7.self_attn.v_proj": "scaled_mxfp8",
1745
+ "language_model.model.layers.8.linear_attn.in_proj_qkv": "scaled_mxfp8",
1746
+ "language_model.model.layers.8.linear_attn.in_proj_z": "scaled_mxfp8",
1747
+ "language_model.model.layers.8.linear_attn.out_proj": "scaled_mxfp8",
1748
+ "language_model.model.layers.8.mlp.shared_expert.down_proj": "scaled_nvfp4",
1749
+ "language_model.model.layers.8.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1750
+ "language_model.model.layers.8.mlp.shared_expert.up_proj": "scaled_nvfp4",
1751
+ "language_model.model.layers.8.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1752
+ "language_model.model.layers.8.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1753
+ "language_model.model.layers.8.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch",
1754
+ "language_model.model.layers.9.linear_attn.in_proj_qkv": "scaled_mxfp8",
1755
+ "language_model.model.layers.9.linear_attn.in_proj_z": "scaled_mxfp8",
1756
+ "language_model.model.layers.9.linear_attn.out_proj": "scaled_mxfp8",
1757
+ "language_model.model.layers.9.mlp.shared_expert.down_proj": "scaled_nvfp4",
1758
+ "language_model.model.layers.9.mlp.shared_expert.gate_proj": "scaled_nvfp4",
1759
+ "language_model.model.layers.9.mlp.shared_expert.up_proj": "scaled_nvfp4",
1760
+ "language_model.model.layers.9.mlp.switch_mlp.down_proj": "scaled_nvfp4_switch",
1761
+ "language_model.model.layers.9.mlp.switch_mlp.gate_proj": "scaled_nvfp4_switch",
1762
+ "language_model.model.layers.9.mlp.switch_mlp.up_proj": "scaled_nvfp4_switch"
1763
+ },
1764
+ "model_file": "modeling_mlx_qwen36_modelopt_hybrid.py",
1765
+ "model_type": "qwen3_5_moe",
1766
+ "text_config": {
1767
+ "attention_bias": false,
1768
+ "attention_dropout": 0.0,
1769
+ "attn_output_gate": true,
1770
+ "bos_token_id": 248044,
1771
+ "dtype": "bfloat16",
1772
+ "eos_token_id": 248044,
1773
+ "full_attention_interval": 4,
1774
+ "head_dim": 256,
1775
+ "hidden_act": "silu",
1776
+ "hidden_size": 2048,
1777
+ "initializer_range": 0.02,
1778
+ "layer_types": [
1779
+ "linear_attention",
1780
+ "linear_attention",
1781
+ "linear_attention",
1782
+ "full_attention",
1783
+ "linear_attention",
1784
+ "linear_attention",
1785
+ "linear_attention",
1786
+ "full_attention",
1787
+ "linear_attention",
1788
+ "linear_attention",
1789
+ "linear_attention",
1790
+ "full_attention",
1791
+ "linear_attention",
1792
+ "linear_attention",
1793
+ "linear_attention",
1794
+ "full_attention",
1795
+ "linear_attention",
1796
+ "linear_attention",
1797
+ "linear_attention",
1798
+ "full_attention",
1799
+ "linear_attention",
1800
+ "linear_attention",
1801
+ "linear_attention",
1802
+ "full_attention",
1803
+ "linear_attention",
1804
+ "linear_attention",
1805
+ "linear_attention",
1806
+ "full_attention",
1807
+ "linear_attention",
1808
+ "linear_attention",
1809
+ "linear_attention",
1810
+ "full_attention",
1811
+ "linear_attention",
1812
+ "linear_attention",
1813
+ "linear_attention",
1814
+ "full_attention",
1815
+ "linear_attention",
1816
+ "linear_attention",
1817
+ "linear_attention",
1818
+ "full_attention"
1819
+ ],
1820
+ "linear_conv_kernel_dim": 4,
1821
+ "linear_key_head_dim": 128,
1822
+ "linear_num_key_heads": 16,
1823
+ "linear_num_value_heads": 32,
1824
+ "linear_value_head_dim": 128,
1825
+ "mamba_ssm_dtype": "float32",
1826
+ "max_position_embeddings": 262144,
1827
+ "model_type": "qwen3_5_moe_text",
1828
+ "moe_intermediate_size": 512,
1829
+ "mtp_num_hidden_layers": 1,
1830
+ "mtp_use_dedicated_embeddings": false,
1831
+ "num_attention_heads": 16,
1832
+ "num_experts": 256,
1833
+ "num_experts_per_tok": 8,
1834
+ "num_hidden_layers": 40,
1835
+ "num_key_value_heads": 2,
1836
+ "output_router_logits": false,
1837
+ "pad_token_id": null,
1838
+ "partial_rotary_factor": 0.25,
1839
+ "rms_norm_eps": 1e-06,
1840
+ "rope_parameters": {
1841
+ "mrope_interleaved": true,
1842
+ "mrope_section": [
1843
+ 11,
1844
+ 11,
1845
+ 10
1846
+ ],
1847
+ "partial_rotary_factor": 0.25,
1848
+ "rope_theta": 10000000,
1849
+ "rope_type": "default"
1850
+ },
1851
+ "router_aux_loss_coef": 0.001,
1852
+ "shared_expert_intermediate_size": 512,
1853
+ "tie_word_embeddings": false,
1854
+ "use_cache": true,
1855
+ "vocab_size": 248320
1856
+ },
1857
+ "tie_word_embeddings": false,
1858
+ "transformers_version": "5.7.0.dev0",
1859
+ "video_token_id": 248057,
1860
+ "vision_config": {
1861
+ "deepstack_visual_indexes": [],
1862
+ "depth": 27,
1863
+ "dtype": "bfloat16",
1864
+ "hidden_act": "gelu_pytorch_tanh",
1865
+ "hidden_size": 1152,
1866
+ "in_channels": 3,
1867
+ "initializer_range": 0.02,
1868
+ "intermediate_size": 4304,
1869
+ "model_type": "qwen3_5_moe_vision",
1870
+ "num_heads": 16,
1871
+ "num_position_embeddings": 2304,
1872
+ "out_hidden_size": 2048,
1873
+ "patch_size": 16,
1874
+ "spatial_merge_size": 2,
1875
+ "temporal_patch_size": 2
1876
+ },
1877
+ "vision_end_token_id": 248054,
1878
+ "vision_start_token_id": 248053,
1879
+ "vlm_model_file": "modeling_mlx_vlm_qwen36_modelopt_hybrid.py"
1880
+ }
convert_qwen36_modelopt_hybrid_to_mlx.py ADDED
@@ -0,0 +1,568 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Stream a Qwen3.6 ModelOpt FP8/NVFP4 checkpoint into MLX format.
3
+
4
+ This is intentionally a format conversion, not a re-quantization:
5
+
6
+ * FP8 E4M3 weight bytes are packed four-at-a-time into MLX uint32 tensors.
7
+ Unit E8M0 block scales make MLX's MXFP8 kernel decode the original FP8
8
+ values exactly; the original ModelOpt tensor scale is retained separately.
9
+ * NVFP4 E2M1 weight nibbles and E4M3 block-scale bytes are repacked without
10
+ numerical modification. The original FP32 tensor scales are retained.
11
+ * Expert tensors are stacked into MLX's SwitchGLU layout one layer at a time.
12
+ * The original BF16 vision tower is preserved unchanged in a dedicated shard
13
+ and loaded by the model-local MLX-VLM runtime.
14
+ * ModelOpt activation scales are recorded as dropped because this runtime uses
15
+ weight-only quantized kernels and keeps activations in the model dtype.
16
+
17
+ Each transformer layer is written as its own safetensors shard, bounding peak
18
+ memory to roughly one layer rather than the whole model.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import argparse
24
+ import json
25
+ import os
26
+ import re
27
+ import resource
28
+ import shutil
29
+ import sys
30
+ from collections import Counter, defaultdict
31
+ from datetime import datetime, timezone
32
+ from pathlib import Path
33
+ from typing import Dict, Iterable, Mapping
34
+
35
+ import mlx.core as mx
36
+
37
+
38
+ RUNTIME_FILE = "modeling_mlx_qwen36_modelopt_hybrid.py"
39
+ VLM_RUNTIME_FILE = "modeling_mlx_vlm_qwen36_modelopt_hybrid.py"
40
+ EXPERT_RE = re.compile(
41
+ r"^model\.language_model\.layers\.(\d+)\.mlp\.experts\.(\d+)\."
42
+ r"(gate_proj|up_proj|down_proj)\."
43
+ r"(weight|weight_scale|weight_scale_2|input_scale)$"
44
+ )
45
+ LAYER_RE = re.compile(r"^model\.language_model\.layers\.(\d+)\.")
46
+ NORM_SUFFIXES = (
47
+ ".input_layernorm.weight",
48
+ ".post_attention_layernorm.weight",
49
+ "model.norm.weight",
50
+ ".q_norm.weight",
51
+ ".k_norm.weight",
52
+ )
53
+
54
+
55
+ def log(message: str) -> None:
56
+ now = datetime.now().strftime("%H:%M:%S")
57
+ rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / (1024**3)
58
+ print(f"[{now}] [peak RSS {rss:.2f} GiB] {message}", flush=True)
59
+
60
+
61
+ def pack_u8x4(x: mx.array) -> mx.array:
62
+ """Pack four consecutive bytes into one little-endian uint32."""
63
+ if x.dtype != mx.uint8:
64
+ raise TypeError(f"Expected uint8 storage, got {x.dtype}")
65
+ if x.shape[-1] % 4:
66
+ raise ValueError(f"Last dimension {x.shape[-1]} is not divisible by four")
67
+ y = x.reshape(*x.shape[:-1], x.shape[-1] // 4, 4).astype(mx.uint32)
68
+ return y[..., 0] | (y[..., 1] << 8) | (y[..., 2] << 16) | (y[..., 3] << 24)
69
+
70
+
71
+ def sanitize_name(key: str) -> str:
72
+ prefix = "model.language_model."
73
+ if key.startswith(prefix):
74
+ return "language_model.model." + key[len(prefix) :]
75
+ if key.startswith("language_model."):
76
+ return key
77
+ return "language_model." + key
78
+
79
+
80
+ def should_drop(key: str) -> bool:
81
+ return (
82
+ key.startswith("model.visual")
83
+ or key.startswith("vision_tower")
84
+ or key.startswith("mtp.")
85
+ or ".mtp." in key
86
+ )
87
+
88
+
89
+ class SourceWeights:
90
+ def __init__(self, root: Path, weight_map: Mapping[str, str]):
91
+ self.root = root
92
+ self.weight_map = weight_map
93
+ self._shards: Dict[str, Dict[str, mx.array]] = {}
94
+
95
+ def get(self, key: str) -> mx.array:
96
+ shard_name = self.weight_map[key]
97
+ if shard_name not in self._shards:
98
+ log(f"Opening source shard {shard_name} lazily")
99
+ self._shards[shard_name] = mx.load(str(self.root / shard_name))
100
+ return self._shards[shard_name][key]
101
+
102
+
103
+ def group_id_for_key(key: str) -> int | None:
104
+ match = LAYER_RE.match(key)
105
+ return int(match.group(1)) if match else None
106
+
107
+
108
+ def group_id_for_prefix(prefix: str) -> int | None:
109
+ return group_id_for_key(prefix + ".weight")
110
+
111
+
112
+ def add_output(
113
+ output: Dict[str, mx.array],
114
+ key: str,
115
+ value: mx.array,
116
+ ) -> None:
117
+ if key in output:
118
+ raise KeyError(f"Duplicate output tensor {key}")
119
+ output[key] = value
120
+
121
+
122
+ def convert_dense_nvfp4(
123
+ source: SourceWeights,
124
+ prefix: str,
125
+ output: Dict[str, mx.array],
126
+ quantization: Dict[str, str],
127
+ ) -> None:
128
+ raw = source.get(prefix + ".weight")
129
+ scales = source.get(prefix + ".weight_scale")
130
+ tensor_scale = source.get(prefix + ".weight_scale_2")
131
+ if raw.dtype != mx.uint8 or scales.dtype != mx.uint8:
132
+ raise TypeError(
133
+ f"Unexpected NVFP4 storage for {prefix}: {raw.dtype}, {scales.dtype}"
134
+ )
135
+ if raw.shape[-1] != scales.shape[-1] * 8:
136
+ raise ValueError(
137
+ f"NVFP4 shape mismatch for {prefix}: weight={raw.shape}, scales={scales.shape}"
138
+ )
139
+ out_prefix = sanitize_name(prefix)
140
+ add_output(output, out_prefix + ".weight", pack_u8x4(raw))
141
+ add_output(output, out_prefix + ".scales", scales)
142
+ add_output(output, out_prefix + ".global_scale", tensor_scale)
143
+ quantization[out_prefix] = "scaled_nvfp4"
144
+
145
+
146
+ def convert_dense_fp8(
147
+ source: SourceWeights,
148
+ prefix: str,
149
+ output: Dict[str, mx.array],
150
+ quantization: Dict[str, str],
151
+ ) -> None:
152
+ raw = source.get(prefix + ".weight")
153
+ tensor_scale = source.get(prefix + ".weight_scale")
154
+ if raw.dtype != mx.uint8:
155
+ raise TypeError(f"Unexpected FP8 storage for {prefix}: {raw.dtype}")
156
+ if raw.shape[-1] % 32:
157
+ raise ValueError(
158
+ f"FP8 input dimension for {prefix} is not divisible by 32: {raw.shape}"
159
+ )
160
+ out_prefix = sanitize_name(prefix)
161
+ add_output(output, out_prefix + ".weight", pack_u8x4(raw))
162
+ # E8M0 byte 0x7f represents exactly 1.0. With unit scales, MLX's
163
+ # MXFP8 decoder reproduces ModelOpt's E4M3 weight bytes losslessly.
164
+ scale_shape = (*raw.shape[:-1], raw.shape[-1] // 32)
165
+ add_output(
166
+ output,
167
+ out_prefix + ".scales",
168
+ mx.full(scale_shape, 0x7F, dtype=mx.uint8),
169
+ )
170
+ add_output(output, out_prefix + ".global_scale", tensor_scale)
171
+ quantization[out_prefix] = "scaled_mxfp8"
172
+
173
+
174
+ def convert_expert_projection(
175
+ source: SourceWeights,
176
+ layer: int,
177
+ projection: str,
178
+ expert_lookup: Mapping[tuple[int, str, str], Mapping[int, str]],
179
+ num_experts: int,
180
+ output: Dict[str, mx.array],
181
+ quantization: Dict[str, str],
182
+ ) -> None:
183
+ expected = list(range(num_experts))
184
+ suffix_maps = {
185
+ suffix: expert_lookup[(layer, projection, suffix)]
186
+ for suffix in ("weight", "weight_scale", "weight_scale_2")
187
+ }
188
+ for suffix, mapping in suffix_maps.items():
189
+ present = sorted(mapping)
190
+ if present != expected:
191
+ missing = sorted(set(expected) - set(present))
192
+ raise ValueError(
193
+ f"Layer {layer} {projection} {suffix}: expected {num_experts} "
194
+ f"experts, missing {missing[:20]}"
195
+ )
196
+
197
+ raw = mx.stack(
198
+ [source.get(suffix_maps["weight"][expert]) for expert in expected], axis=0
199
+ )
200
+ scales = mx.stack(
201
+ [source.get(suffix_maps["weight_scale"][expert]) for expert in expected],
202
+ axis=0,
203
+ )
204
+ tensor_scales = mx.stack(
205
+ [source.get(suffix_maps["weight_scale_2"][expert]) for expert in expected],
206
+ axis=0,
207
+ )
208
+ if raw.dtype != mx.uint8 or scales.dtype != mx.uint8:
209
+ raise TypeError(
210
+ f"Unexpected expert NVFP4 storage at layer {layer} {projection}: "
211
+ f"{raw.dtype}, {scales.dtype}"
212
+ )
213
+ if raw.shape[-1] != scales.shape[-1] * 8:
214
+ raise ValueError(
215
+ f"Expert NVFP4 shape mismatch at layer {layer} {projection}: "
216
+ f"weight={raw.shape}, scales={scales.shape}"
217
+ )
218
+
219
+ out_prefix = (
220
+ f"language_model.model.layers.{layer}.mlp.switch_mlp.{projection}"
221
+ )
222
+ add_output(output, out_prefix + ".weight", pack_u8x4(raw))
223
+ add_output(output, out_prefix + ".scales", scales)
224
+ add_output(output, out_prefix + ".global_scales", tensor_scales)
225
+ quantization[out_prefix] = "scaled_nvfp4_switch"
226
+
227
+
228
+ def transform_standard_weight(
229
+ key: str,
230
+ value: mx.array,
231
+ shift_norm_weights: bool,
232
+ ) -> tuple[str, mx.array]:
233
+ out_key = sanitize_name(key)
234
+ if "conv1d.weight" in out_key and value.shape[-1] != 1:
235
+ value = value.moveaxis(2, 1)
236
+ if (
237
+ shift_norm_weights
238
+ and value.ndim == 1
239
+ and any(out_key.endswith(suffix) for suffix in NORM_SUFFIXES)
240
+ ):
241
+ value = value + 1.0
242
+ return out_key, value
243
+
244
+
245
+ def write_shard(
246
+ partial: Path,
247
+ filename: str,
248
+ tensors: Dict[str, mx.array],
249
+ output_weight_map: Dict[str, str],
250
+ ) -> int:
251
+ tensors = dict(sorted(tensors.items()))
252
+ total_bytes = sum(array.nbytes for array in tensors.values())
253
+ log(
254
+ f"Writing {filename}: {len(tensors)} tensors, "
255
+ f"{total_bytes / (1024**3):.2f} GiB"
256
+ )
257
+ mx.save_safetensors(
258
+ str(partial / filename),
259
+ tensors,
260
+ metadata={"format": "mlx"},
261
+ )
262
+ for key in tensors:
263
+ if key in output_weight_map:
264
+ raise KeyError(f"Tensor {key} was already assigned to a shard")
265
+ output_weight_map[key] = filename
266
+ del tensors
267
+ try:
268
+ mx.clear_cache()
269
+ except AttributeError:
270
+ # Compatibility with older MLX releases.
271
+ mx.metal.clear_cache()
272
+ return total_bytes
273
+
274
+
275
+ def copy_metadata(source: Path, partial: Path) -> None:
276
+ names = [
277
+ "README.md",
278
+ "LICENSE",
279
+ "chat_template.jinja",
280
+ "generation_config.json",
281
+ "preprocessor_config.json",
282
+ "video_preprocessor_config.json",
283
+ "special_tokens_map.json",
284
+ "tokenizer.json",
285
+ "tokenizer.model",
286
+ "tokenizer_config.json",
287
+ "vocab.json",
288
+ "merges.txt",
289
+ ]
290
+ for name in names:
291
+ src = source / name
292
+ if src.exists():
293
+ shutil.copy2(src, partial / name, follow_symlinks=True)
294
+ assets = source / "assets"
295
+ if assets.exists():
296
+ shutil.copytree(assets, partial / "assets")
297
+
298
+
299
+ def convert(
300
+ source: Path,
301
+ output: Path,
302
+ runtime_source: Path,
303
+ vlm_runtime_source: Path,
304
+ ) -> None:
305
+ source = source.resolve()
306
+ output = output.resolve()
307
+ partial = output.with_name(output.name + ".partial")
308
+ if output.exists():
309
+ raise FileExistsError(f"Output already exists: {output}")
310
+ if partial.exists():
311
+ raise FileExistsError(
312
+ f"Partial output already exists: {partial}. Remove it or choose another path."
313
+ )
314
+ if not (source / "config.json").exists():
315
+ raise FileNotFoundError(f"Missing config.json in {source}")
316
+ if not (source / "model.safetensors.index.json").exists():
317
+ raise FileNotFoundError(f"Missing model.safetensors.index.json in {source}")
318
+
319
+ config = json.loads((source / "config.json").read_text())
320
+ index = json.loads((source / "model.safetensors.index.json").read_text())
321
+ weight_map: Dict[str, str] = index["weight_map"]
322
+ all_keys = sorted(weight_map)
323
+ vision_keys = [key for key in all_keys if key.startswith("model.visual.")]
324
+ text_config = config.get("text_config", config)
325
+ num_layers = int(text_config["num_hidden_layers"])
326
+ num_experts = int(text_config["num_experts"])
327
+ log(
328
+ f"Source {source}: {len(all_keys)} tensors, {num_layers} layers, "
329
+ f"{num_experts} experts"
330
+ )
331
+
332
+ nvfp4_prefixes = {
333
+ key[: -len(".weight_scale_2")]
334
+ for key in all_keys
335
+ if key.endswith(".weight_scale_2") and not should_drop(key)
336
+ }
337
+ all_scale_prefixes = {
338
+ key[: -len(".weight_scale")]
339
+ for key in all_keys
340
+ if key.endswith(".weight_scale") and not should_drop(key)
341
+ }
342
+ fp8_prefixes = all_scale_prefixes - nvfp4_prefixes
343
+
344
+ expert_lookup: dict[tuple[int, str, str], dict[int, str]] = defaultdict(dict)
345
+ expert_keys = set()
346
+ for key in all_keys:
347
+ match = EXPERT_RE.match(key)
348
+ if not match:
349
+ continue
350
+ layer, expert, projection, suffix = match.groups()
351
+ expert_lookup[(int(layer), projection, suffix)][int(expert)] = key
352
+ expert_keys.add(key)
353
+
354
+ expert_prefix_marker = ".mlp.experts."
355
+ dense_nvfp4 = sorted(
356
+ prefix for prefix in nvfp4_prefixes if expert_prefix_marker not in prefix
357
+ )
358
+ dense_fp8 = sorted(
359
+ prefix for prefix in fp8_prefixes if expert_prefix_marker not in prefix
360
+ )
361
+ log(
362
+ f"Detected {len(dense_fp8)} dense FP8 modules, "
363
+ f"{len(dense_nvfp4)} dense NVFP4 modules, and "
364
+ f"{len(expert_keys)} expert component tensors"
365
+ )
366
+
367
+ layer_standard_keys: dict[int, list[str]] = defaultdict(list)
368
+ global_standard_keys: list[str] = []
369
+ quantized_prefixes = nvfp4_prefixes | fp8_prefixes
370
+ quant_metadata_suffixes = (
371
+ ".input_scale",
372
+ ".weight_scale",
373
+ ".weight_scale_2",
374
+ )
375
+ for key in all_keys:
376
+ if should_drop(key) or key in expert_keys:
377
+ continue
378
+ if key.endswith(quant_metadata_suffixes):
379
+ continue
380
+ if key.endswith(".weight") and key[: -len(".weight")] in quantized_prefixes:
381
+ continue
382
+ group = group_id_for_key(key)
383
+ if group is None:
384
+ global_standard_keys.append(key)
385
+ else:
386
+ layer_standard_keys[group].append(key)
387
+
388
+ has_mtp = any(key.startswith("mtp.") or ".mtp." in key for key in all_keys)
389
+ has_unsanitized_conv = False
390
+ source_weights = SourceWeights(source, weight_map)
391
+ for key in all_keys:
392
+ if "conv1d.weight" in key and not should_drop(key):
393
+ if source_weights.get(key).shape[-1] != 1:
394
+ has_unsanitized_conv = True
395
+ break
396
+ shift_norm_weights = has_mtp or has_unsanitized_conv
397
+ log(
398
+ f"Qwen sanitizer flags: has_mtp={has_mtp}, "
399
+ f"unsanitized_conv1d={has_unsanitized_conv}, "
400
+ f"shift_norm_weights={shift_norm_weights}"
401
+ )
402
+
403
+ partial.mkdir(parents=True)
404
+ copy_metadata(source, partial)
405
+ shutil.copy2(runtime_source, partial / RUNTIME_FILE)
406
+ shutil.copy2(vlm_runtime_source, partial / VLM_RUNTIME_FILE)
407
+
408
+ quantization: Dict[str, str] = {}
409
+ output_weight_map: Dict[str, str] = {}
410
+ total_size = 0
411
+ shard_count = num_layers + 1 + bool(vision_keys)
412
+
413
+ # Global tensors: embeddings, final norm, and LM head.
414
+ global_output: Dict[str, mx.array] = {}
415
+ for prefix in dense_fp8:
416
+ if group_id_for_prefix(prefix) is None:
417
+ convert_dense_fp8(source_weights, prefix, global_output, quantization)
418
+ for prefix in dense_nvfp4:
419
+ if group_id_for_prefix(prefix) is None:
420
+ convert_dense_nvfp4(source_weights, prefix, global_output, quantization)
421
+ for key in global_standard_keys:
422
+ out_key, value = transform_standard_weight(
423
+ key, source_weights.get(key), shift_norm_weights
424
+ )
425
+ add_output(global_output, out_key, value)
426
+ total_size += write_shard(
427
+ partial,
428
+ f"model-{1:05d}-of-{shard_count:05d}.safetensors",
429
+ global_output,
430
+ output_weight_map,
431
+ )
432
+
433
+ for layer in range(num_layers):
434
+ layer_output: Dict[str, mx.array] = {}
435
+ log(f"Converting transformer layer {layer + 1}/{num_layers}")
436
+ for prefix in dense_fp8:
437
+ if group_id_for_prefix(prefix) == layer:
438
+ convert_dense_fp8(source_weights, prefix, layer_output, quantization)
439
+ for prefix in dense_nvfp4:
440
+ if group_id_for_prefix(prefix) == layer:
441
+ convert_dense_nvfp4(source_weights, prefix, layer_output, quantization)
442
+ for projection in ("gate_proj", "up_proj", "down_proj"):
443
+ convert_expert_projection(
444
+ source_weights,
445
+ layer,
446
+ projection,
447
+ expert_lookup,
448
+ num_experts,
449
+ layer_output,
450
+ quantization,
451
+ )
452
+ for key in layer_standard_keys[layer]:
453
+ out_key, value = transform_standard_weight(
454
+ key, source_weights.get(key), shift_norm_weights
455
+ )
456
+ add_output(layer_output, out_key, value)
457
+
458
+ total_size += write_shard(
459
+ partial,
460
+ f"model-{layer + 2:05d}-of-{shard_count:05d}.safetensors",
461
+ layer_output,
462
+ output_weight_map,
463
+ )
464
+ log(f"Finished transformer layer {layer + 1}/{num_layers}")
465
+
466
+ # Vision is unchanged by the AntiLoop adapter. Keep the original BF16
467
+ # tensors under their source names; the MLX-VLM runtime maps and sanitizes
468
+ # them. Arrays returned by mx.load remain lazy until the safetensors writer
469
+ # consumes them, so this does not materialize the source shard twice.
470
+ if vision_keys:
471
+ vision_output = {key: source_weights.get(key) for key in vision_keys}
472
+ total_size += write_shard(
473
+ partial,
474
+ f"model-{shard_count:05d}-of-{shard_count:05d}.safetensors",
475
+ vision_output,
476
+ output_weight_map,
477
+ )
478
+ log(f"Preserved {len(vision_keys)} vision tensors without requantization")
479
+
480
+ output_index = {
481
+ "metadata": {"total_size": total_size},
482
+ "weight_map": dict(sorted(output_weight_map.items())),
483
+ }
484
+ (partial / "model.safetensors.index.json").write_text(
485
+ json.dumps(output_index, indent=2, sort_keys=True) + "\n"
486
+ )
487
+
488
+ original_quantization = config.pop("quantization_config", None)
489
+ config.pop("quantization", None)
490
+ if isinstance(config.get("text_config"), dict):
491
+ config["text_config"].pop("quantization_config", None)
492
+ config["text_config"].pop("quantization", None)
493
+ config["model_file"] = RUNTIME_FILE
494
+ config["vlm_model_file"] = VLM_RUNTIME_FILE
495
+ config["mlx_modelopt_quantization"] = dict(sorted(quantization.items()))
496
+ config["mlx_hybrid_format"] = {
497
+ "format": "modelopt_fp8_nvfp4_v1",
498
+ "fp8_storage": "mxfp8_carrier_with_unit_e8m0_scales",
499
+ "nvfp4_storage": "native_e2m1_e4m3_with_output_tensor_scale",
500
+ "activations": "model_dtype_weight_only_quantized_matmul",
501
+ "source_activation_scales_retained": False,
502
+ "source_quantization_config": original_quantization,
503
+ }
504
+ (partial / "config.json").write_text(
505
+ json.dumps(config, indent=2, sort_keys=True) + "\n"
506
+ )
507
+
508
+ input_scales_dropped = sum(key.endswith(".input_scale") for key in all_keys)
509
+ manifest = {
510
+ "source": str(source),
511
+ "output": str(output),
512
+ "created_at": datetime.now(timezone.utc).isoformat(),
513
+ "converter": str(Path(__file__).resolve()),
514
+ "runtime_file": RUNTIME_FILE,
515
+ "vlm_runtime_file": VLM_RUNTIME_FILE,
516
+ "num_layers": num_layers,
517
+ "num_experts": num_experts,
518
+ "source_tensor_count": len(all_keys),
519
+ "output_tensor_count": len(output_weight_map),
520
+ "output_shards": shard_count,
521
+ "output_total_size_bytes": total_size,
522
+ "quantized_module_counts": dict(Counter(quantization.values())),
523
+ "input_scales_dropped": input_scales_dropped,
524
+ "weight_bytes_requantized": False,
525
+ "vision_tensor_count": len(vision_keys),
526
+ "vision_weight_bytes_requantized": False,
527
+ "norm_weights_shifted": shift_norm_weights,
528
+ }
529
+ (partial / "mlx_conversion_manifest.json").write_text(
530
+ json.dumps(manifest, indent=2, sort_keys=True) + "\n"
531
+ )
532
+
533
+ partial.rename(output)
534
+ log(
535
+ f"Conversion complete: {output} ({total_size / (1024**3):.2f} GiB, "
536
+ f"{len(output_weight_map)} tensors)"
537
+ )
538
+
539
+
540
+ def parse_args() -> argparse.Namespace:
541
+ parser = argparse.ArgumentParser(description=__doc__)
542
+ parser.add_argument("--source", type=Path, required=True)
543
+ parser.add_argument("--output", type=Path, required=True)
544
+ parser.add_argument(
545
+ "--runtime-source",
546
+ type=Path,
547
+ default=Path(__file__).with_name(RUNTIME_FILE),
548
+ )
549
+ parser.add_argument(
550
+ "--vlm-runtime-source",
551
+ type=Path,
552
+ default=Path(__file__).with_name(VLM_RUNTIME_FILE),
553
+ )
554
+ return parser.parse_args()
555
+
556
+
557
+ def main() -> None:
558
+ args = parse_args()
559
+ convert(
560
+ args.source,
561
+ args.output,
562
+ args.runtime_source.resolve(),
563
+ args.vlm_runtime_source.resolve(),
564
+ )
565
+
566
+
567
+ if __name__ == "__main__":
568
+ main()
generation_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 248044,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 248046,
6
+ 248044
7
+ ],
8
+ "pad_token_id": 248044,
9
+ "temperature": 1.0,
10
+ "top_k": 20,
11
+ "top_p": 0.95
12
+ }
mlx_conversion_manifest.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "converter": "convert_qwen36_modelopt_hybrid_to_mlx.py",
3
+ "created_at": "2026-07-10T03:37:44.758817+00:00",
4
+ "input_scales_dropped": 30971,
5
+ "multimodal_upgrade_at": "2026-07-10T04:02:39.296349+00:00",
6
+ "norm_weights_shifted": true,
7
+ "num_experts": 256,
8
+ "num_layers": 40,
9
+ "output": "mlx-community/Qwen3.6-35B-A3B-AntiLoop-NVFP4",
10
+ "output_shards": 42,
11
+ "output_tensor_count": 1808,
12
+ "output_total_size_bytes": 21758152396,
13
+ "quantized_module_counts": {
14
+ "scaled_mxfp8": 130,
15
+ "scaled_nvfp4": 121,
16
+ "scaled_nvfp4_switch": 120
17
+ },
18
+ "runtime_file": "modeling_mlx_qwen36_modelopt_hybrid.py",
19
+ "source": "N8Programs/Qwen3.6-35B-A3B-AntiLoop-NVFP4@1fc377564024dce4e8e7f2bdc04d34cd869f928f",
20
+ "source_tensor_count": 124468,
21
+ "vision_shard": "model-vision.safetensors",
22
+ "vision_tensor_count": 333,
23
+ "vision_tensor_data_bytes": 893142496,
24
+ "vision_weight_bytes_requantized": false,
25
+ "vlm_runtime_file": "modeling_mlx_vlm_qwen36_modelopt_hybrid.py",
26
+ "weight_bytes_requantized": false
27
+ }
mlx_vlm_model_file_loader.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Opt-in loader for model-local MLX-VLM architecture files.
2
+
3
+ MLX-VLM 0.6.4 does not yet consult ``vlm_model_file`` in a model config.
4
+ This module adds that one lookup in-process. It never edits the installed
5
+ ``mlx_vlm`` package, and it only executes model-local code when the caller has
6
+ explicitly passed ``trust_remote_code=True``.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import importlib.util
12
+ import sys
13
+ from contextvars import ContextVar
14
+ from pathlib import Path
15
+ from types import ModuleType
16
+ from typing import Any
17
+
18
+
19
+ _ACTIVE_MODEL_PATH: ContextVar[Path | None] = ContextVar(
20
+ "mlx_vlm_model_file_path", default=None
21
+ )
22
+ _ACTIVE_TRUST_REMOTE_CODE: ContextVar[bool] = ContextVar(
23
+ "mlx_vlm_model_file_trust", default=False
24
+ )
25
+ _MODULE_CACHE: dict[Path, ModuleType] = {}
26
+
27
+
28
+ def _load_local_module(model_path: Path, filename: str) -> ModuleType:
29
+ root = model_path.resolve()
30
+ module_path = (root / filename).resolve()
31
+
32
+ try:
33
+ module_path.relative_to(root)
34
+ except ValueError as exc:
35
+ raise ValueError(
36
+ f"vlm_model_file must stay inside the model directory: {filename!r}"
37
+ ) from exc
38
+
39
+ if module_path.suffix != ".py" or not module_path.is_file():
40
+ raise FileNotFoundError(f"Model-local MLX-VLM runtime not found: {module_path}")
41
+
42
+ cached = _MODULE_CACHE.get(module_path)
43
+ if cached is not None:
44
+ return cached
45
+
46
+ module_name = f"mlx_vlm_remote_{abs(hash(str(module_path))):x}"
47
+ spec = importlib.util.spec_from_file_location(module_name, module_path)
48
+ if spec is None or spec.loader is None:
49
+ raise ImportError(f"Could not import model-local runtime: {module_path}")
50
+
51
+ module = importlib.util.module_from_spec(spec)
52
+ sys.modules[module_name] = module
53
+ try:
54
+ spec.loader.exec_module(module)
55
+ except Exception:
56
+ sys.modules.pop(module_name, None)
57
+ raise
58
+
59
+ _MODULE_CACHE[module_path] = module
60
+ return module
61
+
62
+
63
+ def install() -> None:
64
+ """Install the model-file lookup into the current Python process."""
65
+
66
+ import mlx_vlm.utils as utils
67
+
68
+ if getattr(utils.get_model_and_args, "_model_file_loader_installed", False):
69
+ return
70
+
71
+ original_get_model_and_args = utils.get_model_and_args
72
+ original_load_model = utils.load_model
73
+
74
+ def get_model_and_args(config: dict, *args: Any, **kwargs: Any):
75
+ filename = config.get("vlm_model_file")
76
+ model_path = kwargs.get("model_path") or _ACTIVE_MODEL_PATH.get()
77
+
78
+ # Calls made later by processor setup do not carry a model path in
79
+ # MLX-VLM 0.6.4; let its native Qwen implementation handle those.
80
+ if not filename or model_path is None:
81
+ return original_get_model_and_args(config, *args, **kwargs)
82
+
83
+ trusted = bool(
84
+ kwargs.get("trust_remote_code", False)
85
+ or _ACTIVE_TRUST_REMOTE_CODE.get()
86
+ )
87
+ if not trusted:
88
+ raise PermissionError(
89
+ "This checkpoint includes a model-local MLX-VLM runtime. "
90
+ "Re-run with --trust-remote-code (or trust_remote_code=True)."
91
+ )
92
+
93
+ module = _load_local_module(Path(model_path), str(filename))
94
+ return module, f"model-local:{filename}"
95
+
96
+ def load_model(model_path: Path, lazy: bool = False, **kwargs: Any):
97
+ path_token = _ACTIVE_MODEL_PATH.set(Path(model_path))
98
+ trust_token = _ACTIVE_TRUST_REMOTE_CODE.set(
99
+ bool(kwargs.get("trust_remote_code", False))
100
+ )
101
+ try:
102
+ return original_load_model(model_path, lazy=lazy, **kwargs)
103
+ finally:
104
+ _ACTIVE_TRUST_REMOTE_CODE.reset(trust_token)
105
+ _ACTIVE_MODEL_PATH.reset(path_token)
106
+
107
+ get_model_and_args._model_file_loader_installed = True # type: ignore[attr-defined]
108
+ load_model._model_file_loader_installed = True # type: ignore[attr-defined]
109
+ utils.get_model_and_args = get_model_and_args
110
+ utils.load_model = load_model
111
+
112
+
113
+ def load(path_or_hf_repo: str, **kwargs: Any):
114
+ """Programmatic convenience wrapper around :func:`mlx_vlm.load`."""
115
+
116
+ install()
117
+ kwargs.setdefault("trust_remote_code", True)
118
+ from mlx_vlm import load as mlx_vlm_load
119
+
120
+ return mlx_vlm_load(path_or_hf_repo, **kwargs)
121
+
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
modeling_mlx_qwen36_modelopt_hybrid.py ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """MLX runtime for Qwen3.6 ModelOpt hybrid FP8/NVFP4 checkpoints.
2
+
3
+ The converter stores ModelOpt FP8 weights losslessly in MLX's packed MXFP8
4
+ carrier with unit E8M0 block scales, then applies the original per-tensor
5
+ ModelOpt scale to the output. ModelOpt NVFP4 weights and E4M3 block scales
6
+ are likewise retained bit-for-bit; their FP32 tensor scale is applied after
7
+ the matrix multiplication.
8
+
9
+ Activations remain in the model dtype. This avoids adding a second lossy
10
+ activation requantization scheme while still using MLX's native quantized
11
+ weight kernels.
12
+ """
13
+
14
+ from dataclasses import dataclass, field
15
+ from typing import Dict
16
+
17
+ import mlx.core as mx
18
+ import mlx.nn as nn
19
+ from mlx.utils import tree_flatten, tree_unflatten
20
+
21
+ from mlx_lm.models.base import BaseModelArgs
22
+ from mlx_lm.models.qwen3_5_moe import Model as BaseModel
23
+ from mlx_lm.models.switch_layers import SwitchLinear
24
+
25
+
26
+ @dataclass
27
+ class ModelArgs(BaseModelArgs):
28
+ model_type: str
29
+ text_config: dict
30
+ mlx_modelopt_quantization: Dict[str, str] = field(default_factory=dict)
31
+
32
+
33
+ class ScaledQuantizedLinear(nn.Module):
34
+ """Weight-quantized dense linear with an additional tensor scale."""
35
+
36
+ def __init__(
37
+ self,
38
+ input_dims: int,
39
+ output_dims: int,
40
+ *,
41
+ group_size: int,
42
+ bits: int,
43
+ mode: str,
44
+ bias: bool = False,
45
+ ):
46
+ super().__init__()
47
+ if input_dims % group_size:
48
+ raise ValueError(
49
+ f"input_dims={input_dims} is not divisible by group_size={group_size}"
50
+ )
51
+ if (input_dims * bits) % 32:
52
+ raise ValueError(
53
+ f"input_dims={input_dims}, bits={bits} cannot be packed into uint32"
54
+ )
55
+
56
+ self.group_size = group_size
57
+ self.bits = bits
58
+ self.mode = mode
59
+ self.weight = mx.zeros(
60
+ (output_dims, input_dims * bits // 32), dtype=mx.uint32
61
+ )
62
+ self.scales = mx.zeros(
63
+ (output_dims, input_dims // group_size), dtype=mx.uint8
64
+ )
65
+ self.global_scale = mx.ones((), dtype=mx.float32)
66
+ if bias:
67
+ self.bias = mx.zeros((output_dims,))
68
+ self.freeze()
69
+
70
+ @classmethod
71
+ def from_linear(cls, linear: nn.Module, kind: str):
72
+ output_dims, input_dims = linear.weight.shape
73
+ has_bias = linear.get("bias") is not None
74
+ if kind == "scaled_mxfp8":
75
+ params = dict(group_size=32, bits=8, mode="mxfp8")
76
+ elif kind == "scaled_nvfp4":
77
+ params = dict(group_size=16, bits=4, mode="nvfp4")
78
+ else:
79
+ raise ValueError(f"Unsupported dense quantization kind: {kind}")
80
+ return cls(input_dims, output_dims, bias=has_bias, **params)
81
+
82
+ def __call__(self, x):
83
+ y = mx.quantized_matmul(
84
+ x,
85
+ self["weight"],
86
+ self["scales"],
87
+ transpose=True,
88
+ group_size=self.group_size,
89
+ bits=self.bits,
90
+ mode=self.mode,
91
+ )
92
+ # Avoid promoting the residual stream to float32.
93
+ y = y * self["global_scale"].astype(y.dtype)
94
+ if "bias" in self:
95
+ y = y + self["bias"]
96
+ return y
97
+
98
+
99
+ class ScaledNVFP4SwitchLinear(nn.Module):
100
+ """Expert linear using MLX gather_qmm and per-expert tensor scales."""
101
+
102
+ group_size = 16
103
+ bits = 4
104
+ mode = "nvfp4"
105
+
106
+ def __init__(
107
+ self,
108
+ input_dims: int,
109
+ output_dims: int,
110
+ num_experts: int,
111
+ *,
112
+ bias: bool = False,
113
+ ):
114
+ super().__init__()
115
+ if input_dims % self.group_size:
116
+ raise ValueError(
117
+ f"input_dims={input_dims} is not divisible by {self.group_size}"
118
+ )
119
+ self.weight = mx.zeros(
120
+ (num_experts, output_dims, input_dims * self.bits // 32),
121
+ dtype=mx.uint32,
122
+ )
123
+ self.scales = mx.zeros(
124
+ (num_experts, output_dims, input_dims // self.group_size),
125
+ dtype=mx.uint8,
126
+ )
127
+ self.global_scales = mx.ones((num_experts,), dtype=mx.float32)
128
+ if bias:
129
+ self.bias = mx.zeros((num_experts, output_dims))
130
+ self.freeze()
131
+
132
+ @classmethod
133
+ def from_switch_linear(cls, linear: SwitchLinear):
134
+ num_experts, output_dims, input_dims = linear.weight.shape
135
+ has_bias = linear.get("bias") is not None
136
+ return cls(
137
+ input_dims,
138
+ output_dims,
139
+ num_experts,
140
+ bias=has_bias,
141
+ )
142
+
143
+ @property
144
+ def input_dims(self):
145
+ return self.scales.shape[2] * self.group_size
146
+
147
+ @property
148
+ def output_dims(self):
149
+ return self.weight.shape[1]
150
+
151
+ @property
152
+ def num_experts(self):
153
+ return self.weight.shape[0]
154
+
155
+ def __call__(self, x, indices, sorted_indices=False):
156
+ y = mx.gather_qmm(
157
+ x,
158
+ self["weight"],
159
+ self["scales"],
160
+ rhs_indices=indices,
161
+ transpose=True,
162
+ group_size=self.group_size,
163
+ bits=self.bits,
164
+ mode=self.mode,
165
+ sorted_indices=sorted_indices,
166
+ )
167
+ scale = self["global_scales"][indices].astype(y.dtype)[..., None, None]
168
+ y = y * scale
169
+ if "bias" in self:
170
+ y = y + mx.expand_dims(self["bias"][indices], -2)
171
+ return y
172
+
173
+
174
+ def _replace_quantized_modules(model: nn.Module, quantization: Dict[str, str]):
175
+ leaves = dict(
176
+ tree_flatten(model.leaf_modules(), is_leaf=lambda m: isinstance(m, nn.Module))
177
+ )
178
+ missing = sorted(set(quantization) - set(leaves))
179
+ if missing:
180
+ preview = "\n ".join(missing[:20])
181
+ raise ValueError(f"Quantized module paths are absent from the model:\n {preview}")
182
+
183
+ for path, kind in quantization.items():
184
+ module = leaves[path]
185
+ if kind in ("scaled_mxfp8", "scaled_nvfp4"):
186
+ if not isinstance(module, nn.Linear):
187
+ raise TypeError(f"{path} is {type(module).__name__}, expected Linear")
188
+ leaves[path] = ScaledQuantizedLinear.from_linear(module, kind)
189
+ elif kind == "scaled_nvfp4_switch":
190
+ if not isinstance(module, SwitchLinear):
191
+ raise TypeError(
192
+ f"{path} is {type(module).__name__}, expected SwitchLinear"
193
+ )
194
+ leaves[path] = ScaledNVFP4SwitchLinear.from_switch_linear(module)
195
+ else:
196
+ raise ValueError(f"Unknown quantization kind {kind!r} for {path}")
197
+
198
+ model.update_modules(tree_unflatten(list(leaves.items())))
199
+
200
+
201
+ class Model(BaseModel):
202
+ def __init__(self, args: ModelArgs):
203
+ super().__init__(args)
204
+ _replace_quantized_modules(self, args.mlx_modelopt_quantization)
205
+
modeling_mlx_vlm_qwen36_modelopt_hybrid.py ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """MLX-VLM runtime for Qwen3.6 ModelOpt hybrid FP8/NVFP4 checkpoints.
2
+
3
+ The language model keeps the lossless ModelOpt-to-MLX representation used by
4
+ ``modeling_mlx_qwen36_modelopt_hybrid.py``. The vision tower remains in its
5
+ original BF16 representation and is delegated to MLX-VLM's native Qwen3.5 MoE
6
+ vision implementation.
7
+
8
+ This module intentionally exports the same public symbols as an MLX-VLM model
9
+ package so a model-local loader can select it without changing ``model_type``.
10
+ """
11
+
12
+ from dataclasses import dataclass, field
13
+ from typing import Dict
14
+
15
+ import mlx.core as mx
16
+ import mlx.nn as nn
17
+ from mlx.utils import tree_flatten, tree_unflatten
18
+
19
+ from mlx_vlm.models.qwen3_5_moe import LanguageModel, TextConfig, VisionConfig
20
+ from mlx_vlm.models.qwen3_5_moe import Model as BaseModel
21
+ from mlx_vlm.models.qwen3_5_moe import ModelConfig as BaseModelConfig
22
+ from mlx_vlm.models.qwen3_5_moe import VisionModel
23
+ from mlx_vlm.models.switch_layers import SwitchLinear
24
+
25
+
26
+ @dataclass
27
+ class ModelConfig(BaseModelConfig):
28
+ mlx_modelopt_quantization: Dict[str, str] = field(default_factory=dict)
29
+
30
+
31
+ class ScaledQuantizedLinear(nn.Module):
32
+ """Weight-quantized dense linear with a ModelOpt tensor scale."""
33
+
34
+ def __init__(
35
+ self,
36
+ input_dims: int,
37
+ output_dims: int,
38
+ *,
39
+ group_size: int,
40
+ bits: int,
41
+ mode: str,
42
+ bias: bool = False,
43
+ ):
44
+ super().__init__()
45
+ if input_dims % group_size:
46
+ raise ValueError(
47
+ f"input_dims={input_dims} is not divisible by group_size={group_size}"
48
+ )
49
+ if (input_dims * bits) % 32:
50
+ raise ValueError(
51
+ f"input_dims={input_dims}, bits={bits} cannot be packed into uint32"
52
+ )
53
+
54
+ self.group_size = group_size
55
+ self.bits = bits
56
+ self.mode = mode
57
+ self.weight = mx.zeros(
58
+ (output_dims, input_dims * bits // 32), dtype=mx.uint32
59
+ )
60
+ self.scales = mx.zeros(
61
+ (output_dims, input_dims // group_size), dtype=mx.uint8
62
+ )
63
+ self.global_scale = mx.ones((), dtype=mx.float32)
64
+ if bias:
65
+ self.bias = mx.zeros((output_dims,))
66
+ self.freeze()
67
+
68
+ @classmethod
69
+ def from_linear(cls, linear: nn.Module, kind: str):
70
+ output_dims, input_dims = linear.weight.shape
71
+ has_bias = linear.get("bias") is not None
72
+ if kind == "scaled_mxfp8":
73
+ params = dict(group_size=32, bits=8, mode="mxfp8")
74
+ elif kind == "scaled_nvfp4":
75
+ params = dict(group_size=16, bits=4, mode="nvfp4")
76
+ else:
77
+ raise ValueError(f"Unsupported dense quantization kind: {kind}")
78
+ return cls(input_dims, output_dims, bias=has_bias, **params)
79
+
80
+ def __call__(self, x):
81
+ y = mx.quantized_matmul(
82
+ x,
83
+ self["weight"],
84
+ self["scales"],
85
+ transpose=True,
86
+ group_size=self.group_size,
87
+ bits=self.bits,
88
+ mode=self.mode,
89
+ )
90
+ y = y * self["global_scale"].astype(y.dtype)
91
+ if "bias" in self:
92
+ y = y + self["bias"]
93
+ return y
94
+
95
+
96
+ class ScaledNVFP4SwitchLinear(nn.Module):
97
+ """Expert linear using MLX gather_qmm and per-expert tensor scales."""
98
+
99
+ group_size = 16
100
+ bits = 4
101
+ mode = "nvfp4"
102
+
103
+ def __init__(
104
+ self,
105
+ input_dims: int,
106
+ output_dims: int,
107
+ num_experts: int,
108
+ *,
109
+ bias: bool = False,
110
+ ):
111
+ super().__init__()
112
+ if input_dims % self.group_size:
113
+ raise ValueError(
114
+ f"input_dims={input_dims} is not divisible by {self.group_size}"
115
+ )
116
+ self.weight = mx.zeros(
117
+ (num_experts, output_dims, input_dims * self.bits // 32),
118
+ dtype=mx.uint32,
119
+ )
120
+ self.scales = mx.zeros(
121
+ (num_experts, output_dims, input_dims // self.group_size),
122
+ dtype=mx.uint8,
123
+ )
124
+ self.global_scales = mx.ones((num_experts,), dtype=mx.float32)
125
+ if bias:
126
+ self.bias = mx.zeros((num_experts, output_dims))
127
+ self.freeze()
128
+
129
+ @classmethod
130
+ def from_switch_linear(cls, linear: SwitchLinear):
131
+ num_experts, output_dims, input_dims = linear.weight.shape
132
+ has_bias = linear.get("bias") is not None
133
+ return cls(input_dims, output_dims, num_experts, bias=has_bias)
134
+
135
+ @property
136
+ def input_dims(self):
137
+ return self.scales.shape[2] * self.group_size
138
+
139
+ @property
140
+ def output_dims(self):
141
+ return self.weight.shape[1]
142
+
143
+ @property
144
+ def num_experts(self):
145
+ return self.weight.shape[0]
146
+
147
+ def __call__(self, x, indices, sorted_indices=False):
148
+ y = mx.gather_qmm(
149
+ x,
150
+ self["weight"],
151
+ self["scales"],
152
+ rhs_indices=indices,
153
+ transpose=True,
154
+ group_size=self.group_size,
155
+ bits=self.bits,
156
+ mode=self.mode,
157
+ sorted_indices=sorted_indices,
158
+ )
159
+ scale = self["global_scales"][indices].astype(y.dtype)[..., None, None]
160
+ y = y * scale
161
+ if "bias" in self:
162
+ y = y + mx.expand_dims(self["bias"][indices], -2)
163
+ return y
164
+
165
+
166
+ def _replace_quantized_modules(model: nn.Module, quantization: Dict[str, str]):
167
+ leaves = dict(
168
+ tree_flatten(model.leaf_modules(), is_leaf=lambda m: isinstance(m, nn.Module))
169
+ )
170
+ missing = sorted(set(quantization) - set(leaves))
171
+ if missing:
172
+ preview = "\n ".join(missing[:20])
173
+ raise ValueError(f"Quantized module paths are absent from the model:\n {preview}")
174
+
175
+ for path, kind in quantization.items():
176
+ module = leaves[path]
177
+ if kind in ("scaled_mxfp8", "scaled_nvfp4"):
178
+ if not isinstance(module, nn.Linear):
179
+ raise TypeError(f"{path} is {type(module).__name__}, expected Linear")
180
+ leaves[path] = ScaledQuantizedLinear.from_linear(module, kind)
181
+ elif kind == "scaled_nvfp4_switch":
182
+ if not isinstance(module, SwitchLinear):
183
+ raise TypeError(
184
+ f"{path} is {type(module).__name__}, expected SwitchLinear"
185
+ )
186
+ leaves[path] = ScaledNVFP4SwitchLinear.from_switch_linear(module)
187
+ else:
188
+ raise ValueError(f"Unknown quantization kind {kind!r} for {path}")
189
+
190
+ model.update_modules(tree_unflatten(list(leaves.items())))
191
+
192
+
193
+ class Model(BaseModel):
194
+ def __init__(self, config: ModelConfig):
195
+ super().__init__(config)
196
+ _replace_quantized_modules(self, config.mlx_modelopt_quantization)
197
+
198
+ def sanitize(self, weights):
199
+ """Map only raw source keys; converted language keys are already sanitized."""
200
+ sanitized = {}
201
+ for key, value in weights.items():
202
+ if "mtp." in key:
203
+ continue
204
+ if key.startswith("model.language_model.visual"):
205
+ key = key.replace(
206
+ "model.language_model.visual", "vision_tower", 1
207
+ )
208
+ elif key.startswith("model.language_model"):
209
+ key = key.replace(
210
+ "model.language_model", "language_model.model", 1
211
+ )
212
+ elif key.startswith("model.visual"):
213
+ key = key.replace("model.visual", "vision_tower", 1)
214
+ elif key.startswith("lm_head"):
215
+ key = key.replace("lm_head", "language_model.lm_head", 1)
216
+ sanitized[key] = value
217
+ return sanitized
preprocessor_config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "size": {
3
+ "longest_edge": 16777216,
4
+ "shortest_edge": 65536
5
+ },
6
+ "patch_size": 16,
7
+ "temporal_patch_size": 2,
8
+ "merge_size": 2,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "processor_class": "Qwen3VLProcessor",
20
+ "image_processor_type": "Qwen2VLImageProcessorFast"
21
+ }
run_mlx_vlm.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Run the MLX-VLM generation CLI with model-local runtime support."""
2
+
3
+ from mlx_vlm_model_file_loader import install
4
+
5
+ install()
6
+
7
+ from mlx_vlm.generate.cli import main # noqa: E402
8
+
9
+
10
+ if __name__ == "__main__":
11
+ main()
12
+
run_mlx_vlm_server.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Run the MLX-VLM HTTP server with model-local runtime support."""
2
+
3
+ from mlx_vlm_model_file_loader import install
4
+
5
+ install()
6
+
7
+ from mlx_vlm.server.cli import main # noqa: E402
8
+
9
+
10
+ if __name__ == "__main__":
11
+ main()
12
+
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f9e4d4901a92b997e463c1f46055088b6cca5ca61a6522d1b9f64c4bb81cb42
3
+ size 12807982
tokenizer_config.json ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "248044": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "248045": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "248046": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "248047": {
29
+ "content": "<|object_ref_start|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "248048": {
37
+ "content": "<|object_ref_end|>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "248049": {
45
+ "content": "<|box_start|>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "248050": {
53
+ "content": "<|box_end|>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "248051": {
61
+ "content": "<|quad_start|>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "248052": {
69
+ "content": "<|quad_end|>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "248053": {
77
+ "content": "<|vision_start|>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "248054": {
85
+ "content": "<|vision_end|>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "248055": {
93
+ "content": "<|vision_pad|>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "248056": {
101
+ "content": "<|image_pad|>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "248057": {
109
+ "content": "<|video_pad|>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "248058": {
117
+ "content": "<tool_call>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": false
123
+ },
124
+ "248059": {
125
+ "content": "</tool_call>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": false
131
+ },
132
+ "248060": {
133
+ "content": "<|fim_prefix|>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": false
139
+ },
140
+ "248061": {
141
+ "content": "<|fim_middle|>",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": false
147
+ },
148
+ "248062": {
149
+ "content": "<|fim_suffix|>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": false
155
+ },
156
+ "248063": {
157
+ "content": "<|fim_pad|>",
158
+ "lstrip": false,
159
+ "normalized": false,
160
+ "rstrip": false,
161
+ "single_word": false,
162
+ "special": false
163
+ },
164
+ "248064": {
165
+ "content": "<|repo_name|>",
166
+ "lstrip": false,
167
+ "normalized": false,
168
+ "rstrip": false,
169
+ "single_word": false,
170
+ "special": false
171
+ },
172
+ "248065": {
173
+ "content": "<|file_sep|>",
174
+ "lstrip": false,
175
+ "normalized": false,
176
+ "rstrip": false,
177
+ "single_word": false,
178
+ "special": false
179
+ },
180
+ "248066": {
181
+ "content": "<tool_response>",
182
+ "lstrip": false,
183
+ "normalized": false,
184
+ "rstrip": false,
185
+ "single_word": false,
186
+ "special": false
187
+ },
188
+ "248067": {
189
+ "content": "</tool_response>",
190
+ "lstrip": false,
191
+ "normalized": false,
192
+ "rstrip": false,
193
+ "single_word": false,
194
+ "special": false
195
+ },
196
+ "248068": {
197
+ "content": "<think>",
198
+ "lstrip": false,
199
+ "normalized": false,
200
+ "rstrip": false,
201
+ "single_word": false,
202
+ "special": false
203
+ },
204
+ "248069": {
205
+ "content": "</think>",
206
+ "lstrip": false,
207
+ "normalized": false,
208
+ "rstrip": false,
209
+ "single_word": false,
210
+ "special": false
211
+ },
212
+ "248070": {
213
+ "content": "<|audio_start|>",
214
+ "lstrip": false,
215
+ "normalized": false,
216
+ "rstrip": false,
217
+ "single_word": false,
218
+ "special": true
219
+ },
220
+ "248071": {
221
+ "content": "<|audio_end|>",
222
+ "lstrip": false,
223
+ "normalized": false,
224
+ "rstrip": false,
225
+ "single_word": false,
226
+ "special": true
227
+ },
228
+ "248072": {
229
+ "content": "<tts_pad>",
230
+ "lstrip": false,
231
+ "normalized": false,
232
+ "rstrip": false,
233
+ "single_word": false,
234
+ "special": true
235
+ },
236
+ "248073": {
237
+ "content": "<tts_text_bos>",
238
+ "lstrip": false,
239
+ "normalized": false,
240
+ "rstrip": false,
241
+ "single_word": false,
242
+ "special": true
243
+ },
244
+ "248074": {
245
+ "content": "<tts_text_eod>",
246
+ "lstrip": false,
247
+ "normalized": false,
248
+ "rstrip": false,
249
+ "single_word": false,
250
+ "special": true
251
+ },
252
+ "248075": {
253
+ "content": "<tts_text_bos_single>",
254
+ "lstrip": false,
255
+ "normalized": false,
256
+ "rstrip": false,
257
+ "single_word": false,
258
+ "special": true
259
+ },
260
+ "248076": {
261
+ "content": "<|audio_pad|>",
262
+ "lstrip": false,
263
+ "normalized": false,
264
+ "rstrip": false,
265
+ "single_word": false,
266
+ "special": true
267
+ }
268
+ },
269
+ "additional_special_tokens": [
270
+ "<|im_start|>",
271
+ "<|im_end|>",
272
+ "<|object_ref_start|>",
273
+ "<|object_ref_end|>",
274
+ "<|box_start|>",
275
+ "<|box_end|>",
276
+ "<|quad_start|>",
277
+ "<|quad_end|>",
278
+ "<|vision_start|>",
279
+ "<|vision_end|>",
280
+ "<|vision_pad|>",
281
+ "<|image_pad|>",
282
+ "<|video_pad|>"
283
+ ],
284
+ "bos_token": null,
285
+ "chat_template": "{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- macro render_content(content, do_vision_count, is_system_content=false) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain images.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Picture ' ~ image_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|image_pad|><|vision_end|>' }}\n {%- elif 'video' in item or item.type == 'video' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain videos.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Video ' ~ video_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|video_pad|><|vision_end|>' }}\n {%- elif 'text' in item %}\n {{- item.text }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- if tools and tools is iterable and tools is not mapping %}\n {{- '<|im_start|>system\\n' }}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\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>' }}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {%- if content %}\n {{- '\\n\\n' + content }}\n {%- endif %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content, false)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if ns.multi_step_tool %}\n {{- raise_exception('No user query found in messages.') }}\n{%- endif %}\n{%- for message in messages %}\n {%- set content = render_content(message.content, true)|trim %}\n {%- if message.role == \"system\" %}\n {%- if not loop.first %}\n {{- raise_exception('System message must be at the beginning.') }}\n {%- endif %}\n {%- elif message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content|trim %}\n {%- if (preserve_thinking is defined and preserve_thinking is true) or (loop.index0 > ns.last_query_index) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- if loop.first %}\n {%- if content|trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role.') }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- else %}\n {{- '<think>\\n' }}\n {%- endif %}\n{%- endif %}",
286
+ "clean_up_tokenization_spaces": false,
287
+ "eos_token": "<|im_end|>",
288
+ "errors": "replace",
289
+ "model_max_length": 262144,
290
+ "pad_token": "<|endoftext|>",
291
+ "split_special_tokens": false,
292
+ "tokenizer_class": "Qwen2Tokenizer",
293
+ "unk_token": null,
294
+ "add_bos_token": false,
295
+ "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+",
296
+ "extra_special_tokens": {
297
+ "audio_bos_token": "<|audio_start|>",
298
+ "audio_eos_token": "<|audio_end|>",
299
+ "audio_token": "<|audio_pad|>",
300
+ "image_token": "<|image_pad|>",
301
+ "video_token": "<|video_pad|>",
302
+ "vision_bos_token": "<|vision_start|>",
303
+ "vision_eos_token": "<|vision_end|>"
304
+ }
305
+ }
video_preprocessor_config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "size": {
3
+ "longest_edge": 25165824,
4
+ "shortest_edge": 4096
5
+ },
6
+ "patch_size": 16,
7
+ "temporal_patch_size": 2,
8
+ "merge_size": 2,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "processor_class": "Qwen3VLProcessor",
20
+ "video_processor_type": "Qwen3VLVideoProcessor"
21
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff