Model quantization transforms continuous weights (e.g., BF16) into lower-precision integers to reduce memory footprints, such as shrinking a 16 GB Llama-3.1-8B model to 4.7 GB. Because naive quantization suffers from outliers that crush signal precision, advanced methods use specific allocation strategies. GPTQ minimizes output error by utilizing the layer's Hessian matrix to adjust unquantized columns based on how error propagates. AWQ protects sensitive channels by rescaling weights before quantization, ensuring high-activation channels maintain precision. The GGUF format utilizes K-quants, which employ a two-level hierarchical scaling system (super-blocks of 256 weights with 6-bit sub-scales) to reduce overhead to approximately 0.4 bits per weight. This method often applies mixed-precision policies, promoting sensitive layers like attn_v and ffn_down to Q6_K to mitigate error accumulation. For extremely low bit-rates below 3 bits, I-quants use learned codebooks and an importance matrix to maintain coherence. While quantization quality remains relatively stable from 16 down to 4 bits, it drops sharply below that "knee." Ultimately, the most effective strategy prioritizes fitting a larger model at a lower bit-rate into available VRAM rather than using a smaller model at higher precision.
Read original
dev.to