Dyluhn commited on
Commit
e39afc6
Β·
verified Β·
1 Parent(s): 7e2e59d

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +124 -0
README.md ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: lordx64/Qwen3.6-35B-A3B-Claude-4.7-Opus-Reasoning-Distilled
4
+ tags:
5
+ - gguf
6
+ - llama.cpp
7
+ - mtp
8
+ - speculative-decoding
9
+ - qwen3.6
10
+ - reasoning
11
+ - chain-of-thought
12
+ - mixture-of-experts
13
+ - imatrix
14
+ language:
15
+ - en
16
+ pipeline_tag: text-generation
17
+ ---
18
+
19
+ # Qwen3.6-35B-A3B Claude 4.7 Opus Distill β€” MTP-Enabled GGUF
20
+
21
+ MTP-enabled GGUF quantizations of [lordx64/Qwen3.6-35B-A3B-Claude-4.7-Opus-Reasoning-Distilled](https://huggingface.co/lordx64/Qwen3.6-35B-A3B-Claude-4.7-Opus-Reasoning-Distilled), a Claude Opus 4.7 reasoning-style distillation of Qwen 3.6 35B-A3B.
22
+
23
+ ## What's different from the official quants
24
+
25
+ - **MTP (Multi-Token Prediction) head preserved.** Enables ~25% generation speedup on code workloads via `--spec-type mtp` in llama.cpp servers built from [am17an's PR #22673](https://github.com/ggml-org/llama.cpp/pull/22673). The official lordx64 quants don't include MTP support.
26
+ - **Imatrix calibration** on the Q4-class quants, using [tristandruyen's calibration_data_v5_rc.txt](https://gist.github.com/tristandruyen/9e207a95c7d75ddf37525d353e00659c) β€” a MoE-aware fork of bartowski's calibration_datav3 that exercises more experts during calibration. 125 chunks at 512 tokens.
27
+
28
+ ## Files
29
+
30
+ | File | Quant | Size | imatrix | Use case |
31
+ |------|-------|------|---------|----------|
32
+ | `lordx64-distill-MTP-Q8_0.gguf` | Q8_0 | 35 GB | No | Near-lossless reference / re-quantization base |
33
+ | `lordx64-distill-MTP-Q4_K_M.gguf` | Q4_K_M | 20 GB | Yes | Balanced quality/size β€” default pick for most users |
34
+ | `lordx64-distill-MTP-IQ4_XS.gguf` | IQ4_XS | 18 GB | Yes | Smallest with good quality β€” best for tight VRAM |
35
+ | `lordx64-imatrix.dat` | β€” | 187 MB | β€” | Calibration data for users producing their own quants |
36
+
37
+ A note on the Q8_0: it was quantized without imatrix because Q8_0 is high-precision enough that imatrix gains are negligible (~0.05% perplexity, effectively noise). Most public Q8_0 quants are non-imatrix for the same reason.
38
+
39
+ A note on the MTP head's `eh_proj` tensor: imatrix calibration runs forward passes through the base model only, so the MTP-specific tensors don't get importance data. They fall back to default IQ4_XS / Q4_K_M for those quants. In practice this slightly reduces drafter accuracy on creative content but doesn't break anything.
40
+
41
+ ## Requirements
42
+
43
+ This GGUF requires a llama.cpp build with MTP support. Pre-merge, that means [am17an's `mtp-clean` branch](https://github.com/am17an/llama.cpp/tree/mtp-clean). Built and tested at commit `267f8af`.
44
+
45
+ You can run these GGUFs on stock llama.cpp without MTP β€” you just won't get the speedup. The MTP head sits as an extra block in the file (block 40, after the 40 base layers) and is ignored by builds that don't understand `qwen35moe_mtp` architecture.
46
+
47
+ ## Usage with llama-server
48
+
49
+ ```bash
50
+ llama-server \
51
+ -m lordx64-distill-MTP-Q4_K_M.gguf \
52
+ --host 0.0.0.0 --port 8086 \
53
+ -ngl 99 --parallel 1 \
54
+ --ctx-size 32768 \
55
+ --cache-type-k q8_0 --cache-type-v q8_0 \
56
+ --flash-attn on --jinja \
57
+ --chat-template-kwargs '{"enable_thinking": true, "preserve_thinking": true}' \
58
+ --reasoning-budget 4096 \
59
+ --temp 0.6 --top-k 20 --top-p 0.95 --min-p 0 \
60
+ --spec-type mtp --spec-draft-n-max 2
61
+ ```
62
+
63
+ **Flag notes:**
64
+ - `--parallel 1` is required. MTP currently doesn't support multi-slot serving.
65
+ - `--spec-draft-n-max 2` is optimal for code/structured generation. For prose/creative writing, use `--spec-draft-n-max 1` β€” the LoRA distribution shift reduces drafter alignment on creative content, and n=1 gives a more reliable speedup there.
66
+ - `--cache-type-k q8_0 --cache-type-v q8_0` saves significant VRAM at long contexts with minimal quality cost.
67
+ - `--reasoning-budget 4096` caps the `<think>` block length. Hard problems (competition math, multi-step logic) may benefit from raising this to 16384 at the cost of latency.
68
+
69
+ ## Benchmarks
70
+
71
+ Tested on AMD Radeon 780M iGPU (RDNA3, Vulkan backend, ~75 GB/s memory bandwidth):
72
+
73
+ | Config | Code tok/s | Code accept | Prose tok/s | Prose accept |
74
+ |--------|-----------|-------------|-------------|--------------|
75
+ | IQ4_XS baseline (no MTP) | 27.07 | β€” | 26.82 | β€” |
76
+ | IQ4_XS + MTP n=2 | ~33.76 | 89-91% | ~26.36 | 51-65% |
77
+
78
+ Code workload sees a clean ~25% speedup. Prose workload at n=2 is roughly neutral due to lower drafter acceptance on open-ended creative content β€” drop to n=1 for a small positive gain on prose.
79
+
80
+ For comparison, the unmodified Qwen 3.6 35B-A3B base model with MTP (Q4_0, no imatrix) on the same hardware:
81
+
82
+ | Config | Code | Prose |
83
+ |--------|------|-------|
84
+ | Base baseline (no MTP) | 29.07 | 29.07 |
85
+ | Base + MTP n=2 | 35.92 | 30.15 |
86
+
87
+ The slightly lower throughput on the distill vs base model is expected:
88
+ - IQ4_XS uses lookup tables (~6% slower than Q4_0)
89
+ - The attention-only LoRA shifts the target distribution slightly, reducing drafter alignment on creative content (acceptance drops from ~67% to 51-65% on prose)
90
+
91
+ These tradeoffs are inherent to the model+quantization combination, not the build process.
92
+
93
+ ## Limitations
94
+
95
+ - **Drafter alignment on creative content.** The MTP head was trained against the original Qwen attention. lordx64's distill applies an attention-only LoRA, which shifts the target distribution. Drafter acceptance is high on code (89-91%) but lower on prose (51-65%).
96
+ - **Single-stream only.** MTP currently requires `--parallel 1` β€” no concurrent generations. Fine for personal use; not suitable for multi-user serving.
97
+ - **Pre-merge dependency.** Built against am17an's branch. Future llama.cpp changes may break compatibility until MTP merges into mainline. Recommend pinning your llama.cpp build to a known-working commit.
98
+ - **MTP head not imatrix-calibrated.** As noted above, this slightly degrades drafter precision but doesn't break inference.
99
+
100
+ ## Reproducibility
101
+
102
+ Build pipeline:
103
+ 1. Downloaded BF16 safetensors from upstream lordx64 repo (72 GB)
104
+ 2. Converted via am17an's `convert_hf_to_gguf.py` β€” handles `Qwen3_5MoeForConditionalGeneration` natively, strips the `model.language_model.*` wrapper automatically, drops vision tower tensors, remaps MTP namespace
105
+ 3. Generated BF16 GGUF (~70 GB)
106
+ 4. Quantized to Q8_0 with `llama-quantize` (no imatrix needed for Q8_0)
107
+ 5. Ran imatrix calibration on the Q8_0 file using calibration_data_v5_rc.txt β€” 125 chunks at 512 tokens, partial GPU offload on RX 6700XT via Vulkan
108
+ 6. Quantized BF16 β†’ Q4_K_M and BF16 β†’ IQ4_XS using the imatrix
109
+
110
+ The imatrix file is included in this repo for users who want to run their own quants from upstream BF16.
111
+
112
+ ## License
113
+
114
+ Apache 2.0, inherited from upstream Qwen 3.6 and lordx64's distill.
115
+
116
+ ## Acknowledgements
117
+
118
+ - [lordx64](https://huggingface.co/lordx64) β€” the underlying reasoning distillation
119
+ - [am17an](https://github.com/am17an) β€” MTP implementation in llama.cpp ([PR #22673](https://github.com/ggml-org/llama.cpp/pull/22673))
120
+ - [bartowski](https://huggingface.co/bartowski) β€” the original calibration_datav3 dataset
121
+ - [tristandruyen](https://gist.github.com/tristandruyen) β€” MoE-aware calibration_data_v5_rc fork
122
+ - [bombdefuser-124](https://huggingface.co/bombdefuser-124) β€” Q4_0 reference GGUF used for benchmark comparison
123
+ - Qwen team β€” the open-weights base model
124
+ - Anthropic β€” Claude Opus 4.7, the teacher model lordx64 used for reasoning distillation