LLM Quantization Explained: Q4 vs Q8 vs FP16 VRAM Cost

By LLM Hardware team · Methodology ·

Written by the LLM Hardware team with AI assistance. The bits-per-weight and file-size figures come from the llama.cpp quantize README, the Hugging Face GGUF docs and the Qwen3-8B GGUF listing, linked in the sources below.

Quantization levels in gigabytes

Q4 formula
params × 0.5 × 1.2 + 2. A 7B model is 6.2 GB, not a raw 3.5 GB weight.
8B Q4
6.8 GB. 8B Q8 is 11.6 GB. 8B FP16 is 21.2 GB.
Ceiling
8 GB → about 10B, 12 GB → about 16B, 24 GB → about 36B at Q4.
Checked
2026-10-13

Checked 2026-10-13. Author: LLM Hardware team. Amazon prices are not stored or shown on this site.

The figures this comparison uses

Q4_K_M on this site is params × 0.6 + 2, which is params × 0.5 × 1.2 + 2. A 7B model is 6.2 GB. An 8B model is 6.8 GB.

Methodology page. Q4 bytes are 0.5. The 1.2 is short-context overhead. The +2 is the reserve. 7 × 0.6 + 2 = 6.2. 8 × 0.6 + 2 = 6.8. Checked 2026-10-07.

The Q4 ceiling is about 10B on 8 GB, 16B on 12 GB, and 36B on 24 GB.

Largest whole billion where params × 0.6 + 2 still fits: floor((VRAM minus 2) / 0.6). Checked 2026-10-07.

llama.cpp measures Q4_K_M at 4.8944 bits per weight on Llama 3.1 8B, a 4.58 GiB file against 14.96 GiB for F16.

Quantization table for meta-llama/Llama-3.1-8B in the llama.cpp tools/quantize README, checked on 22 November 2026. Checked 2026-11-22.

Methodology keeps the full source list and the formula used for every GB figure here.

Updated 22 November 2026 · Q4 figures use params × 0.6 + 2 · Applies to GGUF files in Ollama and llama.cpp

LLM quantization stores each weight of a model in fewer bits than it was trained with, and that one choice sets the size of the file you download and most of the memory it needs. Qwen3-8B shows the spread. Its official GGUF repo on Hugging Face has the same 8.2B-parameter model as a 5.03 GB Q4_K_M file and an 8.71 GB Q8_0 file, and Ollama lists the FP16 build at 16 GB. The sections below explain the quant names with llama.cpp's own measured bits per weight. Then they add the KV cache, which quantizing the weights does not shrink.

Quick reference

What quantization changes

A model is billions of numbers. Qwen3-8B has 8.2B parameters, and Qwen publishes them in BF16, which the Hugging Face GGUF docs define as a 16-bit shortened version of the 32-bit IEEE 754 float. At 2 bytes each, 8.2B weights come to 16.4 GB before the runtime loads anything else. Quantization rewrites those numbers as small integers plus shared scale factors.

The K-quants show how it works. In Q4_K, weights sit in super-blocks of 8 blocks with 32 weights each, every block carries a 6-bit scale and a 6-bit minimum, and the result is 4.5 bits per weight. Q6_K uses 16 blocks of 16 weights with an 8-bit scale per block, which works out to 6.5625 bits. Q8_0 is simpler. Each block holds 32 weights, and every weight is an 8-bit integer multiplied by one block scale.

Rounding to so few levels adds error. llama.cpp measures that loss as perplexity or Kullback-Leibler divergence against the original model, and its quantize README says an importance matrix file (the --imatrix option) can reduce it. The README prints no loss figure per quant. Since the gap depends on the model, the useful check is two quants of the same model on your own prompts.

Same model, fewer bits

A Q4_K_M build of Qwen3-8B still has the 36 layers and 8 key/value heads listed in its config.json. Only the stored precision of the weights changes. So the KV cache costs the same 147,456 bytes per token at f16 whether the weights are Q4_K_M or Q8_0, and a long context takes the same room at either quant.

The quant types you will see

The table uses the one model that the llama.cpp quantize README measures, meta-llama/Llama-3.1-8B. Its bits per weight run above the nominal width because each block also stores scale factors. For Q4_K_M the measured figure is above even the 4.5 bits of a plain Q4_K block. Size vs F16 divides each file by the 14.96 GiB F16 file.

