huawei-csl/MACaQ
HF Paper ↗Calibrated quantization for local GGUF inference and model-specific runtimes
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
MACaQ separates calibration and quantization from inference: it produces artifacts for existing runtimes rather than introducing a single multimodal engine. The root tree includes quantize/ alongside llamacpp/, vllm/, diffusers/, and pytorch/. For text, the full llama.cpp workflow uses a bundled runtime for activation transforms; MACaQ-R instead refines weight codes inside an existing GGUF while preserving its native formats and block scales, so the result runs on standard llama.cpp.
The setuptools-built macaq-mxfp4 package declares Python ≥3.10 and registers macaq_plugin:register under vllm.general_plugins. Its module list includes Triton-named dense, MoE, and MoE decode modules, plus a cuDNN-named dense module. Those module names describe the packaged integration surface, not a guarantee that each kernel runs on every GPU. Diffusers saves quantized transformers as safetensors checkpoints; the PyTorch speech path saves reloadable W4A4 checkpoints.
Key Capabilities & Differentiators
The llama.cpp workflow targets 2-, 3-, and 4-bit GGUF for text, with dense, hybrid, and MoE recipes. For Qwen3.6-35B-A3B, MACaQ-R Q4_K_XL reduces KL divergence to FP16 from 0.015731 for Unsloth UD-Q4_K_XL to 0.013367, with both files at 22.36 GB. On Qwen3.8-27B in vLLM, W4A4 records 2.33× prefill and 2.58× decode throughput relative to BF16, with perplexity moving from 2.8463 to 2.8994.
Diffusers covers FLUX.2-klein-4B for images, Wan2.2-TI2V-5B for video and image-to-video, and Stable Audio 1.0 for audio. Image-to-video calibration incorporates conditioning images. Wan2.2 also has a Diff4Diff path with fused W4A4 kernels and optional SVD correction. The separate PyTorch path covers Qwen3-TTS and Chatterbox Turbo, generating WAV audio from saved quantized checkpoints without rerunning calibration.
Trade-offs & Limitations
Compared with downloading a ready-made GGUF, MACaQ-R adds a calibration stage and requires access to the matching original model and FP16 teacher. The payoff is a chance to reduce divergence from FP16 without increasing file size or replacing standard llama.cpp, as in the Unsloth comparison. KL divergence and perplexity measure different aspects of quality and do not establish downstream task gains. Benchmark representative prompts or media inputs before committing to a quantized artifact.
On vLLM, W4A4 trades a measured perplexity increase for higher throughput on the tested Qwen model. That result is not a latency or throughput guarantee on a different GPU or workload; weight-only inference is a separate path worth testing when the W4A4 path is unsuitable. The reported 122B quantization run—64 minutes and 32.5 GB of device memory—is a calibration and quantization datapoint, not a serving budget. Apache-2.0 covers the code; model and checkpoint terms must be checked separately.
Hardware & Deployment Guide
Use separate Python 3.12 environments for the chosen backends; the vLLM package's Python ≥3.10 metadata is a packaging floor, not the recommended setup for every backend. For local GGUF refinement, llamacpp/macaq.py refine takes the input GGUF (--model), matching source (--hf), FP16 teacher GGUF (--teacher), and calibration text (--calibration), plus --output and --work-dir. The refined artifact can run locally with llama cli, including on CPU, or be served with llama serve. vLLM is the separate HTTP serving path.
Ascend dense and grouped matmul kernels are available through CANN pull requests, with build compatibility tied to CANN, PyTorch, and torch_npu; full-model execution still requires integration with an Ascend inference runtime. No GitHub release is listed, so there is no release milestone to use as a deployment baseline. Pin the repository revision and validate the chosen runtime and checkpoint together before rollout.
Teams refining existing GGUFs without changing standard llama.cpp, or benchmarking backend-specific low-precision inference for text, image, video, and audio models.
An off-the-shelf checkpoint already meets your targets, you lack the matching source and teacher needed for GGUF refinement, or you need a turnkey Ascend full-model runtime.
Quick Start & Installation
.venv-llamacpp/bin/python llamacpp/macaq.py refine \ --model models/model-q4.gguf --hf models/original \ --teacher models/original-f16.gguf --calibration data/calibration.txt \ --output models/model-macaq-r.gguf --work-dir work/refinement
Comparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| MACaQ ★ | 413 | +15 | C++ | Apache-2.0 | Calibrated quantization for local GGUF inference and model-specific runtimes |
| minimind | 75.4k | +3.1k | Python | Apache-2.0 | Native PyTorch dense and MoE models for end-to-end LLM training on local GPUs |
| autoresearch | 101k | +342 | Python | — | Single-GPU nanochat harness for agent-led, five-minute training experiments |
| LlamaFactory | 76.4k | +86 | Python | Apache-2.0 | A unified Python framework for LLM and VLM fine-tuning with pluggable inference |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/huawei-csl/MACaQ.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about MACaQ
Can I adopt MACaQ without replacing my llama.cpp runtime?
llamacpp/macaq.py refine with the quantized file, its matching source model, an FP16 teacher GGUF, and calibration text. The output preserves the original block formats and scales and runs in standard llama.cpp. Full MACaQ with activation transforms instead uses the bundled runtime. vLLM is a separate integration registered through vllm.general_plugins.How much device memory do I need to quantize and serve a model?
Can I use MACaQ commercially and self-host the resulting models?
When is MACaQ-R preferable to downloading a ready-made Unsloth GGUF?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy