CV

curvedinf/voodoo-dyn-quant

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

23 stars 质量 58 趋势 18MIT

LLM 量化优化器

概览

Voodoo 用梯度下降取代手工调优的量子化配方:模型中的每个权重张量通过自身的门投票决定其应得多少位,且在全球规模预算和全模型蒸馏损耗下。结果是一个每张量的量化赋值,导出为正常的 GGUF,运行于库存llama.cpp。Voodoo 的方法可将困惑度降低高达 89.5%。 - 如果变换器能加载,Voodoo 可以量化它——注意、SSM/线性注意混合、门控-短conv混合(LFM2/LFM2.5)、绑定嵌入、无 MoE 的任意形状线性化(内部零填充)。arch 具体数据(TP 分片策略、GGUF 张量映射)存在于voodoo_quant/arch/ 下的小型分离适配器中。- CUDA 或 ROCm,单 GPU,分层分片或全张量并行。厂商专用数据存储在一个整洁模块中。- 每个量化字节由 llama.cpp 自己的 C++ 量化器通过 libggml-base 生成——永远无训练/部署量化间隙。

概述(AI 翻译)

为任何大型语言模型学习到的每张量混合精度量子化—— llama.cpp结构上非常精确。

Voodoo 用梯度下降取代了手工调优的量化配方:每一个 模型中的权重张量通过自身的门投票决定其比特数 应当在全球预算和全模型蒸馏损失下承担。该 结果是一个每个张量的定量赋值,导出为正常的GGUF运行 库存llama.cpp。Voodoo的方法论将困惑度降低了高达89.5%。

  • 架构无关。 如果 transformers 能加载,Voodoo 也能 量化——注意、单次导向/线性注意混合、门控-短变换 杂交(LFM2/LFM2.5)、绑定嵌入、无MoE任意形状线性化 (内部零填充)。拱形具体情况(TP分片策略,GGUF张量 映射)存储在voodoo_quant/arch/下方的小型分离适配器中。
  • 硬件无关性。 CUDA 或 ROCm,单一 GPU,分层,或 全张量并行性。厂商具体内容都集中在一个整洁的模块中。
  • 精确。 每个量化字节由llama.cpp自己的C++生成 通过libggml-base实现量化器——从未出现过训练/部署量化间隙。

工作原理:WHITEPAPER.md ·该怎么做:技能

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Voodoo Dynamic Quantization

Learned per-tensor mixed-precision quantization for any LLM — llama.cpp-exact by construction.

Voodoo replaces hand-tuned quantization recipes with gradient descent: every weight tensor in the model votes, through its own gates, on how many bits it deserves, under a global size budget and full-model distillation loss. The result is a per-tensor quant assignment exported as a normal GGUF that runs in stock llama.cpp. Voodoo’s methodology reduces perplexity by up to 89.5%.

   teacher (frozen, BF16/Q8)          student = same model, weights replaced by
   ─────────────────────────          Σ pₖ · Wₖ   (softmax over K quant candidates)
        │ logits                              │ logits
        └──────────────┬──────────────────────┘
                       ▼
     L = CE + λ·KL(teacher ‖ student) + size-budget dead-zone penalty
                       ▼
     argmax gate per tensor → quant assignment → GGUF (llama.cpp-exact)
  • Architecture-agnostic. If transformers can load it, Voodoo can quantize it — attention, SSM/linear-attention hybrids, gated-shortconv hybrids (LFM2/LFM2.5), tied embeddings, MoE-free any-shape Linears (zero-padded internally). Arch specifics (TP sharding policy, GGUF tensor mapping) live in small, detached adapters under voodoo_quant/arch/.
  • Hardware-agnostic. CUDA or ROCm, single GPU, layer-wise sharding, or full tensor parallelism. Vendor specifics live in one tidy module.
  • Exact. Every quantized byte is produced by llama.cpp’s own C++ quantizer via libggml-base — no train/deploy quantization gap, ever.

How it works: WHITEPAPER.md · What to do: the skills below · Agent conventions: AGENTS.md

Is your organization looking for help?

I’m available for hire. Reach out at https://voodooquant.com.


Quickstart

make bootstrap        # venv + package + llama.cpp libggml (nice defaults)
make doctor           # verify GPU + torch + libggml resolve
voodoo data --model Qwen/Qwen3.5-0.8B-Base --output_dir data/qwen35-0.8b
configs/qwen35_08b_voodoo45.sh    # single-GPU train → Voodoo45

make bootstrap clones llama.cpp into third_party/ and builds libggml-base (CPU-only build — no GPU toolchain needed for quantization). Already have a llama.cpp checkout? Set VOODOO_GGML_LIB=/path/to/libggml-base.so and skip that step.


Using this repo with an agent

The workflow is encoded as skills in skills/ — install, data, train, export, eval. If you use an agentic coding tool (Claude Code, Kimi, Cursor, etc.), point it at this repo and it will drive the pipeline through the skills; base instructions live in AGENTS.md.

You want Skill Command essence
Set up from clean checkout skills/install/SKILL.md make bootstrap
Prepare calibration data skills/data/SKILL.md voodoo data --model
在 GitHub 查看完整 README

推荐工具

换一个关键词,或者移除筛选条件。

安装

npx skillfish add curvedinf/voodoo-dyn-quant
新手?先看 mcpskill.org 教程 →