llama-modchip: CPU-First Inference for 284B & 30B MoE Models on 16-64 GB RAM
- ID: 5e9d3fd0
- 原文链接: https://github.com/synchopate/llama-modchip
- 作者: synchopate
- 日期: N/A(抓取时版本 v2.4.0)
- 分类: infra
- 来源类型: github
- 标签: cpu-inference, moe, quantization, llama-cpp, avx-512
- 质量评分: 4/5
- 抓取时间: 2026-11-10T12:23:00Z
中文导读
llama-modchip 是一组 ggml/llama.cpp 内核补丁、量化转码器与运行时工具,让稀疏 MoE 检查点完全跑在系统内存里:x86_64(AVX-512/AVX2)与 ARM64(NEON/SVE/Apple Metal)均无需 GPU。1.71 bpw 定制转码把 DeepSeek-V4-Flash(284.33B 总参、13.17B 激活、256 路由专家)压到 56.56 GiB,连 256K KV cache 峰值 VmRSS 约 57.6 GiB,在 64 GB Linux 机器零 swap 运行;16 核 Zen 5 prefill 44.36 tok/s(tg 9.1–14.7 tok/s)。CPU 缓存与 SIMD 内核补丁报告带来 +77% prefill、+53% decode(ZMM 寄存器分块、MQA8 FlashAttention、非临时 MoE 流式读取);30B 级 MoE(Nemotron-3.5-30B-A3B,3.75 bpw,14.35 GiB)在 16–32 GB 内存 decode 25.0–60.4 tok/s,8 通道工作站 111.62 tok/s。另配 1.64 MB Zobrist n-gram 投机 drafter 与 /dev/shm KV 快照,40 工具 Claude Code 提示的上下文恢复 13.1–32.6 ms。
为什么值得关注
本地部署大 MoE 通常卡在内存容量和量化质量上:这个项目把 284B/13B 激活的模型压进 64 GB 纯内存并给出完整量化账本——敏感张量保留 Q4_K/Q5_K/F32,路由专家主要 IQ1_S,评测报告 98.5/100、100% JSON tool-calling、对 76.87 GiB UD-IQ1_S 的 top-logit 余弦 0.9964,且默认 Top-6 全专家无剪枝(同 checkpoint 上 logit 余弦 1.00000)。内核补丁、drafter 与 KV 快照的细节全部开源并附技术论文,是 CPU 推理与极端量化路线可直接对照的参考实现。
关键信息
- 项目:llama-modchip(v2.4.0,Apache 2.0)
- 维护者:synchopate
- 仓库:https://github.com/synchopate/llama-modchip
- 量化与内存:DeepSeek-V4-Flash 1.71 bpw → 56.56 GiB GGUF / 57.61 GiB 峰值 VmRSS @256K ctx;Nemotron-3.5-30B-A3B 3.75 bpw → 14.35 GiB
- 吞吐:284B prefill 44.36 tok/s(16C Zen 5)、tg 9.1–14.7 tok/s;30B decode 25.0–111.6 tok/s
- 投机解码与上下文:1.64 MB Stockfish-PVS v2 n-gram drafter;/dev/shm KV 快照恢复 13.1–32.6 ms
- 质量保留:98.5/100 评测分、100% JSON tool-calling、0.9964 top-logit 余弦(vs 76.87 GiB UD-IQ1_S)
Source Notes (from README)
- Runs sparse MoE checkpoints entirely in system RAM on x86_64 (AVX-512/AVX2) and ARM64 (NEON/SVE, Apple Metal); no GPU required.
- DeepSeek-V4-Flash (284.33B total / 13.17B active, 43 MLA layers, 256 routed experts): the standard UD-IQ1_S build is 76.87 GiB and overflows ~62.5 GiB usable RAM on 64 GB machines; the modchip transcode is 56.56 GiB (1.71 bpw) so model + 256K KV cache fits in ~57.6 GiB VmRSS with zero NVMe swap. Sensitive tensors (embeddings, dense L0, 43 shared experts, MLA kv_a/q_a/wkv_b) stay in Q4_K/Q5_K/F32; wq_b/attn_output go to Fractal-64 (Q2_0-class block-64 BF16-scale); routed experts are mostly IQ1_S with analytical SwiGLU-H2 second-order scale matching, boundary layers in IQ2_XXS/IQ1_M. Eval reports 98.5/100, 100% JSON tool-calling, 0.9964 top-logit cosine vs the 76.87 GiB UD-IQ1_S baseline; default Top-6 routing evaluates all experts per layer (1.00000 logit cosine vs unpatched runtime).
- CPU cache & SIMD kernel patches (+77% prefill, +53% decode): 4-level ZMM (AVX-512BW) / L1D / L2 / L3 multi-column tiling (25.0 → 44.36 tok/s on 16-core Zen 5), register-stationary MQA8 FlashAttention, non-temporal MoE streaming so cold expert weights do not evict hot KV lines from L3.
- Self-speculative drafting & instant agent context restore: 1.64 MB L2/L3 Zobrist n-gram drafter (Stockfish-PVS v2), /dev/shm KV slot snapshots (13.1–32.6 ms restore for 40-tool Claude Code prompts), O(1) speculative rollback for deepseek4 recurrent/MLA states.
- Hardware targets: 16–32 GB laptops/mini-PCs (Nemotron-3.5-30B-A3B, 25.0–60.4 tok/s), 64 GB desktops/servers (284B, 44.4 tok/s pp), hybrid CPU + 16 GB GPU (80.80 tok/s with hot attention/SSM trunk on GPU), 8-channel Threadripper workstations (111.62 tok/s on 30B).
English Summary
llama-modchip is a set of ggml/llama.cpp kernel patches, quantization transcoders, and runtime tools that run sparse MoE checkpoints entirely in system RAM on x86_64 (AVX-512/AVX2) and ARM64 (NEON/SVE, Apple Metal), with no GPU. A custom 1.71 bpw transcode of DeepSeek-V4-Flash (284.33B total, 13.17B active, 256 routed experts) fits the model plus a 256K KV cache in about 57.6 GiB RSS on a 64 GB Linux machine with zero swap. CPU cache and SIMD kernel patches (ZMM register tiling, register-stationary MQA8 FlashAttention, non-temporal MoE streaming) are reported to add 77% prefill and 53% decode, reaching 44.36 tok/s prefill on a 16-core Zen 5; 30B-class MoE models decode at 25-111.6 tok/s. A 1.64 MB n-gram speculative drafter pairs with /dev/shm KV snapshots that restore agent contexts in about 13 ms.
Obsidian Notes
- 内容由 GitHub 仓库 README 抓取生成(opencli web read 对 github.com 导航被拒,改用 raw.githubusercontent.com 的 README 兜底)。
- 中文导读与价值判断锚定在条目已有摘要与 README 公开数据上;未补充 README 之外的实验细节。