Q4_K_M
A mixed quantization scheme in the GGUF format that uses 4-bit quantization. Through k-quant block techniques it retains higher precision in key layers, balancing model size against output quality.
Core Facts
llama.cpp applies quantization compression of model weights in formats such as 4-bit and 8-bit via the GGUF format, significantly reducing VRAM and memory usage.
4-bit quantization techniques (such as GPTQ, AWQ, and the GGUF format) can reduce model VRAM requirements to 1/4 of the original, but come with a certain degree of accuracy loss
In GGUF quantization naming, Q4_K_M denotes a 4-bit quantization, Medium-precision variant using the K-Quant grouped quantization method
Timeline (last 90 days)
llama.cpp's Q4_K_M quantization method did not shift the behavior of the two models Qwen2.5-3B and Llama-3.2-3B at the same bits per weight.
Q4_K_M is a 4-bit quantization scheme in the llama.cpp ecosystem, where K denotes k-quant block quantization and M is the medium quality tier, compressing weights to about 4.5 bits on average.
After Q4_K_M quantization, the pruned 3.81B model is 2.75 GB in size, achieves an inference speed of 79 tokens/s on a Mac, and uses about 3.8 GB of memory.
Q4_K_M is one of the GGUF quantization schemes proposed by llama.cpp, typically compressing model size to about a quarter of FP16 while keeping the perplexity loss within a very small range.
Common quantization schemes include GPTQ, AWQ, the GGUF series (such as Q4_K_M) and others.
Different quantization types (such as Q4_K_M and Q8_0) each have trade-offs in size, speed and quality.
Q8_0 is 8-bit block quantization with high precision but limited compression; Q4_K_M balances size and quality through mixed precision at the 4-bit level and is one of the commonly used default tiers for local deployment.
Llama.cpp's llama-quantize tool implements block-wise quantization; the K series in the naming (such as Q4_K_M) denotes the k-quants mixed quantization strategy, and M stands for the medium tier.
In a comparison of Qwen3-0.6B in BF16 versus Q4_K_M, Q4_K_M changed the top-1 token at 11.6% of positions, with an average KL divergence of 0.067 and perplexity rising from 7.83 to 8.53.
With flash attention disabled, Q4_K_M outputs are bitwise identical at ubatch sizes that are multiples of 4 and not at other sizes, indicating that llama.cpp's CPU path is not batch-invariant across all batch sizes.
27 more timeline events
All Facts (20)
llama.cpp applies quantization compression of model weights in formats such as 4-bit and 8-bit via the GGUF format, significantly reducing VRAM and memory usage.
90%Verified4-bit quantization techniques (such as GPTQ, AWQ, and the GGUF format) can reduce model VRAM requirements to 1/4 of the original, but come with a certain degree of accuracy loss
90%VerifiedIn GGUF quantization naming, Q4_K_M denotes a 4-bit quantization, Medium-precision variant using the K-Quant grouped quantization method
80%VerifiedQ4_K_M uses mixed precision, storing some critical weights at 6-bit and the remainder at 4-bit, with an overall average of approximately 4.5-bit.
80%VerifiedIn Q4_K_M, K stands for the k-quants scheme and M stands for medium quality level, representing a mixed quantization strategy introduced by llama.cpp
80%VerifiedThe Qwen2.5:7B model is approximately 4 GB in size after Q4 quantization.
80%VerifiedQ4_K_M in the GGUF format employs a Group Quantization strategy, computing scale factors and zero points independently for each group
75%VerifiedCommon quantization schemes include GPTQ, AWQ, the GGUF series (such as Q4_K_M) and others.
65%VerifiedQuantization compresses the storage precision of model parameters from 16-bit down to 8-bit or even 4-bit, thereby reducing memory usage, but at the cost of potential loss in model accuracy.
65%VerifiedQuantization is a model compression technique; Q4 is easier to run, while Q8 retains higher quality but consumes more memory
65%VerifiedCommunity rule of thumb holds that Q4_K_M (4-bit medium-precision quantization) offers the best balance between performance and file size in most scenarios.
65%UnverifiedQ4_K_M量化大约表示每个权重4位,并对异常值采用特定方案,在内存受限的机器上通常是甜点选择。
60%Unverified7B–9B parameter models typically occupy 5–7 GB of VRAM after Q4 or Q5 quantization.
60%UnverifiedQ4_K_M is approximately 1/4 the size of the original model and is the mainstream choice for balancing quality and size.
60%UnverifiedIQ2_XXS encodes weights at an average bit rate of approximately 2.06 bits, IQ3_S at approximately 3.44 bits, and Q4_K_M at approximately 4.83 bits.
60%UnverifiedThe GGUF quantization format can compress FP16 or BF16 precision models to 4-bit or even 2-bit precision.
60%UnverifiedThe perplexity loss of Q4_K_M quantization compared to FP16 is typically within 1%–3%
60%Unverifiedllama.cpp's Q4_K_M quantization method did not shift the behavior of the two models Qwen2.5-3B and Llama-3.2-3B at the same bits per weight.
50%UnverifiedAfter Q4_K_M quantization, the pruned 3.81B model is 2.75 GB in size, achieves an inference speed of 79 tokens/s on a Mac, and uses about 3.8 GB of memory.
50%UnverifiedQ4_K_M is a 4-bit quantization scheme in the llama.cpp ecosystem, where K denotes k-quant block quantization and M is the medium quality tier, compressing weights to about 4.5 bits on average.
50%