FormatNominal bitsMeasured per weightSize vs F16Llama 3.1 8B fileTypical use
F32 32-bit 4 bytes 2x Not in the table High-precision input for llama-quantize
F16 16-bit 16.0005 bpw, 2 bytes 1x 14.96 GiB Reference size for the rows below
Q8_0 8-bit 8.5008 bpw, 1.06 bytes 0.53x 7.95 GiB Largest quant in the Qwen3-8B GGUF repo
Q6_K 6-bit 6.5633 bpw, 0.82 bytes 0.41x 6.14 GiB When Q8_0 plus your context will not fit
Q5_K_M 5-bit 5.7036 bpw, 0.71 bytes 0.36x 5.33 GiB One step up from Q4_K_M
Q4_K_M 4-bit 4.8944 bpw, 0.61 bytes 0.31x 4.58 GiB Default build behind llama3.1:8b in Ollama
Q4_K_S 4-bit 4.6672 bpw, 0.58 bytes 0.29x 4.36 GiB When Q4_K_M misses by a small margin
IQ4_XS 4-bit 4.4597 bpw, 0.56 bytes 0.28x 4.17 GiB Smallest 4-bit type in the README table
Q2_K 2-bit 3.1593 bpw, 0.39 bytes 0.20x 2.95 GiB Last step before a smaller model

F32 (32-bit float)

Four bytes per weight. The quantize README treats F32 and BF16 as the high-precision inputs that llama-quantize converts from, and its memory table lists the original Llama 3.1 8B at 32.1 GB. At 4 bytes, the same weights take twice the room of the F16 file, so F32 GGUFs are a starting point for conversion rather than something to run.

F16 (16-bit float, half precision)

Two bytes per weight, measured at 16.0005 bits in the README's Llama 3.1 8B row (14.96 GiB). BF16 is the same size. The Hugging Face GGUF docs call it a 16-bit shortened version of the 32-bit float, and it is the tensor type Qwen ships for Qwen3-8B. Ollama offers that model as qwen3:8b-fp16, a 16 GB download, which is the reference every smaller quant below is compared with.

Q8_0 (8-bit integer)

Blocks of 32 weights, each an 8-bit integer times a block scale. The README measures 8.5008 bits per weight on Llama 3.1 8B, so the file is 7.95 GiB, 53 percent of F16. Hugging Face files Q8_0 under its legacy types. It is still the largest quant in the official Qwen3-8B GGUF repo, at 8.71 GB. Pick it when the file and the cache for your context both fit, since memory is then no reason to go lower.

Q4_K_M (4-bit, medium K-quant)

The default in Ollama. On the llama3.1 tags page, llama3.1:8b has the same hash as llama3.1:8b-instruct-q4_K_M, a 4.9 GB download, and qwen3:8b matches qwen3:8b-q4_K_M at 5.2 GB. The README measures it at 4.8944 bits per weight on Llama 3.1 8B, which is above the 4.5 bits of a plain Q4_K block. The GGUF spec names this file type MOSTLY_Q4_K_M, and it defines that field as the type of the majority of the tensors, not all of them. How much quality it gives up against BF16 depends on the model.

Q4_K_S (4-bit, small K-quant)

4.6672 bits per weight and 4.36 GiB on Llama 3.1 8B, about 0.22 GiB smaller than Q4_K_M. Ollama lists llama3.1:8b-instruct-q4_K_S at 4.7 GB. Use it when Q4_K_M plus your context misses by a small margin.

IQ variants (IQ4_XS, IQ3_M, IQ2_M)

The IQ types work on super-blocks of 256 weights and build each weight from a super-block scale and an importance matrix, per the Hugging Face GGUF docs. Nominal widths there are 4.25 bits for IQ4_XS, 3.44 for IQ3_S and 2.06 for IQ2_XXS. On Llama 3.1 8B the README measures IQ4_XS at 4.4597 bits (4.17 GiB), IQ3_M at 3.7628 bits (3.52 GiB) and IQ2_M at 2.9294 bits (2.74 GiB). These are the files to look at when even Q4_K_S does not fit.

Q2_K (2-bit)

Nominally 2.625 bits per weight in the Hugging Face table. On Llama 3.1 8B the README measures 3.1593 bits and a 2.95 GiB file, 64 percent of the Q4_K_M file. The saving over Q4_K_M is 1.63 GiB on an 8B. When a model only fits at Q2_K, compare it against a smaller model at Q4_K_M before settling.

The site's VRAM formula and real files

