Mixed-Precision: K-Quants' Quality Secret
K-Quants like Q4_K_M enhance quality by selectively applying higher precision (e.g., 6-bit) to critical layers, such as parts of attention.wv and feed_forward.w2 tensors, while keeping other weights at 4-bit, optimizing the balance between fidelity and file size.
The top 3
- K-Quants' Hierarchical Precision: Key Components: K-Quants employ a two-level hierarchical quantization, grouping 8 regular blocks (each with 32 quantized weights, e.g., INT4) into a super-block. Block constants are stored as INT8, while super-block constants remain FP16 to dequantize block constants, significantly reducing metadata overhead. [2, 3]
- K-Quants vs. Legacy Quants: Perplexity Advantage: K-Quants generally show less perplexity loss relative to their size compared to legacy quantization formats like Q4_0 or Q4_1. For instance, a Q4_K_M model has much less perplexity loss than a Q4_0 or Q4_1, making it a recommended choice for balanced quality and low perplexity increase. [1, 4]
- Mixed-Precision Allocation: Critical Layers Get More Bits: The mixed-precision strategy in K-Quants allocates higher precision to critical components of the LLM. This includes often keeping layer normalization weights in FP16, assigning higher precision (like Q5_0 or Q6_K) to attention weights, and potentially using higher precision for the output layer than the base quantization. [2, 3]
Sources
Open the full topic