programmer-666 commited on
Commit
652a15c
·
verified ·
1 Parent(s): cd3d442

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +198 -0
README.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3.6-35B-A3B
4
+ base_model_relation: quantized
5
+ tags:
6
+ - mlx
7
+ - mlx-optiq
8
+ - quantized
9
+ - oq8
10
+ - mixed-precision
11
+ - multi-token-prediction
12
+ - mtp
13
+ - moe
14
+ - qwen3.6
15
+ pipeline_tag: text-generation
16
+ library_name: mlx
17
+ model-index:
18
+ - name: Qwen3.6-35B-A3B-oQ8-mtp
19
+ results:
20
+ - task:
21
+ type: text-generation
22
+ name: Text Generation
23
+ dataset:
24
+ name: MMLU-Pro
25
+ type: TIGER-Lab/MMLU-Pro
26
+ config: sampled_300_of_12032
27
+ split: test
28
+ metrics:
29
+ - name: Accuracy
30
+ type: accuracy
31
+ value: 81.0
32
+ verified: false
33
+ source:
34
+ name: Self-reported (local eval, M4 Max 128GB, MTP off)
35
+ url: https://huggingface.co/programmer-666/Qwen3.6-35B-A3B-oQ8-mtp
36
+ - task:
37
+ type: text-generation
38
+ name: Text Generation
39
+ dataset:
40
+ name: MathQA
41
+ type: allenai/math_qa
42
+ config: sampled_30_of_2985
43
+ split: test
44
+ metrics:
45
+ - name: Accuracy
46
+ type: accuracy
47
+ value: 93.3
48
+ verified: false
49
+ source:
50
+ name: Self-reported (local eval, M4 Max 128GB, MTP off)
51
+ url: https://huggingface.co/programmer-666/Qwen3.6-35B-A3B-oQ8-mtp
52
+ - task:
53
+ type: text-generation
54
+ name: Text Generation
55
+ dataset:
56
+ name: HumanEval
57
+ type: openai_humaneval
58
+ split: test
59
+ metrics:
60
+ - name: pass@1
61
+ type: pass@1
62
+ value: 96.3
63
+ verified: false
64
+ source:
65
+ name: Self-reported (local eval, M4 Max 128GB, MTP off)
66
+ url: https://huggingface.co/programmer-666/Qwen3.6-35B-A3B-oQ8-mtp
67
+ - task:
68
+ type: text-generation
69
+ name: Text Generation
70
+ dataset:
71
+ name: MBPP
72
+ type: mbpp
73
+ config: sampled_200_of_500
74
+ split: test
75
+ metrics:
76
+ - name: pass@1
77
+ type: pass@1
78
+ value: 93.5
79
+ verified: false
80
+ source:
81
+ name: Self-reported (local eval, M4 Max 128GB, MTP off)
82
+ url: https://huggingface.co/programmer-666/Qwen3.6-35B-A3B-oQ8-mtp
83
+ - task:
84
+ type: text-generation
85
+ name: Text Generation
86
+ dataset:
87
+ name: LiveCodeBench
88
+ type: livecodebench/code_generation_lite
89
+ config: sampled_100_of_1055
90
+ split: test
91
+ metrics:
92
+ - name: pass@1
93
+ type: pass@1
94
+ value: 52.0
95
+ verified: false
96
+ source:
97
+ name: Self-reported (local eval, M4 Max 128GB, MTP off)
98
+ url: https://huggingface.co/programmer-666/Qwen3.6-35B-A3B-oQ8-mtp
99
+ ---
100
+
101
+ # Qwen3.6-35B-A3B-oQ8-mtp
102
+
103
+ An oQ8 mixed-precision quantization of [Qwen/Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B) for [MLX](https://github.com/ml-explore/mlx), quantized with [mlx-optiq](https://github.com/ml-explore/mlx), with Multi-Token Prediction (MTP) heads grafted on from the reference `mtp.safetensors` structure.
104
+
105
+ This repo also includes benchmark data comparing MTP on vs. off ([MTP Performance](#mtp-performance)) and quality benchmarks for the quantized checkpoint ([Intelligence Benchmarks](#intelligence-benchmarks)) below. Summary on MTP: in this setup, enabling it does not provide a token generation speedup, and in single-request decoding it is measurably slower.
106
+
107
+ ## Model Details
108
+
109
+ - **Base model:** [Qwen/Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B) (Apache 2.0), a sparse MoE model with 35B total parameters and about 3B active parameters, with a 262,144 token native context extensible to about 1,010,000.
110
+ - **Quantization method:** [mlx-optiq](https://github.com/ml-explore/mlx), oQ8, a mixed-precision quantization targeting about 8-bit average bits per weight, with sensitive layers kept at higher precision.
111
+ - **MTP heads:** Grafted from the official Qwen3.6 reference `mtp.safetensors` structure (37 tensors, `group_size=64`), reverse-engineered to match the base model's MTP layer layout so the quantized checkpoint can run with speculative or MTP decoding enabled.
112
+ - **Format:** MLX-native safetensors, quantized for use with an MLX inference server (tested with [oMLX](https://github.com/ml-explore/mlx)).
113
+ - **Intended hardware:** Apple Silicon with unified memory (developed and tested on an M4 Max, 128GB).
114
+
115
+ ## Usage
116
+
117
+ ```bash
118
+ # with an oMLX-compatible server
119
+ omlx serve --model programmer-666/Qwen3.6-35B-A3B-oQ8-mtp
120
+ ```
121
+
122
+ ```python
123
+ # or load directly with mlx-lm
124
+ from mlx_lm import load, generate
125
+
126
+ model, tokenizer = load("programmer-666/Qwen3.6-35B-A3B-oQ8-mtp")
127
+ response = generate(
128
+ model, tokenizer,
129
+ prompt="Explain multi-token prediction in one paragraph.",
130
+ max_tokens=256,
131
+ )
132
+ print(response)
133
+ ```
134
+
135
+ To run without MTP, disable speculative decoding in your server config. The base weights are unaffected, and inference falls back to standard autoregressive decoding.
136
+
137
+ ## MTP Performance
138
+
139
+ Benchmarks below compare this checkpoint with MTP enabled vs. MTP disabled, on the same hardware (M4 Max, 128GB unified memory), same prompt and generation lengths, and same inference server.
140
+
141
+ ### Single Request Decoding
142
+
143
+ | Test | tg TPS (MTP On) | tg TPS (MTP Off) | Δ tg TPS | TTFT (MTP On, ms) | TTFT (MTP Off, ms) | Peak Mem (MTP On, GB) | Peak Mem (MTP Off, GB) |
144
+ |---|---|---|---|---|---|---|---|
145
+ | pp1024/tg128 | 81.5 | 83.0 | -1.8% | 810.8 | 817.2 | 36.22 | 35.38 |
146
+ | pp4096/tg128 | 79.8 | 90.5 | -11.8% | 2491.8 | 2590.2 | 37.00 | 36.16 |
147
+ | pp8192/tg128 | 74.8 | 90.2 | -17.1% | 5331.6 | 5235.2 | 37.34 | 36.50 |
148
+ | pp16384/tg128 | 70.9 | 86.0 | -17.6% | 12701.4 | 12424.1 | 37.97 | 37.13 |
149
+ | pp32768/tg128 | 64.7 | 77.6 | -16.6% | 31601.0 | 30047.3 | 39.31 | 38.47 |
150
+ | pp65536/tg128 | 52.9 | 63.2 | -16.3% | 82607.3 | 80079.9 | 42.00 | 41.15 |
151
+ | pp131072/tg128 | 32.6 | 36.8 | -11.4% | 328400.7 | 344694.8 | 47.37 | 46.53 |
152
+ | pp200000/tg128 | 24.1 | 28.7 | -16.0% | 695737.6 | 700247.4 | 53.03 | 52.19 |
153
+
154
+ - Token generation throughput (tg TPS) is consistently lower with MTP enabled, by an average of about 13.6% across context lengths, with the gap widening to 14 to 18% slower once context exceeds about 4K tokens.
155
+ - Peak memory is about 2.1% higher with MTP enabled across the board (the extra MTP head weights and their activation buffers).
156
+ - TTFT (prefill) is roughly a wash, about 0.3% average difference with no consistent direction. MTP heads don't participate in prefill, so this is expected and mostly run to run noise.
157
+
158
+ ### Continuous Batching
159
+
160
+ | Batch | tg TPS (MTP On) | tg TPS (MTP Off) | Δ tg TPS | Speedup (MTP On) | Speedup (MTP Off) |
161
+ |---|---|---|---|---|---|
162
+ | 1x | 81.5 | 83.0 | -1.8% | 1.00x | 1.00x |
163
+ | 2x | 120.1 | 128.6 | -6.6% | 1.47x | 1.55x |
164
+ | 4x | 133.8 | 138.5 | -3.4% | 1.64x | 1.67x |
165
+ | 8x | 168.8 | 167.5 | +0.8% | 2.07x | 2.02x |
166
+
167
+ Under continuous batching, the gap mostly closes. MTP is within noise of the no-MTP baseline (-6.6% to +0.8%), with no consistent advantage at any batch size.
168
+
169
+ ### Takeaway
170
+
171
+ MTP head grafting is functional (weights load, model runs, output is correct), but in this MLX/oMLX inference setup, enabling MTP does not deliver a speculative decoding speedup, and for single-request decoding it does the opposite. This is most likely because the MTP head isn't yet wired into an actual speculative decode/verify loop in the serving stack; it currently just adds a forward pass and memory overhead without skipping any accept-reject cycle. Treat the MTP tensors in this repo as a structurally correct starting point for that integration work, not as a ready speedup.
172
+
173
+ If you get MTP-accelerated decoding working with this checkpoint on a different server or runtime, opening a discussion on this repo with your results would be very welcome.
174
+
175
+ ## Intelligence Benchmarks
176
+
177
+ Quality checks run on this quantized checkpoint with MTP disabled (thinking mode enabled for all runs). Equivalent runs with MTP enabled are in progress and will be added once complete; MTP only affects decoding strategy, not the model's weights, so these numbers reflect the checkpoint's underlying quality regardless of MTP status, but a direct on/off comparison isn't available yet.
178
+
179
+ These results are also embedded as structured `model-index` metadata in this README's YAML header, so they will surface in the Hub's evaluation results widget on the model page. Several benchmarks use a sampled subset rather than the full set, so treat MathQA and LiveCodeBench results (30 and 100 samples respectively) as indicative rather than tight estimates. MMLU-Pro, MBPP, and especially the full-set HumanEval run are more reliable.
180
+
181
+ | Benchmark | Accuracy | Correct / Total | Sampled | Time (s) | Thinking |
182
+ |---|---|---|---|---|---|
183
+ | MMLU-Pro | 81.0% | 243 / 300 | 300 / 12,032 | 8,867.2 | Yes |
184
+ | MathQA | 93.3% | 28 / 30 | 30 / 2,985 | 1,113.5 | Yes |
185
+ | HumanEval | 96.3% | 158 / 164 | 164 / 164 (full) | 5,940.7 | Yes |
186
+ | MBPP | 93.5% | 187 / 200 | 200 / 500 | 7,483.3 | Yes |
187
+ | LiveCodeBench | 52.0% | 52 / 100 | 100 / 1,055 | 20,696.7 | Yes |
188
+
189
+ Quantization to oQ8 preserves strong coding performance (HumanEval, MBPP) and general knowledge (MMLU-Pro) close to what's expected of the base model. LiveCodeBench, the hardest and most contamination-resistant of these, comes in noticeably lower, which lines up with it being the more demanding, competition-style coding benchmark rather than being oQ8-specific degradation. A same-precision base-model run on the same subset would be needed to isolate a quantization effect there.
190
+
191
+ ## Quantization Notes
192
+
193
+ - Quantized with `mlx-optiq` targeting oQ8 mixed precision. Comparable full-precision/oQ7 runs on the same base architecture landed around 37GB, so expect a similar footprint here (see [Files and versions](.) for exact sizes).
194
+ - No calibration or fine-tuning was performed beyond quantization and MTP head grafting; this is a direct weight-space conversion of the base model.
195
+
196
+ ## License
197
+
198
+ This is a derivative of [Qwen/Qwen3.6-35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B), released under the Apache 2.0 license. See the base model card for full terms, intended use, and limitations.