The site estimate is params in billions x bytes per param x 1.2 + 2 GB. Bytes per param are 2 for FP16, 1 for Q8, 0.625 for Q5_K_M and 0.5 for Q4_K_M. It is the number to use when no official file size is listed.

Formula

VRAM = params_billions x bytes_per_param x 1.2 + 2

By the numbers, the 1.2 does less for context than it looks. Q4_K_M really costs about 0.61 bytes per weight (4.8944 bits divided by 8), so 0.5 x 1.2 = 0.6 bytes is close to the bare file. The 2 GB is what is left for the KV cache and runtime buffers at a short context. A long window needs its own cache figure on top, worked out in the next section.

ModelQuantizationCalculationSite estimate
Llama 3.1 8B F16 8 × 2.0 × 1.2 + 2 21.2 GB
Llama 3.1 8B Q8_0 8 × 1.0 × 1.2 + 2 11.6 GB
Llama 3.1 8B Q4_K_M 8 × 0.5 × 1.2 + 2 6.8 GB
Llama 3.1 70B Q4_K_M 70 × 0.5 × 1.2 + 2 44 GB
Qwen3-8B (8.2B) Q4_K_M 8.2 × 0.5 × 1.2 + 2 6.9 GB
27B dense Q4_K_M 27 × 0.5 × 1.2 + 2 18.2 GB

These are the site's estimates. Where an official GGUF exists, start from its size and add the cache for your context. The llama.cpp README's memory table puts Llama 3.1 8B at 4.9 GB for Q4_K_M, against 6.8 GB here, and Llama 3.1 70B at 43.1 GB, against 44 GB here.

Worked example: Qwen3-8B at five quants

Qwen3-8B has an official GGUF repo, so the arithmetic can start from real file sizes. Its config.json lists 36 layers, 8 key/value heads and a head_dim of 128. At f16, every token in the cache stores a key and a value for each layer and each KV head: 2 x 36 x 8 x 128 x 2 bytes = 147,456 bytes per token.

An 8,192-token window costs 147,456 x 8,192 = 1,207,959,552 bytes, about 1.21 GB. A 32,768-token window, the native length on Qwen's model card, costs 4.83 GB. Add each to the file.

QuantQwen3-8B fileFile + 8K f16 cacheFile + 32K f16 cache
Q4_K_M 5.03 GB 6.24 GB 9.86 GB
Q5_0 5.72 GB 6.93 GB 10.55 GB
Q5_K_M 5.85 GB 7.06 GB 10.68 GB
Q6_K 6.73 GB 7.94 GB 11.56 GB
Q8_0 8.71 GB 9.92 GB 13.54 GB
FP16 (Ollama qwen3:8b-fp16) 16 GB download 17.21 GB 20.83 GB

On an 8 GB RTX 4060, Q4_K_M with an 8K window (6.24 GB) fits and Q8_0 (9.92 GB) does not. A 12 GB card holds Q8_0 at 8K but not at 32K, where the total reaches 13.54 GB. Quantizing the cache is the way out. Ollama's FAQ puts a q8_0 cache at about half the memory of f16, which cuts the 32K cache to roughly 2.42 GB and the Q8_0 total to about 11.13 GB. In Ollama the setting is OLLAMA_KV_CACHE_TYPE=q8_0, and it only applies with Flash Attention enabled. The same FAQ warns that models with a high GQA count, Qwen2 for example, may lose more precision from cache quantization.

Totals leave out compute buffers and anything else on the GPU, so treat them as a floor. Divide each file by 8.2B parameters and the bits per weight come out at about 4.91 for Q4_K_M, 5.71 for Q5_K_M, 6.57 for Q6_K and 8.50 for Q8_0, close to llama.cpp's Llama 3.1 8B figures. File sizes are from the Qwen/Qwen3-8B-GGUF listing, checked on 22 November 2026.

Picking a quant for your card

Start from your memory and the context you need, then take the highest quant whose file plus cache still fits. For an 8B model with a window of 8K or less, the Qwen3-8B table points to Q8_0 on a 12 GB card and Q4_K_M or Q5_K_M on 8 GB. Code and long documents push the window up. Each doubling of the window doubles the cache, and the file stays the same size.

The table below runs the site formula backwards. Each cell is the largest whole-billion dense model whose estimate still fits, from floor((VRAM minus 2) / (bytes per param x 1.2)), with one example size next to it.

