nerkyor/Qwen3.5-9B-GGUF-imatrix
Qwen3.5-9B Q4KM 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 Q4KM 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
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 升级
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(短输出 / 默认推理)
Qwen3.5-9B thinking-on 32K(能力上限)
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)
v1(MS 旧版,no MTP)
v2 vs v1 净增益:think-off +44%,think-on +144%。
本地使用 / Local Usage
Lynn Desktop v0.80+ 自动配置。手动等价命令:
modelscope download --model Merkyor/Qwen3.5-9B-GGUF-imatrix \
Qwen3.5-9B-Q4_K_M-imatrix-mtp.gguf \
--local_dir ~/Models/Lynn/Qwen3.5-9B/q4_k_m
llama-server \
--model ~/Models/Lynn/Qwen3.5-9B/q4_k_m/Qwen3.5-9B-Q4_K_M-imatrix-mtp.gguf \
--host 127.0.0.1 \
--port 18099 \
--ctx-size 32768 \
--parallel 1 \
--n-gpu-layers 999 \
--jinja \
--reasoning auto \
--spec-type draft-mtp \
--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:
base_url = http://127.0.0.1:18099/v1
api_key = local
model = qwen3-5-9b-q4km-imatrix-mtpMTP 工作原理 / 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-mtpprovider(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
