localai-org/apex-quant
Adaptive Precision for EXpert Models: MoE-aware mixed-precision quantization
What it solves
APEX addresses the inefficiency of uniform quantization in Mixture-of-Experts (MoE) models. Standard quantization often treats all weights equally, leading to either excessive size or unnecessary precision loss. APEX reduces model size and increases inference speed without sacrificing accuracy, allowing large MoE models to run on consumer-grade hardware (like 16GB VRAM GPUs) while maintaining or exceeding the quality of full-precision models.
How it works
APEX uses a mixed-precision strategy specifically designed for the structural properties of MoE models:
- Tensor Classification: It categorizes weights into routed experts (which are sparse and can be compressed more), shared experts (which are critical and require high precision), and attention/SSM weights.
- Layer-wise Precision Gradient: It assigns higher precision to the "edge" layers (first and last few layers) which are more sensitive to noise, and lower precision to the redundant middle layers.
- Diverse Calibration: The "I-variants" use a calibration dataset covering chat, code, and reasoning instead of just Wikipedia, improving real-world task performance.
- llama.cpp Integration: It leverages the
--tensor-type-fileand--tensor-typeflags in stock llama.cpp to apply these specific precision assignments without requiring custom code changes.
Who it’s for
Developers and AI researchers who want to deploy large MoE models on limited hardware, specifically those using the GGUF format and llama.cpp ecosystem.
Highlights
- High Efficiency: Beats Q8_0 perplexity at half the size and outperforms Unsloth Dynamic quantizations in speed and size.
- Five Precision Tiers: Offers configurations ranging from "I-Quality" (maximum accuracy) to "Mini" (smallest viable size for 16GB VRAM).
- Lossless Compression: Matches or beats full Q8_0 quality in some metrics while being significantly smaller.
- Hardware Accessible: Enables running 35B MoE models on consumer GPUs like the RTX 4060 Ti 16GB.
- Zero Code Changes: Works with standard llama.cpp and LocalAI.
Related
- Project
- Project
- Project
- Project
- Dispatch