# K2-Horizon MoVA 36B-A4B × zLLM 收尾报告（2026-09-06）

## 结论

K2-Horizon-MoVA-36B-A4B 的 GGUF IQ3_XS 已接入 zLLM，并在 Apple M5 24 GiB 上完成真实权重加载、prefill、decode、Q8 KV cache 与 Metal replay 的端到端运行。

本轮没有达到“超过 llama.cpp”的性能目标。相同 55-token prompt、greedy、256-token completion 下，llama.cpp 为 **32.691 tok/s**；zLLM 的最好可复现记录为 **29.690 tok/s**，慢 **9.18%**。当前保留的自适应 replay 同时覆盖 256-token 前后的直通/分块 attention；其降频前实测为 **27.762 tok/s**。长上下文正确性优先于只保留较快的小上下文直通图。

四题的错误来自模型的低思考档，不是 zLLM 数值实现：同一权重、同样 `reasoning_effort=low`、`temperature=0` 时，zLLM 与 llama.cpp 给出相同的四个错误答案。已归档的 llama.cpp high reasoning 测试则在 3 个随机种子上 **12/12 正确**。因此这份量化能答对四题，但必须给足 high reasoning 的 token 预算；low/no-thinking 不可靠。

## 模型与机器

- 模型：`/Volumes/ORICO/models/K2-Horizon-MoVA-36B-A4B-IQ3_XS.gguf`
- 大小：15,695,083,968 bytes
- SHA-256：`765216fa982259fa72ada1758d17268a272c418bb2bc41724181bd4cde8cb6f0`
- 来源：NANI-Nithin 的第三方量化，不是 IFM 官方低比特发布
- 机器：Mac17,4，Apple M5，24 GiB
- llama.cpp：`35999d1`

## 题目结果

| 题目 | 正确答案 | zLLM low/greedy | llama.cpp low/greedy | llama.cpp high |
|---|---:|---:|---:|---:|
| `strawberry` 中的 r | 3 | 2 | 2 | 3/3 |
| 9.11 与 9.8 | 9.8 | 9.11 | 9.11 | 3/3 |
| 蜗牛爬井 | 8 天 | 6 天 | 6 天 | 3/3 |
| 猫抓老鼠 | 3 分钟 | 9 分钟 | 9 分钟 | 3/3 |

zLLM 与 llama.cpp 的 low 档可见答案逐题一致。zLLM 默认 high 档的 32-token 探测只生成了思考过程并被长度截断，不能当作错误答案；历史 high 档质量测试允许完整生成，蜗牛题最多使用 3,986 completion tokens。

关闭思考的短探测得到：第一题 `1`、第二题 `9.8`，第三、四题在 32 tokens 截断。该模式同样不适合作为能力判断。

## 性能

| 实现/路径 | Prefill | Decode 256 | Decode 吞吐 |
|---|---:|---:|---:|
| llama.cpp，F16 KV | 0.322 s | 7.800 s | **32.691 tok/s** |
| zLLM，Q8 KV，最好记录 | 5.999 s | 8.623 s | **29.690 tok/s** |
| zLLM，当前自适应 replay，降频前记录 | — | 9.221 s | **27.762 tok/s** |

最后一轮实验时直通 decode 从约 30 ms/token 升到 80–100 ms/token，机器已明显热降频；该轮 10.83 tok/s 不纳入比较。zLLM 仍需重点优化短 prompt prefill、256 token 后的 split-KV attention，以及 replay 提交成本。

## 完成的实现

- 新增独立的 K2-Horizon 架构规格、GGUF loader、MoVA/MoE runtime、Metal session、node/embedded/CLI 接线。
- 支持 grouped RMSNorm、attention output gate、64 选 4 value experts、100 选 8 routed experts、shared expert。
- 支持 IQ3_XS 所需的 IQ3_XXS、IQ3_S、Q3_K、Q6_K 等 GGUF Metal kernel 与专家路径。
- 增加 Q8g64 KV cache、动态位置 append、短上下文 direct attention、256 token 后 split-KV、自适应 replay。
- 修复 BF16 vectorized split-KV 的参数绑定回归；保留 K2 `head_dim=128` 已对拍通过的 value token 并行。
- README 已改为准确列出 K2-Horizon MoVA 36B-A4B 的 Metal 支持范围。

## 验证

- `cargo check --lib --no-default-features`：通过。
- K2 Q8 direct/split append 对拍：通过。
- BF16 split-KV CPU oracle：修复后通过。
- Q6_K GEMV dequantized dot 对拍：通过。
- 完整 `cargo test --lib --no-default-features`：K2/Metal 测试通过；并发全跑时 2 个既有 scheduler 时序测试超时，两个测试单独重跑均通过。
- `git diff --check`：通过。

## 存储

模型统一位于 `/Volumes/ORICO/models`；`/Users/zhu/models` 是指向该目录的符号链接。zLLM 与 zLLM-bench 的 target/cache 也位于 ORICO。收尾时系统盘约剩 83 GiB，ORICO 约剩 834 GiB。

## 产物

- `llama-256-greedy.json`：性能基线
- `zllm-256-warm-q8-replay.log`：zLLM 最好吞吐记录
- `zllm-256-q8-replay-adaptive-value-split.log`：当前自适应路径记录
- `zllm-quality-greedy-low.log`：zLLM 四题 low 档
- `llama-quality-greedy-low.json`：llama.cpp 四题 low 档
- `zllm-quality-greedy-no-thinking.log`：关闭思考的短探测
