williamliao commited on
Commit
bc57a64
·
verified ·
1 Parent(s): cd052ba

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -1,35 +1,11 @@
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
+ *.gguf filter=lfs diff=lfs merge=lfs -text
2
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.pt filter=lfs diff=lfs merge=lfs -text
5
+ *.pth filter=lfs diff=lfs merge=lfs -text
6
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
7
+ *.onnx filter=lfs diff=lfs merge=lfs -text
8
+ *.zip filter=lfs diff=lfs merge=lfs -text
9
+ *.7z filter=lfs diff=lfs merge=lfs -text
10
+ *.tar filter=lfs diff=lfs merge=lfs -text
11
+ *.tar.gz filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Qwen3.8-27B-NVFP4-Quality-v2.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:806b212652921a0c83131fcb23b08df755a678413a172e422c87e472bc9700d7
3
+ size 16058504512
Qwen3.8-27B-Unsloth-NVFP4-Q8.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71384eab8a4683e7469d4d98192f4025732f40fe11cabfb517bdb0cdc5483822
3
+ size 23172467872
README.md CHANGED
@@ -1,3 +1,355 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ base_model: Qwen/Qwen3.8-27B
4
+ base_model_relation: quantized
5
+ library_name: llama.cpp
6
+ tags:
7
+ - gguf
8
+ - llama.cpp
9
+ - nvfp4
10
+ - fp4
11
+ - mtp
12
+ - speculative-decoding
13
+ - qwen3.8
14
+ - qwen
15
+ pipeline_tag: text-generation
16
  ---