GPU VRAMQ4_K_M fitsQ8_0 fitsF16 fitsNotes
4 GB Up to 3B; 3B Q4 is 3.8 GB Up to 1B; 1B Q8 is 3.2 GB Under 1B only Small models only; a 3B at Q4 is the practical ceiling
8 GB ~10B ceiling; 8B Q4 is 6.8 GB (Ollama qwen3:8b is a 5.2 GB download) Up to 5B; 7B Q8 is 10.4 GB and does not fit Up to 2B; 7B is 18.8 GB and does not fit RTX 4060 8 GB
12 GB ~16B ceiling; 14B Q4 is 10.4 GB Up to 8B; 8B Q8 is 11.6 GB Up to 4B; 7B is 18.8 GB and does not fit RTX 4070 12 GB, Arc B580
24 GB ~36B ceiling; 27B Q4 is 18.2 GB Up to 18B; 14B Q8 is 18.8 GB Up to 9B; 8B is 21.2 GB RTX 3090, RTX 4090
48 GB ~76B ceiling; 70B Q4 is 44 GB Up to 38B; 32B Q8 is 40.4 GB Up to 19B; 14B is 35.6 GB 48 GB GPU or two 24 GB cards; a 48 GB Mac is tight for 70B Q4 after the 4 GB macOS reserve

Short chats on 8 GB

Q4_K_M

Qwen3-8B Q4_K_M is 5.03 GB and reaches 6.24 GB with an 8K f16 cache, under an 8 GB card.

Spare memory after the cache

Q8_0

Qwen3-8B Q8_0 is 8.71 GB, the largest file in the official repo, and 9.92 GB with an 8K cache on a 12 GB card.

Making your own quants

BF16 or F16

Keep a high-precision GGUF as the source. The llama.cpp quantize README starts from F32 or BF16 input.

What a GGUF file holds

GGUF is the file format for running models with GGML and the executors built on it, llama.cpp first among them. The spec calls it the successor to GGML, GGMF and GGJT. Its main change from GGJT is a key-value structure for metadata, so a file can name its architecture, its quantization version and the type of most of its tensors. Hugging Face lists llama.cpp, LM Studio, GPT4All and Ollama as tools that use it.

Single file

The spec lists single-file deployment as a design goal: a model needs no external files, and all information needed to load it is in the model file. Keys such as general.architecture and general.file_type sit next to the tensors.

Backends

The llama.cpp build guide has sections for CPU, Metal, CUDA, HIP for AMD GPUs with ROCm, Vulkan and SYCL for Intel GPUs. On macOS, Metal is enabled by default.

Fast loading

The spec lists mmap compatibility as a design goal, so models can be loaded with mmap for fast loading and saving.

Versioned format

The header carries a version number. The current spec is version 3, which added big-endian support, and new metadata can be added without breaking older files.

The spec's naming pattern joins BaseName, SizeLabel, FineTune, Version, Encoding, Type and Shard with hyphens, and every file should carry at least BaseName, SizeLabel and Version. Its examples include Hermes-2-Pro-Llama-3-8B-F16.gguf and Grok-100B-v1.0-Q4_0-00003-of-00009.gguf, shard 3 of 9. Official repos do not always follow it. Qwen names its file Qwen3-8B-Q4_K_M.gguf, with no version. On Hugging Face, a GGUF viewer on the model and files pages shows each tensor's name, shape and precision.

Choosing a quant in Ollama

Ollama does not choose a quant to suit your card. Each tag points to one fixed build, and the tags page shows which. On ollama.com/library/llama3.1/tags, llama3.1:8b has the same hash as llama3.1:8b-instruct-q4_K_M. To get another quant, ask for its full tag.

Default tag, the Q4_K_M build (4.9 GB)

ollama run llama3.1:8b

Legacy 4-bit Q4_0 build (4.7 GB)

ollama run llama3.1:8b-instruct-q4_0

8-bit Q8_0 build (8.5 GB)

ollama run llama3.1:8b-instruct-q8_0

List the models already downloaded

ollama ls

Show loaded models and how they split between CPU and GPU

ollama ps

The same tags page lists every Llama 3.1 8B quant from q2_K at 3.2 GB to fp16 at 16 GB. Ollama's FAQ explains the Processor column of ollama ps, which shows values such as 100% GPU or a split like 48%/52% CPU/GPU.

Running and making quants with llama.cpp

