Qwen3.5-9B Q4_K_M imatrix GGUF + Native MTP head(Lynn 本地智能体推荐版 v2)
这是 Lynn 首发本地 9B 路线 Qwen3.5-9B GGUF 量化包 v2 升级版:vendor 自带的 MTP(Multi-Token Prediction)head 完整保留,llama.cpp --spec-type draft-mtp 启用后单流 TPS +44% / thinking 长链 +144%。
定位:本地 9B,日常无限用,这次还更快。
English summary: this is Lynn's recommended Qwen3.5-9B Q4_K_M imatrix GGUF — v2 upgrade with vendor-native MTP head bundled. Run with llama-server --spec-type draft-mtp for +44% single-stream TPS on short outputs and +144% sustained TPS on long thinking-on reasoning. Apple/CUDA llama.cpp builds since late 2025 all support this path natively (graph_mtp for qwen3_5 model_type).
文件 / Files
| 文件 | 大小 | SHA256 | 备注 |
|---|
Qwen3.5-9B-Q4_K_M-imatrix-mtp.gguf | 5.38 GB | 0f292ba0d1058065a6624883a76a2adf00b266d07b9396ed67b155ff522e18d4 | 含 15 个 MTP tensors(mtp.fc/norm/layers.0.{mlp,self_attn,...}),Lynn imatrix 校准 Q4_K_M |
imatrix.gguf | 5.0 MB | 3fdab7f5d1b59a7bb1d68b5278cbb5c8e50f03e5ed09a8b02f117186755796a8 | wikitext-2-raw 100 chunks × 512 ctx,可复现量化 |
v2 vs v1 区别:v1 (Qwen3.5-9B-Q4_K_M-imatrix.gguf 5.89GB) 是 2026-05 早期 convert,MTP tensors 在 convert 阶段被丢弃(0 个 mtp.* tensors,427 total)。v2 用现代 llama.cpp build-cuda-sm121 重新 convert,MTP head 完整保留(15 tensors,442 total)。同 imatrix 校准方式。
为什么 v2 升级
| 维度 | v1(non-MTP) | v2(MTP bundled) |
|---|
| Total tensors | 427 | 442(+15 MTP) |
| GGUF 大小 | 5.89 GB | 5.38 GB(BPW 5.02,更紧 + MTP head ~50MB) |
| Spark GB10 单流 TPS(think-off,1024 cap) | 32 t/s | 46.16 t/s(+44%) |
| Spark GB10 单流 TPS(think-off,2048 cap sustained) | ~32 | 43.81 t/s(+37%) |
| Spark GB10 单流 TPS(think-on,32K cap sustained) | — | 78.32 t/s ⭐(+144% vs 旧 baseline) |
| 单流 TPS(think-on,4K cap,数学题) | — | 77.46 t/s |
MTP 在 thinking 长链路上加速更猛(78 t/s sustained over 13K+ tokens),因为 thinking trace 的 n-gram pattern 可预测性高 → MTP head acceptance rate 60-75%。
评测摘要 / Benchmark Summary
(quality 与 v1 一致 — 量化算法相同,只是 MTP tensors 保留了。所有数字与 v1 README 同口径,Lynn 内部 thinking-on 32K 评测)
Qwen3.5-9B thinking-off(短输出 / 默认推理)
| 版本 | MMLU 500 5-shot | GPQA Diamond 198 | 备注 |
|---|
| BF16 official | 77.20% | 44.95% | 官方 BF16 基线 |
| Q4_K_M imatrix(本仓库) | 76.00% | 37.37% | llama.cpp,thinking off |
| Lynn-native W4A16 NVFP4 | 75.20% | 42.93% | Lynn engine 端 thinking off |
Qwen3.5-9B thinking-on 32K(能力上限)
| 版本 | MMLU | GPQA Diamond | 备注 |
|---|
| Q4_K_M imatrix(本仓库) | 92.00% (92/100), parse_fail 0 | 72.22% naive (143/198) / 81.71% excl_pf, parse_fail 23 | 推荐本地路线 |
| Lynn-native W4A16 NVFP4 | 91.00% (91/100), parse_fail 1 | 56.00% naive (28/50) / 70.00% excl_pf | GPQA 当前仅 50 题样本 |
| BF16 official | 87.00% (87/100), parse_fail 1 | running / pending | R6000 BF16 补测 |
TPS 实测 / Throughput Benchmarks
完整 single-stream decode TPS,实测自 NVIDIA GB10 Spark(sm_121),llama.cpp build-cuda-sm121 commit b1-5d44db6,2026-05-23。
v2(本仓库,MTP enabled,--spec-type draft-mtp)
| Scenario | Cap | Tokens generated | Decode TPS | Notes |
|---|
| think-off 短答 | 1024 | 685 | 46.16 | typical chat reply |
| think-off 中长 | 2048 | 1854 | 43.81 | sustained essay output |
| think-on 数学题 | 4096 | 1410 | 77.46 | thinking 短 + final answer |
| think-on 16K 归纳证明 | 16384 | 4464(自然停止) | 69.00 | math proof,Bayesian extension |
| think-on 长链 sustained | 32768 | 13,000+ | 78.32 | 主观感受 "飞快" |
v1(MS 旧版,no MTP)
| Scenario | Cap | Decode TPS | 来源 |
|---|
| think-off | 1024 | ~32 t/s | Lynn memory baseline project_qwen35_9b_q4km_thinking_baseline_20260519 |
v2 vs v1 净增益:think-off +44%,think-on +144%。
本地使用 / Local Usage
Lynn Desktop v0.80+ 自动配置。手动等价命令:
1modelscope download --model Merkyor/Qwen3.5-9B-GGUF-imatrix \
2 Qwen3.5-9B-Q4_K_M-imatrix-mtp.gguf \
3 --local_dir ~/Models/Lynn/Qwen3.5-9B/q4_k_m
4
5llama-server \
6 --model ~/Models/Lynn/Qwen3.5-9B/q4_k_m/Qwen3.5-9B-Q4_K_M-imatrix-mtp.gguf \
7 --host 127.0.0.1 \
8 --port 18099 \
9 --ctx-size 32768 \
10 --parallel 1 \
11 --n-gpu-layers 999 \
12 --jinja \
13 --reasoning auto \
14 --spec-type draft-mtp \
15 --spec-draft-n-max 4
关键 flag:--spec-type draft-mtp 触发 llama.cpp 加载 MTP head 作为 self-speculative draft。不加这个 flag,MTP tensors 仍 load 但不 used,TPS 等同 v1。
OpenAI-compatible endpoint:
1base_url = http://127.0.0.1:18099/v1
2api_key = local
3model = qwen3-5-9b-q4km-imatrix-mtp
MTP 工作原理 / How MTP Works
- 主模型 (32 layers) 正常 decode 1 个 token
- MTP head (1 extra layer) 同时 predict 接下来的
n_max 个 tokens(default 4)
- 下个 step,主模型 verify MTP 的 predictions:matched 的 tokens 直接接受,不 matched 的丢弃
- Accept rate 决定加速比:60-70% 时 ≈ +40-50% TPS,thinking 长链路 70-80% 时 ≈ +100%+ TPS
llama.cpp 自动处理 verify/accept/rollback,user 不感知。SSE stream 输出 token 顺序仍 deterministic,跟没用 MTP 的输出完全一致(只是更快)。
来源与集成 / Provenance
- 基座 / Base:
Qwen/Qwen3.5-9B(Apache-2.0,vendor 自带 MTP head)
- 量化栈 / Quant stack: llama.cpp build-cuda-sm121
- convert command:
convert_hf_to_gguf.py --outtype f16(bundled MTP,默认行为)
- imatrix 校准 / Calibration: wikitext-2-raw,100 chunks × 512 ctx
- 量化主机 / Quantize host: NVIDIA GB10 Spark (sm_121)
- MTP credit: Multi-Token Prediction head 设计 + 训练权重均来自 Qwen 官方,Lynn 仅做 GGUF 量化保留
- Lynn 集成 / Integration:
local-qwen3.5-9b-q4km-imatrix-mtp provider(Lynn client v0.80+)
License
Apache-2.0,inherits from base Qwen/Qwen3.5-9B. Re-quantized weights distributed under the same license.
Last updated: 2026-05-23. v2 MTP-bundled release. Lynn project: https://github.com/MerkyorLynn/Lynn