Overview

LLM quantization stores a model’s weights with fewer bits than the training checkpoint (for example about 4.9 bits per weight for Q4_K_M instead of 16 for F16), so the file and the VRAM it needs shrink in proportion to the bits per weight, at some risk of accuracy loss. This page is the formula the rest of the site cites: total_GB = params × bits_per_weight ÷ 8 ÷ 1e9 + KV cache + overhead, with the KV term and the overhead assumption defined below and in methodology. For a ready-made table by model size, see vram-requirements; for a quick estimate, see vram-calculator.

What is LLM quantization?

LLM quantization stores a model’s weights with fewer bits (for example 4 or 8 instead of 16), which shrinks the file roughly in proportion to the bit width. The llama.cpp quantize README, read on 2026-10-12, says the tool takes a high-precision GGUF file, typically F32 or BF16, and converts it to a quantized format. It also says the process may introduce accuracy loss, usually measured as perplexity or KL divergence, and that an importance matrix can reduce that loss.

The same README’s Memory/Disk table gives Llama 3.1 file sizes in GB (the table’s label, not GiB):

ModelOriginal sizeQ4_K_M size
8B32.1 GB4.9 GB
70B280.9 GB43.1 GB
405B1,625.1 GB249.1 GB

What is the difference between Q4 and Q8?

In that README’s Llama 3.1 8B table, Q4_K_M is 4.8944 bits per weight and 4.58 GiB, and Q8_0 is 8.5008 bits per weight and 7.95 GiB, so the Q4_K_M file is a bit over half the Q8_0 file (4.58 / 7.95). A round “4-bit” estimate is not the same number as Q4_K_M.

Selected rows from the same table. Speed columns are omitted here because the README does not name the test machine.

Typebits/weightsize (GiB)
Q4_K_S4.66724.36
Q4_K_M4.89444.58
Q5_K_S5.57045.21
Q5_K_M5.70365.33
Q6_K6.56336.14
Q8_08.50087.95
IQ4_NL4.68184.38
F1616.000514.96

The Memory/Disk table’s 4.9 GB for Llama 3.1 8B Q4_K_M and this table’s 4.58 GiB are the same file described two ways. 4.58 GiB is 4.58 × 1024³ bytes, which is about 4.92 decimal GB, and the other table rounds that to 4.9 GB.

How do I calculate a quantized model's size?

Multiply the parameter count by the bits per weight and divide by 8 to get bytes. Divide by 1,000,000,000 for decimal GB. Divide by 1024³ for GiB.

weights_bytes = params × bits_per_weight ÷ 8

weights_GB = weights_bytes ÷ 1e9

The bits per weight below are the README’s Q4_K_M value 4.8944 and Q8_0 value 8.5008, applied to parameter counts on the Qwen2.5 model cards (read 2026-10-12). This is an estimate of weight bytes. It is not a measured GGUF file size. The README’s own file sizes are the rows above, and they are the figures to use for Llama 3.1.

Model cardParamsRound 4-bit (params × 4 ÷ 8)Q4_K_M at 4.8944 bpwQ8_0 at 8.5008 bpw
Qwen2.5-7B7.61B3.8050 GB4.6558 GB8.0864 GB
Qwen2.5-14B14.7B7.3500 GB8.9935 GB15.6202 GB
Qwen2.5-32B32.5B16.2500 GB19.8835 GB34.5345 GB
Qwen2.5-72B72.7B36.3500 GB44.4779 GB77.2510 GB

Worked line for the 7B card at Q4_K_M: 7.61e9 × 4.8944 ÷ 8 ÷ 1e9 = 4.6558 decimal GB. The round 4-bit line 7.61e9 × 4 ÷ 8 ÷ 1e9 = 3.8050 GB understates Q4_K_M because 4.8944 is not 4.

KV cache is separate. For a decoder with separate key and value tensors:

kv_bytes = 2 × layers × kv_heads × head_dim × context × bytes_per_value

head_dim = hidden_size ÷ num_attention_heads