17
+
18
+ # Qwen3.8-27B NVFP4 GGUF
19
+
20
+ Experimental **Qwen3.8-27B NVFP4 GGUF** builds for **llama.cpp**, including two different conversion / quantization paths:
21
+
22
+ 1. **Qwen3.8-27B-NVFP4-Quality-v2** — my custom mixed-NVFP4 quantization made from the BF16 model.
23
+ 2. **Qwen3.8-27B-Unsloth-NVFP4-Q8** — converted from `unsloth/Qwen3.8-27B-NVFP4`.
24
+
25
+ These two files are **not equivalent quantizations** and should be treated as separate experiments.
26
+
27
+ Both are standalone target models with Qwen3.8's native MTP tensors included. They do not require a separate external draft model.
28
+
29
+ ## Variant 1: Qwen3.8-27B-NVFP4-Quality-v2
30
+
31
+ This is my preferred llama.cpp-oriented NVFP4 build.
32
+
33
+ ### Source and quantization path
34
+
35
+ ```text
36
+ Qwen/Qwen3.8-27B BF16
37
+
38
+ BF16 GGUF with native MTP
39
+
40
+ llama-quantize with per-tensor overrides
41
+
42
+ Qwen3.8-27B-NVFP4-Quality-v2.gguf
43
+ ```
44
+
45
+ The goal is not to force every tensor to NVFP4. Instead, large compute-heavy matrices use NVFP4 while selected tensors remain at higher precision.
46
+
47
+ ### Precision layout
48
+
49
+ Main transformer blocks:
50
+
51
+ - FFN down / gate / up: **NVFP4**
52
+ - Linear-attention QKV: **NVFP4**
53
+ - Linear-attention gate: **NVFP4**
54
+ - SSM output projection: **NVFP4**
55
+ - Full-attention Q projection: **NVFP4**
56
+ - Full-attention output projection: **NVFP4**
57
+ - Full-attention K / V: retained under the Q4_K_M mixed recipe
58
+ - Token embedding: **Q6_K**
59
+ - Output head: **Q6_K**
60
+ - Norm tensors: **F32**
61
+ - MTP FFN: **NVFP4**
62
+ - MTP `nextn.eh_proj`: retained under the Q4_K_M mixed recipe
63
+
64
+ The resulting dry-run size was:
65
+
66
+ ```text
67
+ model size = 52115.19 MiB (16.00 BPW)
68
+ quant size = 15304.10 MiB (4.70 BPW)
69
+ ```
70
+
71
+ This is roughly **16.0 GB decimal / 14.95 GiB** for the resulting GGUF.
72
+
73
+ ### Quantization recipe
74
+
75
+ The model was first converted to BF16 GGUF with native MTP included, then quantized with `llama-quantize`.
76
+
77
+ Example:
78
+
79
+ ```powershell
80
+ E:\git\llama.cpp\build\bin\Release\llama-quantize.exe `
81
+ --token-embedding-type q6_k `
82
+ --output-tensor-type q6_k `
83
+ --tensor-type-file "F:\qwen38-nvfp4-quality-v2.txt" `
84
+ "F:\Qwen3.8-27B-BF16-mtp.gguf" `
85
+ "F:\Qwen3.8-27B-NVFP4-Quality-v2.gguf" `
86
+ Q4_K_M
87
+ ```
88
+
89
+ This is a **new quantization from BF16**, not a repack of the Unsloth NVFP4 checkpoint.
90
+
91
+ ## Variant 2: Qwen3.8-27B-Unsloth-NVFP4-Q8
92
+
93
+ This variant is converted from:
94
+
95
+ ```text
96
+ unsloth/Qwen3.8-27B-NVFP4
97
+ ```
98
+
99
+ using a modified `convert_hf_to_gguf.py` with support for Qwen3.8 compressed-tensors mixed NVFP4 / FP8 layouts.
100
+
101
+ ### Important: this is NOT a 100% faithful restoration of the Unsloth checkpoint
102
+
103
+ The Unsloth source checkpoint uses **mixed-precision compressed-tensors** with multiple quantization groups.
104
+
105
+ During conversion:
106
+
107
+ - Packed NVFP4 tensors are repacked into llama.cpp's native GGUF NVFP4 representation.
108
+ - NVFP4 scale tensors are converted into the corresponding GGUF scale representation.
109
+ - FP8 tensors are dequantized by the converter.
110
+ - With `--fp8-as-q8`, those FP8 tensors are then written as **Q8_0** instead of preserving their original FP8 storage format.
111
+
112
+ Therefore:
113
+
114
+ > **Qwen3.8-27B-Unsloth-NVFP4-Q8 is not a bit-identical, numerically identical, or 100% format-faithful copy of `unsloth/Qwen3.8-27B-NVFP4`.**
115
+
116
+ It is better described as an **Unsloth-derived NVFP4/Q8 GGUF conversion for llama.cpp**.
117
+
118
+ The native NVFP4 portions are preserved through repacking, but the checkpoint's complete original mixed-precision representation is not reproduced exactly.
119
+
120
+ It should also not be assumed to behave identically to the original Unsloth checkpoint under Transformers, compressed-tensors, vLLM, or another reference runtime.
121
+
122
+ ### Conversion example
123
+
124
+ ```powershell
125
+ python convert_hf_to_gguf.py `
126
+ "E:\HF_MODELS\Qwen3.8-27B-NVFP4" `
127
+ --outfile "E:\HF_MODELS\Qwen3.8-27B-Unsloth-NVFP4-Q8.gguf" `
128
+ --outtype auto `
129
+ --fp8-as-q8 `
130
+ --verbose
131
+ ```
132
+
133
+ Because of the FP8 → Q8_0 conversion, this GGUF is significantly larger than the custom Quality-v2 build and required a more even GPU split in my test setup.
134
+
135
+ ## Compatibility
136
+
137
+ A recent **llama.cpp** build with:
138
+
139
+ - Qwen3.5/Qwen3.8 architecture support
140
+ - native NVFP4 tensor support
141
+ - native Qwen MTP speculative decoding
142
+
143
+ is required.
144
+
145
+ Tested on:
146
+
147
+ - Windows
148
+ - NVIDIA GeForce RTX 5070 Ti 16 GB
149
+ - NVIDIA GeForce RTX 5060 Ti 16 GB
150
+ - llama.cpp CUDA backend
151
+
152
+ Qwen3.8 is exposed through the `qwen35` architecture path in the tested llama.cpp build.
153
+
154
+ ## Suggested llama-server settings
155
+
156
+ ### Quality-v2 general-purpose setup
157
+
158
+ ```bat
159
+ llama-server.exe ^
160
+ -m "Qwen3.8-27B-NVFP4-Quality-v2.gguf" ^
161
+ -np 1 ^
162
+ --threads 12 ^
163
+ --threads-batch 16 ^
164
+ --split-mode layer ^
165
+ --tensor-split 70,30 ^
166
+ --ctx-size 81920 ^
167
+ --no-mmap ^
168
+ -ngl -1 ^
169
+ --flash-attn on ^
170
+ --jinja ^
171
+ --ubatch-size 256 ^
172
+ --batch-size 2048 ^
173
+ --fit off ^
174
+ --reasoning off ^
175
+ --spec-type draft-mtp ^
176
+ --spec-draft-n-max 3 ^
177
+ --spec-draft-p-min 0.60
178
+ ```
179
+
180
+ For this mixed-task benchmark, **`n_max = 3`** gave the best aggregate wall-clock result.
181
+
182
+ `n_max = 4` improved some highly predictable workloads such as JSON, repeated patterns, and code completion, but was slower overall.
183
+
184
+ ## Benchmark: Quality-v2
185
+
186
+ ### Base, MTP disabled
187
+
188
+ Configuration:
189
+
190
+ ```text
191
+ split-mode: layer
192
+ tensor-split: 70,30
193
+ ```
194
+
195
+ ```text
196
+ code_python 36.3 tok/s
197
+ code_cpp 36.6 tok/s
198
+ explain_concept 36.3 tok/s
199
+ summarize 36.6 tok/s
200
+ qa_factual 36.0 tok/s
201
+ translation 37.1 tok/s
202
+ creative_short 36.9 tok/s
203
+ stepwise_math 36.2 tok/s
204
+ json_output 36.0 tok/s
205
+ long_reasoning 36.2 tok/s
206
+ repeat_pattern 36.4 tok/s
207
+ code_completion 36.2 tok/s
208
+ long_code_review 36.0 tok/s
209
+
210
+ total wall time: 53.18 s
211
+ ```
212
+
213
+ ### MTP `n_max = 3`
214
+
215
+ ```text
216
+ code_python pred= 192 draft= 158 acc= 138 rate=0.873 tok/s=79.1
217
+ code_cpp pred= 53 draft= 42 acc= 40 rate=0.952 tok/s=81.4
218
+ explain_concept pred= 192 draft= 233 acc= 112 rate=0.481 tok/s=54.7
219
+ summarize pred= 47 draft= 45 acc= 31 rate=0.689 tok/s=68.2
220
+ qa_factual pred= 192 draft= 181 acc= 130 rate=0.718 tok/s=70.0
221
+ translation pred= 17 draft= 18 acc= 12 rate=0.667 tok/s=60.9
222
+ creative_short pred= 43 draft= 66 acc= 22 rate=0.333 tok/s=43.8
223
+ stepwise_math pred= 192 draft= 159 acc= 137 rate=0.862 tok/s=78.4
224
+ json_output pred= 192 draft= 148 acc= 141 rate=0.953 tok/s=83.4
225
+ long_reasoning pred= 192 draft= 180 acc= 131 rate=0.728 tok/s=71.1
226
+ repeat_pattern pred= 192 draft= 143 acc= 143 rate=1.000 tok/s=88.0
227
+ code_completion pred= 142 draft= 117 acc= 105 rate=0.897 tok/s=79.9
228
+ long_code_review pred= 192 draft= 242 acc= 109 rate=0.450 tok/s=52.6
229
+
230
+ Aggregate:
231
+ requests: 13
232
+ predicted tokens: 1838
233
+ draft tokens: 1732
234
+ accepted tokens: 1251
235
+ acceptance rate: 72.23%
236
+ total wall time: 29.11 s
237
+ ```
238
+
239
+ ### MTP `n_max = 4`
240
+
241
+ ```text
242
+ code_python pred= 192 draft= 157 acc= 145 rate=0.924 tok/s=78.9
243
+ code_cpp pred= 53 draft= 47 acc= 39 rate=0.830 tok/s=78.4
244
+ explain_concept pred= 192 draft= 188 acc= 109 rate=0.580 tok/s=44.2
245
+ summarize pred= 47 draft= 48 acc= 33 rate=0.688 tok/s=60.3
246
+ qa_factual pred= 192 draft= 173 acc= 131 rate=0.757 tok/s=59.7
247
+ translation pred= 17 draft= 17 acc= 13 rate=0.765 tok/s=50.8
248
+ creative_short pred= 43 draft= 27 acc= 19 rate=0.704 tok/s=35.6
249
+ stepwise_math pred= 192 draft= 170 acc= 140 rate=0.824 tok/s=71.7
250
+ json_output pred= 192 draft= 151 acc= 150 rate=0.993 tok/s=89.4
251
+ long_reasoning pred= 192 draft= 182 acc= 135 rate=0.742 tok/s=65.8
252
+ repeat_pattern pred= 192 draft= 152 acc= 152 rate=1.000 tok/s=99.2
253
+ code_completion pred= 142 draft= 122 acc= 108 rate=0.885 tok/s=83.1
254
+ long_code_review pred= 192 draft= 182 acc= 107 rate=0.588 tok/s=44.6
255
+
256
+ Aggregate:
257
+ requests: 13
258
+ predicted tokens: 1838
259
+ draft tokens: 1616
260
+ accepted tokens: 1281
261
+ acceptance rate: 79.27%
262
+ total wall time: 31.35 s
263
+ ```
264
+
265
+ ## Benchmark: Unsloth-derived NVFP4-Q8
266
+
267
+ Because this GGUF is larger, the tested configuration used:
268
+
269
+ ```text
270
+ split-mode: layer
271
+ tensor-split: 60,40
272
+ ```
273
+
274
+ ### Base, MTP disabled
275
+
276
+ ```text
277
+ code_python 25.9 tok/s
278
+ code_cpp 26.3 tok/s
279
+ explain_concept 25.8 tok/s
280
+ summarize 26.4 tok/s
281
+ qa_factual 26.1 tok/s
282
+ translation 27.2 tok/s
283
+ creative_short 26.1 tok/s
284
+ stepwise_math 26.1 tok/s
285
+ json_output 26.0 tok/s
286
+ long_reasoning 26.0 tok/s
287
+ repeat_pattern 26.1 tok/s
288
+ code_completion 26.0 tok/s
289
+ long_code_review 25.9 tok/s
290
+
291
+ total wall time: 75.10 s
292
+ ```
293
+
294
+ ### MTP `n_max = 4`
295
+
296
+ ```text
297
+ code_python pred= 192 draft= 178 acc= 142 rate=0.798 tok/s=53.0
298
+ code_cpp pred= 54 draft= 44 acc= 39 rate=0.886 tok/s=53.1
299
+ explain_concept pred= 192 draft= 181 acc= 105 rate=0.580 tok/s=30.9
300
+ summarize pred= 45 draft= 50 acc= 31 rate=0.620 tok/s=40.4
301
+ qa_factual pred= 192 draft= 174 acc= 128 rate=0.736 tok/s=40.3
302
+ translation pred= 17 draft= 18 acc= 13 rate=0.722 tok/s=35.2
303
+ creative_short pred= 37 draft= 28 acc= 17 rate=0.607 tok/s=25.0
304
+ stepwise_math pred= 192 draft= 176 acc= 140 rate=0.795 tok/s=49.8
305
+ json_output pred= 192 draft= 152 acc= 148 rate=0.974 tok/s=60.4
306
+ long_reasoning pred= 192 draft= 161 acc= 130 rate=0.807 tok/s=43.5
307
+ repeat_pattern pred= 192 draft= 152 acc= 152 rate=1.000 tok/s=68.6
308
+ code_completion pred= 191 draft= 162 acc= 150 rate=0.926 tok/s=63.7
309
+ long_code_review pred= 192 draft= 167 acc= 113 rate=0.677 tok/s=34.4
310
+
311
+ Aggregate:
312
+ requests: 13
313
+ predicted tokens: 1880
314
+ draft tokens: 1643
315
+ accepted tokens: 1308
316
+ acceptance rate: 79.61%
317
+ total wall time: 44.70 s
318
+ ```
319
+
320
+ ## Comparison
321
+
322
+ The custom Quality-v2 build is smaller and substantially faster on the tested dual-GPU system.
323
+
324
+ However, the two files are not an apples-to-apples quantization comparison:
325
+
326
+ - Quality-v2 is a new mixed quantization generated from BF16.
327
+ - The Unsloth-derived build repacks the source NVFP4 tensors but converts source FP8 tensors to Q8_0.
328
+ - The Unsloth-derived file is larger and required a different GPU split (`60,40` instead of `70,30`).
329
+ - Different tensor layouts and GPU splits affect performance independently of model quality.
330
+
331
+ Therefore these benchmark numbers should be interpreted as **practical llama.cpp deployment results**, not as proof that one quantization method has universally better model quality.
332
+
333
+ No model-quality benchmark against BF16 was performed here.
334
+
335
+ ## Notes
336
+
337
+ - Both GGUFs contain the full target model and native MTP tensors.
338
+ - Native MTP speculative decoding changes generation throughput but does not provide the same type of acceleration for prompt prefill.
339
+ - Higher draft acceptance does not necessarily mean lower wall-clock time.
340
+ - Predictable outputs such as JSON, repeated patterns, and code completion benefit more from longer MTP drafts.
341
+ - Open-ended explanations, creative writing, and long code review generally lose speculative efficiency sooner.
342
+ - Performance depends heavily on llama.cpp build, GPU split, context size, KV-cache format, sampling parameters, and PCIe topology.
343
+ - The Unsloth-derived build should not be described as a 100% faithful reproduction of the original Unsloth compressed-tensors checkpoint.
344
+
345
+ ## Credits
346
+
347
+ - **Qwen Team / Alibaba Cloud** — Qwen3.8-27B
348
+ - **Unsloth** — Qwen3.8-27B-NVFP4 source checkpoint used for the derived conversion experiment
349
+ - **ggml-org** — llama.cpp, GGUF, NVFP4 inference support, and native MTP support
350
+
351
+ ## License
352
+
353
+ The source model is distributed under the **Apache License 2.0**.
354
+
355
+ Users should review the upstream `Qwen/Qwen3.8-27B` and `unsloth/Qwen3.8-27B-NVFP4` model cards before redistribution or commercial use.