Q4_K_M: The Optimal 4-bit Variant for Edge
Q4_K_M is the recommended 4-bit quantization format for local LLMs, balancing model size, speed, and quality. It achieves this by using mixed 4-bit and 6-bit precision for sensitive layers, reducing a 7B model from 14 GB to approximately 4.5 GB with under 1% quality loss, making it suitable for 6 GB+ GPUs. [4, 9]
The top 3
- Q4_K_M's Secret: Mixed-Precision for Quality: Unlike basic 4-bit methods, Q4_K_M employs K-quants, strategically using 6-bit precision for critical layers like attention tensors while aggressively quantizing less sensitive parts, thus minimizing quality degradation.
- The "Goldilocks" 4-bit for Edge Devices: Q4_K_M reduces a 7B model from 14GB (FP16) to approximately 4.5GB, achieving a 70-75% size reduction with only 1-3% quality degradation, making it the optimal choice for memory-constrained edge hardware.
- Q4_K_M: Default for Local LLM Tools: Due to its optimal balance of performance, size, and minimal quality loss, Q4_K_M has become the standard default quantization level for popular local LLM inference platforms like Ollama and llama.cpp.
Sources
Open the full topic