为Llamacpp添加了TurboQuant模型权重压缩支持。
TurboQuant model weight compression support added to Llamacpp

原始链接: https://github.com/TheTom/llama-cpp-turboquant/pull/45

为 TQ4_1S (5.0 bpv) 和 TQ3_1S (4.0 bpv) WHT 旋转权重压缩类型添加了 CUDA 反量化。这些在 Qwen/Phi 系列上实现了 27-37% 的模型尺寸缩减,PPL 增加 +1.0-1.9%。基础类型 + Metal + CPU 量化/反量化来自 TheTom 的 PR TheTom#45。CUDA 补充:- turbo-quant.cuh:权重质心(N(0,1) Lloyd-Max,16/8 级),32 元素逆 WHT 的符号数组 - dequantize.cuh:dequantize_tq4_1s/tq3_1s — 完整的 32 元素块逆 RHT(5 个蝶形阶段 + 归一化 + 取消符号) - convert.cu:所有 4 个反量化分派器中的 TQ4_1S/TQ3_1S - ggml-cuda.cu:支持 MUL_MAT 和 GET_ROWS 的操作,从 mmvq/mmq 中排除(使用 cuBLAS 反量化到 f16 路径)。cuBLAS 路径对于初始支持是正确的。未来优化:通过 warp shuffle WHT 预旋转激活(与 KV 缓存 Q 旋转相同的模式)以消除每个块的逆 WHT。共同作者:Claude Opus 4.6 (1M 上下文) <[email protected]>

关于llama.cpp项目的新进展在Hacker News上讨论。一位用户报告增加了对TurboQuant模型权重压缩的支持,但另一位用户对此表示质疑,认为这似乎是在llama.cpp的一个分支上实现的,而不是主项目本身。他们指出一个公开的pull request是唯一的证据,并注意到过去有贡献被拒绝的历史。 尽管存在这种不确定性,其他人仍然对TurboQuant实现能够迅速传播到其他主要的推理引擎表示乐观。此外,正如相关Hacker News讨论中链接的那样,该项目最近增加了对Cuda的支持。这次对话凸显了开源开发的动态性以及验证核心项目更新声明的重要性。
相关文章

原文
Adds CUDA dequantization for TQ4_1S (5.0 bpv) and TQ3_1S (4.0 bpv)
WHT-rotated weight compression types. These achieve 27-37% model size
reduction at +1.0-1.9% PPL on Qwen/Phi families.

Base types + Metal + CPU quantize/dequant from TheTom's PR TheTom#45.
CUDA additions:

- turbo-quant.cuh: weight centroids (N(0,1) Lloyd-Max, 16/8 levels),
  sign array for 32-element inverse WHT
- dequantize.cuh: dequantize_tq4_1s/tq3_1s — full 32-element block
  inverse RHT (5 butterfly stages + normalize + unsign)
- convert.cu: TQ4_1S/TQ3_1S in all 4 dequant dispatchers
- ggml-cuda.cu: supports_op for MUL_MAT and GET_ROWS, excluded from
  mmvq/mmq (uses cuBLAS dequant-to-f16 path)

The cuBLAS path is correct for initial support. Future optimization:
pre-rotate activations via warp shuffle WHT (same pattern as KV cache
Q rotation) to eliminate per-block inverse WHT.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
联系我们 contact @ memedata.com