Q4_K_M vs Q5_K_M vs Q8_0: which GGUF quant should you use? A developer's comparison of llama.cpp GGUF quantization formats recommends Q4_K_M as the default choice, citing llama.cpp figures of 4.89 bits per weight and a +0.1754 perplexity increase on Llama 3.1 8B, versus +0.0569 for Q5_K_M and +0.0026 for Q8_0. The writeup explains that _K k-quants group weights into 256-weight super-blocks with per-sub-block scales, and that _S/_M/_L suffixes control how many sensitive tensors (attn_v, ffn_down) are promoted to higher precision. It notes Q4_K_M costs only about 0.22 GiB more than Q4_K_S while cutting perplexity damage from +0.2689 to +0.1754, and warns that damage jumps sharply below 4 bits, with Q2_K adding roughly 20 times the perplexity of Q4_K_M. Use Q4 K M unless your memory budget clearly fits something bigger: llama.cpp's published figures put it at 4.89 bits per weight on Llama 3.1 8B and +0.1754 perplexity on Llama-3-8B, against +0.0569 for Q5 K M and +0.0026 for Q8 0. On Nodus you can test the quant on the GPU you plan to serve it on, with an RTX 4090 listed at $0.29/hr and an A100 80 GB at $1.09/hr on the Nodus pricing page. Step up to Q5 K M or Q6 K when the file plus your context still fits, and treat Q3 and Q2 quants as a last resort. The number is the bit width of most weights, the letter after it is the quantization family, and the suffix is the mix. Q8 0 and Q4 0 are the older "legacy" formats. The Hugging Face GGUF docs https://huggingface.co/docs/hub/gguf describe them as round-to-nearest quantization in blocks of 32 weights, each block with one scale, and note they are "not used widely as of today". The K types are k-quants, added to llama.cpp in pull request 1684 https://github.com/ggml-org/llama.cpp/pull/1684 . They group weights into super-blocks of 256 and store a small scale and for some types a minimum per sub-block. Per the Hugging Face table, that gives the base Q4 K type 4.5 bits per weight, Q5 K 5.5, Q6 K 6.5625 and Q2 K 2.625. Q8 0 is still the common 8-bit choice because at 8 bits the simple scheme is already close to lossless. A file named Q4 K M is never 4.5 bits everywhere. It is a recipe that keeps some tensors at higher precision, which is why the llama.cpp quantize README https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md measures Q4 K M at 4.8944 bits per weight on Llama 3.1 8B. S , M and L mean small, medium and large: how many sensitive tensors get promoted to a higher-bit type. The rules live in src/llama-quant.cpp https://github.com/ggml-org/llama.cpp/blob/master/src/llama-quant.cpp , and they are short enough to summarize. In Q4 K M, the attention value attn v and feed-forward down projection ffn down tensors are stored as Q6 K in roughly half the layers: the first eighth, the last eighth and every third layer in between. Everything else stays Q4 K. Q4 K S only promotes ffn down to Q5 K in the first eighth of layers and attn v in the first four. Q5 K M follows the same pattern as Q4 K M, with Q6 K on top of a Q5 K base. L exists only for Q3 Q3 K L , where it pushes those tensors to Q5 K. The cost of M over S is small. On Llama 3.1 8B the README lists Q4 K S at 4.36 GiB and Q4 K M at 4.58 GiB, about 5% more. The quantize tool's own table https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/quantize.cpp lists the perplexity increase falling from +0.2689 to +0.1754 for that step. If you can afford the extra 0.22 GiB, take the M . Less than most people expect down to 4 bits, and a lot below 3. The table combines the two figures llama.cpp publishes: bits per weight and file size from the README benchmark on Llama 3.1 8B, and the perplexity change listed in quantize.cpp , measured on Llama-3-8B. Perplexity is how surprised the model is by held-out text, so a bigger increase means more damage. | Quant | Bits per weight | Llama 3.1 8B file | Perplexity change | |---|---|---|---| | Q2 K | 3.1593 | 2.95 GiB | +3.5199 | | Q3 K M | 3.9960 | 3.74 GiB | +0.6569 | | Q4 0 | not in README table | 4.34 G quantize.cpp | +0.4685 | | Q4 K S | 4.6672 | 4.36 GiB | +0.2689 | | Q4 K M | 4.8944 | 4.58 GiB | +0.1754 | | Q5 K M | 5.7036 | 5.33 GiB | +0.0569 | | Q6 K | 6.5633 | 6.14 GiB | +0.0217 | | Q8 0 | 8.5008 | 7.95 GiB | +0.0026 | | F16 | 16.0005 | 14.96 GiB | +0.0020 on Mistral-7B | Sources: llama.cpp quantize README https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md and quantize.cpp https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/quantize.cpp , checked November 25, 2026. Damage grows slowly down to Q4 K M, then jumps: Q2 K adds 20 times the perplexity of Q4 K M. Two things stand out. Q4 0 is nearly the same size as Q4 K S but adds 0.4685 to perplexity instead of 0.2689, so there is little reason to pick it for a new file. And the curve is not linear: going from Q4 K M to Q3 K M saves under 0.9 bits per weight and almost quadruples the loss. Perplexity is one number on one model. It does not tell you how a quant handles your tool calls or your language. Treat these figures as the ranking and your own eval as the verdict. File size is parameters times bits per weight divided by 8. The README gives the inputs: Llama 3.1 8B is 32.1 GB at F32 4 bytes per weight , so 32.1 / 4 = 8.03 billion weights. Llama 3.1 70B is 280.9 GB at F32, so 280.9 / 4 = 70.2 billion. For the 8B at Q4 K M: 8.03B x 4.8944 / 8 = 4.91 GB. The README's 4.58 GiB is 4.92 GB, so the formula holds. For the 70B at Q4 K M: 70.2B x 4.8944 / 8 = 42.9 GB, against 43.1 GB in the README's own memory table. The 70B mix differs slightly from the 8B one, so treat the other 70B rows as close estimates. A 70B at Q4 K M is 42.9 GB, under a third of the 140.4 GB F16 file. The same arithmetic for the 70B gives 27.7 GB at Q2 K, 35.1 GB at Q3 K M, 41.0 GB at Q4 K S, 50.0 GB at Q5 K M, 57.6 GB at Q6 K, 74.6 GB at Q8 0 and 140.4 GB at F16. For the 8B: 3.17, 4.01, 4.68, 5.72, 6.59, 8.53 and 16.06 GB. The file is not the whole bill, because the KV cache grows with context. Both Llama configs use 8 KV heads of 128 dimensions, with 32 layers in the 8B https://huggingface.co/unsloth/Meta-Llama-3.1-8B-Instruct/blob/main/config.json and 80 in the 70B https://huggingface.co/unsloth/Llama-3.3-70B-Instruct/blob/main/config.json . At 16 bits that is 2 x 32 x 8 x 128 x 2 = 131,072 bytes per token for the 8B and 2 x 80 x 8 x 128 x 2 = 327,680 bytes for the 70B. An 8,192-token context adds 1.07 GB and 2.68 GB respectively. Our rule: take the largest quant whose file plus the KV cache for your real context fits, with room left for compute buffers. If two quants fit, take the larger one. The table applies that rule at an 8,192-token context using the numbers above. | Memory | 8B model | 70B model | |---|---|---| | 8 GB | Q5 K M 5.72 + 1.07 = 6.79 GB , Q4 K M 5.98 GB for longer context | does not fit | | 12 GB | Q8 0 8.53 + 1.07 = 9.60 GB | does not fit | | 16 GB | Q8 0, with room for longer context | does not fit | | 24 GB | F16 16.06 + 1.07 = 17.13 GB | does not fit, even Q2 K needs 30.4 GB | | 48 GB | F16 | Q4 K M 42.9 + 2.68 = 45.6 GB , tight | | 64 GB | F16 | Q6 K 57.6 + 2.68 = 60.3 GB | | 80 GB | F16 | Q8 0 74.6 + 2.68 = 77.3 GB , tight | | 96 GB | F16 | Q8 0, with room for longer context | Longer contexts shift every row down. At 32,768 tokens the 70B cache alone is 10.7 GB, which pushes a 48 GB card from Q4 K M to Q3 K M. For which models fit on common consumer cards, see which LLMs fit in 8, 16 or 24 GB https://www.nodus-compute.ai/blog/which-llms-fit-in-8gb-16gb-24gb-vram/ , and for the 70B case in detail, how much VRAM a 70B model needs https://www.nodus-compute.ai/blog/vram-needed-for-70b-model/ . Q4 K M wins as the default for chat and agents on a fixed memory budget. It is under a third of F16 and the curve is still flat at that point. Q5 K M and Q6 K win when the larger file fits with your context. They cut the perplexity increase to +0.0569 and +0.0217, a cheap upgrade if you have 1 to 2 GB to spare on an 8B. Q8 0 wins as the reference copy. At +0.0026 it is effectively the original model, so when a fine-tune behaves badly, compare against Q8 0 first to learn whether training or quantization caused it. F16 or BF16 wins as the master file you quantize from. The README warns that requantizing an already-quantized file "can severely reduce quality". Keep the 16-bit GGUF and make every other quant from it. Speed is a smaller factor than people assume. In the README benchmark on Llama 3.1 8B, text generation ran at 71.93 tokens per second on Q4 K M, 67.23 on Q5 K M, 58.67 on Q6 K, 50.93 on Q8 0 and 29.17 on F16. The README does not say which machine produced these, so read them as relative. Smaller files usually generate faster, because generating each token means reading the weights from memory. Almost always. Q2 K adds +3.5199 perplexity on Llama-3-8B, 20 times Q4 K M, to save about 1.7 GB on an 8B. If a model only fits at Q2 K, a smaller model at Q4 K M or Q5 K M is usually the better trade. Q3 K M is defensible when it is the only way a 70B fits and you have tested it on your task. Below 4 bits, use an importance matrix. The README says accuracy loss "can be minimized by using a suitable imatrix file", which llama-quantize takes through --imatrix . Convert once to a 16-bit GGUF, then quantize that file as many times as you like. These commands are copied from the llama.cpp quantize README https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md : python convert hf to gguf.py --outfile gemma-4-E2B-it-bf16.gguf --outtype bf16 --remote google/gemma-4-E2B-it ./build/bin/llama-quantize gemma-4-E2B-it-bf16.gguf gemma-4-E2B-it-Q4 K M.gguf Q4 K M Swap the last argument for Q5 K M , Q6 K or Q8 0 to get the other files. Plan for memory and disk: the README says the input is loaded fully into memory and gives 280.9 GB for an F32 70B. If you do not want to install anything, the README also points to the GGUF-my-repo space on Hugging Face. Quantizing is not where the GPU money goes. When we wrote our guide to fine-tuning a model for Ollama https://www.nodus-compute.ai/blog/fine-tune-model-for-ollama/ , llama.cpp conversion and quantization of our small test model ran on CPU only. That post covers the full export path, so we will not repeat it here. The GPU time is in two places: training the model and checking the quant. Nodus runs fine-tunes as TrainingJobs https://www.nodus-compute.ai/docs/guides/training/ on the cheapest capacity that will finish them, with checkpoints and recovery if a machine is lost. When a Job names a 7B or 8B model, the Nodus Jobs guide https://www.nodus-compute.ai/docs/guides/jobs/ sets a default memory floor of 24Gi, enough for a LoRA or QLoRA https://www.nodus-compute.ai/blog/lora-vs-qlora/ run. Checking the quant is a short Job on the hardware you will serve on: an hour on an RTX 4090 is listed at $0.29 on the Nodus pricing page https://www.nodus-compute.ai/pricing/ , and an A100 80 GB, enough for a 70B at Q6 K with room for context, at $1.09. If the model will serve many users rather than one, compare llama.cpp with a server built for batching in vLLM vs Ollama https://www.nodus-compute.ai/blog/vllm-vs-ollama/ . Prices checked November 25, 2026. For many models it is the common default, and llama.cpp's figures show only +0.1754 perplexity on Llama-3-8B. Code and tool calling punish small errors, so if you have the memory, run your own coding eval on Q4 K M and Q6 K and keep the smaller one only if it scores the same. No. Q8 0 is a GGUF format for llama.cpp with one scale per 32 weights, while FP8 or bitsandbytes 8-bit are different formats for different runtimes. A Q8 0 file only loads in GGUF-compatible tools such as llama.cpp and Ollama. IQ types such as IQ4 XS 4.4597 bits per weight in the README use an importance matrix, per the Hugging Face GGUF docs, and the family reaches down to about 2 bits. They make most sense below 4 bits. At 4 bits and above, the K-quants are the simpler default. Yes. Run the fine-tune as a TrainingJob on Nodus, download the weights it writes, merge any adapter, then convert and quantize with llama.cpp as shown above. Our Ollama export guide https://www.nodus-compute.ai/blog/fine-tune-model-for-ollama/ walks through that path. Originally published on the Nodus blog https://www.nodus-compute.ai/blog/gguf-quantization-types/ .