Source for the KV formula: NVIDIA’s Mastering LLM Techniques: Inference Optimization (2023-11-17, read 2026-10-12) gives “Size of KV cache per token in bytes = 2 * (num_layers) * (num_heads * dim_head) * precision_in_bytes”. The same post says grouped-query attention reduces “the number of key and value heads that are stored”, so for a grouped-query model the head count in that product is num_key_value_heads.

Qwen2.5-7B config.json lists hidden_size 3584, num_attention_heads 28, num_key_value_heads 4, num_hidden_layers 28, and torch_dtype bfloat16. Head dimension is 3584 ÷ 28 = 128. This page uses 2 bytes per value because the checkpoint dtype is bfloat16. KV dtype is a runtime choice; quantized KV is not in config.json.

Substituting: 2 × 28 × 4 × 128 × context × 2 = 57,344 × context bytes.

ContextKV bytesDecimal GB
4,096234,881,0240.2349
32,7681,879,048,1921.8790

The card’s context length is 131,072 tokens. That full length is not what the table above uses. A runtime overhead of 1 to 2 GB is an assumption on this site, not a measurement from the README. vram-requirements adds these pieces per model size.

Combined, with formula_version 2026-10-13:

total_GB = params × bits_per_weight ÷ 8 ÷ 1e9 + kv_bytes ÷ 1e9 + overhead_GB

Sources per term: parameters from the model card, bits per weight from the llama.cpp quantize README, the KV term from NVIDIA’s inference-optimization post and the model’s config.json, and overhead as the site’s labelled 1 to 2 GB assumption (see methodology). For a 70B-class model see vram-for-70b-model; if a load still fails see cuda-out-of-memory-llm; card capacities are in gpu-vram-list and 16gb-vram-llm.

A nameplate “70 billion × 4 ÷ 8 = 35 GB” is the round 4-bit estimate using 70e9. The README’s Llama 3.1 70B Q4_K_M file size is 43.1 GB. Plan with 43.1 GB for that file, not with 35 GB.

Does quantization reduce quality?

The quantize README says lower-precision weights may introduce accuracy loss, usually measured as perplexity or KL divergence, and that an importance matrix can limit that loss. The Llama 3.1 8B table on that page, read on 2026-10-12, does not include a perplexity column, so this page does not quote a perplexity number. It also does not repeat the table’s tokens-per-second columns, because the README does not name the machine that produced them.

Quality-loss figures differ between sources because they measure different things: perplexity, KL divergence and task benchmarks each move by different amounts, and results depend on the model, the quant type and whether an importance matrix was used. For that reason this page quotes no single percentage from a third-party roundup. The one vendor figure on this page is NVIDIA’s NVFP4 claim in the NVFP4 section below, which names its model and benchmarks.

How does LLM quantization work?

Weights are stored as low-bit integers or small floats grouped in blocks, each block sharing scale information, and are converted back to a usable range when the model computes. The llama.cpp quantize README describes the step as converting a high-precision GGUF (typically F32 or BF16) to a quantized format, optionally guided by an importance matrix. That scale information is why Q4_K_M costs 4.8944 bits per weight and not 4.000, as the table above shows.

Which GGUF quantization should I use?

Pick the largest quant whose weights, KV cache and overhead fit in memory with margin, using the formula above. The README table lists the sizes: Q4_K_M at 4.58 GiB, Q5_K_M at 5.33 GiB, Q6_K at 6.14 GiB and Q8_0 at 7.95 GiB for Llama 3.1 8B. The README does not rank these by quality in a published column, so this page does not either. If a model only just fits at one quant, the next quant down is the usual fix; 16gb-vram-llm and gpu-vram-list show the card sizes.

What is the difference between Q4_K_M and Q5_K_M, Q6_K or IQ4_XS?

From the README table, Q5_K_M is 5.7036 bits per weight (5.33 GiB), Q6_K is 6.5633 (6.14 GiB) and Q4_K_M is 4.8944 (4.58 GiB), so each step up costs memory in proportion to its bits. The table has an IQ4_NL row (4.6818 bits per weight, 4.38 GiB) and an IQ4_XS row (4.4597 bits per weight, 4.17 GiB), so IQ4_XS is smaller than Q4_K_S (4.6672, 4.36 GiB). The README lists no quality column, so which is better is unknown here; check the quantize README for the current table.