llama.cpp loads a GGUF file you download yourself and runs it with the llama-cli or llama-server binaries, which a source build places in build/bin. The commands below use the Qwen3-8B Q4_K_M file from the worked example.

Run with every layer on the GPU

./build/bin/llama-cli -m Qwen3-8B-Q4_K_M.gguf -ngl 99 -p "Hello"

Partial offload: 24 of the model's 36 layers on the GPU

./build/bin/llama-cli -m Qwen3-8B-Q4_K_M.gguf -ngl 24 -p "Hello"

OpenAI-compatible server with an 8K window and a q8_0 cache

./build/bin/llama-server -m Qwen3-8B-Q4_K_M.gguf -ngl 99 -c 8192 -ctk q8_0 -ctv q8_0 --port 8080

Quantize a BF16 GGUF to Q4_K_M

./build/bin/llama-quantize model-bf16.gguf model-Q4_K_M.gguf Q4_K_M

The -ngl flag sets the maximum number of layers kept in VRAM. It takes a number, auto or all, and the current CLI and server docs give auto as the default; the build guide's example uses 99 to offload every layer. Lower it when the model does not fit, and the remaining layers run on the CPU. Without -c, llama-server takes the context size from the model. Qwen3-8B's config.json sets max_position_embeddings to 40,960, and a window that long costs 6.04 GB of f16 cache, more than the Q4_K_M file itself. The server listens on port 9931 unless --port says otherwise.

Frequently asked questions

What is the best quantization for everyday LLM use?

Q4_K_M is the usual default, and Ollama uses it for tags such as llama3.1:8b and qwen3:8b. The llama.cpp quantize README measures it at 4.8944 bits per weight on Llama 3.1 8B: a 4.58 GiB file against 14.96 GiB at F16, about 31 percent of the size. The site formula puts the same model at 6.8 GB for Q4_K_M and 21.2 GB for F16, because it adds a 1.2 factor and 2 GB for a short context. How much quality a given model gives up at Q4_K_M varies, so if Q5_K_M or Q8_0 fits alongside your context, try it on your own prompts.

How much VRAM does a 7B model need at Q4?

A 7B model at Q4_K_M is 7 × 0.5 × 1.2 + 2 = 6.2 GB by the site formula. The raw weight at the nominal 0.5 bytes (7 × 0.5) is 3.5 GB and leaves out the 1.2 factor and the 2 GB reserve. An 8 GB GPU fits that 6.2 GB estimate. For a real file, the qwen3:8b tag in Ollama, the Q4_K_M build of the 8.2B Qwen3-8B, is a 5.2 GB download.

Is Q8 noticeably better than Q4?

Q8_0 is the bigger file by a wide margin. In the official Qwen3-8B GGUF repo it is 8.71 GB against 5.03 GB for Q4_K_M, 1.73 times the size. llama.cpp measures the quality loss of a quant as perplexity or KL divergence against the original, and its quantize README gives no single loss figure that holds for every model. If the Q8_0 file plus your KV cache fits, run both on the same prompts. When the answers look the same for your work, Q4_K_M frees 3.68 GB for context.

What is a GGUF file?

GGUF is the binary file format that GGML and llama.cpp use for model weights. The spec calls it the successor to the GGML, GGMF and GGJT formats and says one file holds all the information needed to load the model, with metadata stored as key-value pairs next to the tensors. It is built to load through mmap, and the current spec is version 3. Ollama, LM Studio and llama.cpp all run GGUF files, and Hugging Face lets you filter models by the GGUF library tag.

Can I run a 70B model on a single GPU?

A 70B model at Q4_K_M is 70 × 0.6 + 2 = 44 GB by the site formula, and the llama.cpp quantize README lists the Llama 3.1 70B Q4_K_M file at 43.1 GB before any cache. That fits a 48 GB accelerator with little room for context. A 48 GB Mac has about 44 GB left after the 4 GB macOS reserve, so it is tight; 64 GB is the safer Mac size. It does not fit one 24 GB or 32 GB consumer GPU. Two 24 GB cards with a split can hold it, and so can an 80 GB datacenter GPU.

Estimate VRAM for any model and context length, or compare GPUs by memory size.

Sources & methodology

Quant definitions, file sizes, flags and format details on this page come from the primary sources below, checked on 22 November 2026. The full sitewide methodology lives on the methodology page. Estimates marked as the site formula use that page's VRAM formula.

Every number in this quantization guide should match the linked source. Contact us if one does not, and we will fix it.