Which GGUF quantization level should you pick?
Every GGUF file you download is a trade between how much of your GPU it needs and how close it stays to the full-precision model. Here is what each quantization level actually does, the real numbers behind Q8_0 down to Q2_K, and how to pick without guessing.
What you’ll learn
- Explain how quantization trades precision for a smaller file and less memory use.
- Decode a GGUF filename like Q4_K_M into bits per weight and quality tier.
- Compare quant levels Q8_0 through Q2_K by size, bits per weight, and quality cost.
- Explain what perplexity measures and why a lower number is better.
- Estimate the VRAM a model needs before downloading it.
- Choose a quantization level and model size that fit your available VRAM.
GGUF is the file format llama.cpp and most of its ecosystem, including Ollama and LM Studio, use to package a quantized model plus its metadata in one file. Open a GGUF repo on Hugging Face and you will see a list of files named things like Q4_K_M, Q5_K_S, and Q8_0: the same model, quantized to different precisions. Pick carelessly and you either waste memory you did not need to spend, or load a version too degraded to trust. This guide has the real numbers behind that choice, pulled from the tools that actually produce these files.
What quantization actually does
A freshly trained model stores each parameter (weight) as a 16-bit or 32-bit floating-point number. Quantization replaces that with fewer bits per weight, commonly 8, 6, 5, 4, 3, or 2. Fewer bits per weight means less precision for each number, but also less data to store overall, so the whole file shrinks. An 8-billion-parameter model at full 16-bit precision runs close to 15 GB just for the weights. Quantized to Q4_K_M, the same model needs under 5 GB.2
Model weights are not equally important, and most cluster in a narrow range around zero. That is why trimming precision does not break a model outright: it degrades gradually, at least down to a point, and that gradual curve is the entire reason quantization is worth doing. The numbers below show exactly how gradual, and where it stops being gradual.
That is the whole trade: fewer bits per weight buys less VRAM and RAM, a smaller download, and usually faster inference, in exchange for some accuracy. The rest of this guide is about where that trade stops being worth it, for your hardware and your use case.
Decoding the GGUF name
Take Q4_K_M apart and it reads as three pieces. Q4 is 4 bits per weight, on average. K means it uses the newer "k-quant" method, covered below. S, M, or L (Small, Medium, Large) says how much of the model gets the full bit count versus a lower one: an _M file spends a little more precision on certain tensors than _S does, and a little less than _L.1 A file named just Q4_0, with no K, is the older legacy method described further down.
The bit count in the name is an average, not an exact figure. K-quants group weights into "super-blocks" that share a scale, and different tensors inside the model, attention weights versus feed-forward weights for example, can be assigned a different quant type within the same file. That is why Q4_K_M measures out to roughly 4.5 to 4.9 bits per weight in practice, not a flat 4.1
The quant-level comparison table
These sizes and bit counts are real measurements against the Llama-3.1-8B model, taken from the tool that produces GGUF quantizations.2 The quality-cost column comes from a different, older benchmark: the original k-quants pull request measured perplexity on a 7B LLaMA model against the wikitext dataset, where full 16-bit precision (F16) scored 5.9066.3 The two were not measured on the same model, so read the percentages as directional. Perplexity shift depends on the architecture and the fine-tune, and yours will differ somewhat.
| Level | Bits/weight | Size (8B model) | Quality cost vs. F16 | When to use |
|---|---|---|---|---|
| Q8_0 | 8.50 | 7.95 GB | Negligible, close to indistinguishable | VRAM to spare; the safest floor |
| Q6_K | 6.56 | 6.14 GB | About +0.004 ppl (~0.1%) | Near-lossless in less space than Q8_0 |
| Q5_K_M | 5.70 | 5.33 GB | About +0.014 ppl (~0.2%) | A notch of headroom above the default |
| Q4_K_M | 4.89 | 4.58 GB | About +0.05 ppl (under 1%) | The default. Best balance for most people |
| Q3_K_M | 4.00 | 3.74 GB | About +0.24 ppl (~4%) | Only when Q4 will not fit in memory |
| Q2_K | 3.16 | 2.95 GB | About +0.87 ppl (~15%) | Last resort; loss is noticeable |
What perplexity means, in plain terms
Perplexity measures how surprised a model is by real text it was not trained to memorize.4 Feed it a held-out passage and, at each word, check how confidently it predicted what came next, then average that across the passage into one number. Lower is better: a perplexity of roughly 6 means the model was choosing among about 6 equally likely next words on average, while a perplexity of 7 means it was less certain, spreading its guess across more options. It is not a percentage or a pass/fail score, and it does not measure any one skill like coding or math directly. It is a rough, model-wide gauge of fluency loss: useful for comparing one quantization of a model against itself, less useful for comparing across different models or architectures.
K-quants versus older legacy quants
Before k-quants, llama.cpp used a simpler scheme: Q4_0, Q5_0, Q8_0, and their variants, which round each weight to the nearest representable value within a small block of 32 weights, using one scale per block.1 It works, but it spends the same precision everywhere, whether a given weight matters a lot to the output or barely at all.
- K-quants (the
_Ksuffix) group weights into larger super-blocks and let different parts of the model use different precision, spending more bits where it helps and fewer where it does not.1 - At the same bit budget, a K-quant keeps noticeably closer to full precision than the legacy type it replaces, which is why the comparison table above uses K-quants throughout.
- The legacy Q4_0/Q5_0/Q8_0 family still shows up mainly for backward compatibility and specific hardware paths; Hugging Face's own documentation now labels them "not used widely as of today."1
Importance matrix (imatrix) and I-quants, briefly
An importance matrix is calibration data, real text run through the full-precision model before quantizing, that records which weights actually move the output on typical input. Quantizing with an imatrix (the --imatrix flag in llama.cpp's quantize tool) spends the bit budget more carefully: weights the matrix flags as important keep more precision, and the rest give up a little more.5 It is optional for most K-quants and close to essential for the smallest ones.
I-quants (IQ4_XS, IQ3_S, IQ2_XXS, and similar) are a further family built to use an imatrix from the start, reaching down to roughly 2 bits per weight and below while staying more coherent than a legacy quant at the same size.1 They take longer to produce and are not always as fast to run as a K-quant, so reach for them only once you are already below Q3 and need every bit of quality you can get.
--imatrix against it. That lets you bias the quantization toward the kind of input you actually send the model, code instead of general prose, for example, at the cost of running the calibration pass yourself before quantizing.Estimating VRAM before you download anything
The weights alone are roughly params times bits per weight, divided by 8 for bytes. An 8-billion-parameter model at 4.89 bits/weight (Q4_K_M) works out to about 8,000,000,000 × 4.89 ÷ 8 ≈ 4.9 GB, which matches the measured 4.58 GB closely enough for planning.2 That covers only the weights, though.
- Weights: params × bits/weight ÷ 8. This is the floor. It has to fit in VRAM (or RAM, for CPU inference) before anything else does.
- KV cache: memory that grows with context length and the number of layers and attention heads. A long conversation or a large pasted file can add real gigabytes on top of the weights.
- Runtime overhead: the inference engine, buffers, and anything else sharing the GPU. Budget headroom for this; it is not a number you can shave to zero.
As a starting rule of thumb, leave 10 to 20% of your VRAM free above the weight size for short conversations, and more if you plan to run a large context window regularly. If a quant just barely fits the raw weights, it will not fit once you start actually using it.
Choosing by your hardware
These are starting points built from the same weight-size math above, not a promise for any specific model. Always check the exact file size on the model page before committing to a multi-gigabyte download.
| VRAM you have | A reasonable pick | Why |
|---|---|---|
| 6 to 8 GB | A 7 to 8B model at Q4_K_M | Weights land under 5 GB, leaving room for the KV cache and overhead |
| 10 to 12 GB | A 7 to 8B model at Q6_K or Q8_0, or a bigger model at Q4_K_M | Enough headroom to spend it on precision, or on parameters instead |
| 16 to 24 GB | A 13 to 14B model at Q5_K_M/Q6_K, or a 30B-class model at Q4_K_M | This is where the bigger-model-lower-quant trade starts paying off |
| CPU or unified memory only | Whatever fits in system RAM; expect slower generation | The same math applies. System RAM is just slower to read from than VRAM |
Bigger model at a lower quant, or smaller model at a higher quant?
Given a choice between a bigger model quantized lower and a smaller model quantized higher, at roughly the same file size, prefer the bigger model, down to about Q4. The pull request that introduced k-quants made exactly this case with data: it plotted perplexity against file size for LLaMA 7B, 13B, 30B, and 65B, each at several quant levels, and the larger models at lower precision consistently beat the smaller models at higher precision for the same size budget.3 A bigger model has more to say even at a slightly blurred precision than a smaller model says clearly.
Where GGUF files actually come from
Almost nobody quantizes their own models from scratch. Most GGUF files on Hugging Face's GGUF listing were converted by the model's original publisher or by a community contributor, using llama.cpp's own conversion script to go from the original format, often safetensors, into GGUF, and then the llama-quantize tool to produce each Q-level.2 Hugging Face also hosts a no-setup conversion tool that runs the same pipeline for you, for the rare case where a model has not been published in GGUF yet.1
When you are choosing a download, check the model card for which quants the publisher actually tested, and prefer a repo that used an imatrix if you are going below Q4. Not every uploader calibrates with one, and the ones that do usually say so.
How to choose, in short
- Default to Q4_K_M. It is the standard recommendation for a reason: under 1% perplexity cost for a real cut in memory.2
- Go up to Q5_K_M or Q6_K if the model fits with room to spare and you want the last bit of quality for close to free.
- Go down to Q3 or lower only when it is the difference between running a model at all and not running it, and prefer an imatrix or I-quant version if you do.
- Given equal file size, pick the bigger model at a lower quant over a smaller model at a higher one, as long as you are staying at Q4 or above.
- Always budget beyond the weight size for the KV cache and runtime overhead before assuming a quant will fit on your GPU.
Sources
Verified against primary sources: August 2026.
- GGUF quantization types. Hugging Face Hub docs. https://huggingface.co/docs/hub/gguf
- quantize tool README: quant types, bits/weight, and measured size for Llama-3.1-8B. ggml-org/llama.cpp, GitHub. https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md
- k-quants pull request: perplexity vs. model size data. ggml-org/llama.cpp, GitHub. https://github.com/ggml-org/llama.cpp/pull/1684
- Perplexity of fixed-length models. Hugging Face Transformers docs. https://huggingface.co/docs/transformers/en/perplexity
- Importance matrix (imatrix) quantization support. ggml-org/llama.cpp, GitHub. https://github.com/ggml-org/llama.cpp/pull/4861