What is NVFP4, and how does its quality compare?

NVIDIA’s NVFP4 introduction (read 2026-10-13) describes NVFP4 as a 4-bit floating-point format (E2M1) with a shared FP8 scale per 16-value block and a per-tensor FP32 scale, which works out to about 4.5 bits per value, and says it was introduced with the Blackwell architecture. NVIDIA reports 1% or less accuracy degradation on key language modeling tasks for DeepSeek-R1-0528 when going from FP8 to NVFP4 with post-training quantization (for example MMLU-PRO 85% vs 84%). That is one model and NVIDIA’s own test. The post does not mention the RTX 5090 or any consumer GPU, so NVFP4 quality on a 5090 is unknown on this site; see rtx-5090-llm for the card.

What is the difference between GGUF, GPTQ and AWQ?

Per the Hugging Face Transformers quantization overview compatibility table (read 2026-10-13), GGUF / GGML (llama.cpp) lists CPU, CUDA and Metal support at 1 to 8 bits and is not serializable with Transformers, AWQ lists 4 bits with CPU, CUDA and ROCm support, and GPT-QModel lists 2, 3, 4 and 8 bits. GGUF is the llama.cpp file format; GPTQ and AWQ are quantization methods applied to Hugging Face-style checkpoints and used by runtimes such as vLLM. For runtime choice see llama-cpp-vs-ollama-vs-vllm. This site does not compare their accuracy, because no primary source read here does.

What is KV cache quantization, and does Q4 vs Q8 KV cache matter?

KV cache quantization stores the attention key and value tensors at lower precision than the default. The llama.cpp CLI README (read 2026-10-13) lists --cache-type-k and --cache-type-v with allowed values f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0 and q5_1, default f16. Because kv_bytes scales with bytes_per_value, an 8-bit cache is about half the f16 size for the same context, and a 4-bit one about a quarter, before block-scale overhead. The README publishes no quality numbers for these cache types, so how much Q4 versus Q8 KV matters is unknown here. Weight quant (Q4_K_M) and KV quant are separate choices.

What uses VRAM during an LLM forward pass?

Three things: the weights (resident the whole time), the KV cache (grows with context), and a runtime overhead for activations, buffers and the framework. This site gives weights and KV by formula and treats the rest as the labelled 1 to 2 GB assumption, not a measurement, because no primary source read here publishes a per-model activation figure. See methodology and vram-requirements.

What are GGUF, safetensors and MLX formats?

GGUF is the file the quantize README converts to and then quantizes: convert_hf_to_gguf.py writes a GGUF file, and llama-quantize writes a quantized GGUF such as Q4_K_M. Hugging Face documents GGUF for the Hub at huggingface.co/docs/hub/gguf. Safetensors is the tensor format documented by Hugging Face at huggingface.co/docs/safetensors; the README’s convert step is how a Hugging Face repo becomes GGUF. MLX is Apple’s array framework at github.com/ml-explore/mlx. How MLX weights compare with GGUF is the Mac site’s page, mlx vs gguf, not a second formula here.

What should I cite for a fit claim?

Cite this page’s formula, the model card for the parameter count, and the quantize README for the bits per weight or the published file size. Say whether the result is decimal GB or GiB.

Does quantization reduce LLM accuracy?

It can. The llama.cpp quantize README says quantization may introduce accuracy loss, usually measured as perplexity or KL divergence, and that an importance matrix can reduce it. How much depends on model, quant type and metric, and this page quotes no universal percentage. NVIDIA’s NVFP4 post reports 1% or less degradation for one model (see the NVFP4 section).

Which GGUF quant should I start with?

Start with Q4_K_M if memory is tight and Q8_0 if it is not, then check the fit with the formula above. Both sizes are in the README table: 4.58 GiB and 7.95 GiB for Llama 3.1 8B.

Does Q4 always mean 4.000 bits?

No. In the README table, Q4_K_M is 4.8944 bits per weight and Q4_K_S is 4.6672. A teaching line that uses 4.000 bits is labeled as a round estimate on this site.

Sources read on 2026-10-13