Lesson 30.6 · 6 of 8 · 6 min read · Reviewed 24 Nov 2026
Quantization formats: GGUF, AWQ and FP8
By the end, you can
- Tell GGUF, AWQ and FP8 apart by what they are and where they run.
- Pick a quantization format for a given machine and runtime.
Lesson 30.2 explained the idea: store weights with fewer bits. When you go to download a model, you meet the idea packaged in different ways. Three names come up again and again: GGUF, AWQ and FP8. They are not three settings of one dial. One is a file format, one is a method, and one is a number type.
GGUF: a file format for local runtimes
GGUF is the file format used by llama.cpp and the many desktop tools built on it. One .gguf file holds the weights, the tokenizerTokenizer: The component that splits text into tokens and maps each token to an id the model can process. and metadata such as the chat template, so a runner can load it with no extra files.
Inside, weights are quantizedQuantization: Storing model weights with fewer bits, such as 4 or 8 instead of 16, to cut memory and speed up inference. in small blocks. Each block of weights shares a scale factor, so the true size per weight is a little above the headline number. File names carry the level:
| Name in the file | Rough bits per weight | Typical use |
|---|---|---|
Q8_0 |
about 8.5 | Near reference quality, if memory allows |
Q5_K_M |
about 5.5 | A careful middle ground |
Q4_K_M |
about 4.8 | The common default for laptops |
Q3_K_M and below |
under 4 | Only when nothing larger fits |
The K levels mix precisions: more sensitive parts of the model keep more bits. GGUF runs on CPUs, Apple silicon and consumer GPUs, which is why it dominates local use.
AWQ: a smarter way to pick what to protect
AWQ (activation-aware weight quantization) is a method for making 4-bit weights. Its insight is that a small share of weights matters far more than the rest, and you can find them by looking at which input channels carry large activations. AWQ scales those channels before rounding, so the important weights lose less precision. Only weights are quantized; activations stay at 16-bit.
AWQ checkpoints target GPU serving stacks such as vLLM. A similar GPU-oriented method you will also see is GPTQ.
FP8: 8-bit floating point
FP8 is a number type, not a method. Instead of 8-bit integers with a scale, each value is a tiny float with its own exponent, so it copes with a wide range of sizes. Two variants are common: E4M3 (more precision) and E5M2 (more range).
The win is hardware. Recent data-centre GPUs can do maths directly in FP8, so both weights and activations can stay small and fast. On hardware without native FP8, you get the memory saving but little speed-up.
A worked choice
A team has two places to run an 8B model:
- A developer laptop with 16 GB unified memory. The runtime is a llama.cpp-based desktop app. Choice:
Q4_K_MGGUF, about 5 GB, leaving room for the KV cacheKV cache: Stored attention keys and values for tokens already processed, so they are not recomputed for each new token.. - A shared server with one recent data-centre GPU, running vLLM. Choice: FP8 if the GPU supports it natively, since quality is very close to 16-bit at half the memory. If memory is tighter, an AWQ 4-bit checkpoint.
Same model, two formats, because the runtime and hardware differ.
Common mistakes
- Choosing the format first. Pick the runtime, then a format it supports well.
- Comparing headline bits only. Block scales and mixed levels change the real size. Check the file size.
- Skipping the evalEval: A repeatable test that measures how well an AI system performs on a set of cases with defined success criteria.. Two 4-bit files made by different methods can differ in quality. Run your eval on the exact file you will ship.
Key points
- GGUF is a single-file format for llama.cpp and tools built on it, with many quantization levels such as Q4_K_M and Q8_0.
- AWQ is a 4-bit, weight-only method for GPUs that protects the weights that matter most to activations.
- FP8 stores numbers as 8-bit floats and is fast on recent data-centre GPUs with native FP8 support.
- The format follows the runtime and hardware: choose the runtime first, then a format it supports well.
Work out the real size of quantized files
See why block scales make a 4-bit file bigger than 4 bits per weight.
You will have: A table of effective bits per weight and file sizes for four formats, plus the overhead of a Q4_0-like file.
Steps
- Fill in effective_bits(): headline bits plus the block's scale bits spread over its weights.
- Fill in file_gb(): parameters times bits divided by 8.
- Run it and compare the Q4_0-like and block-128 rows.
- Print how much larger the Q4_0-like format is than a pure 4 bits.
Done when
- Q8_0-like shows 8.50 bits per weight.
- Q4_0-like shows 4.50 bits per weight and about 4.5 GB for 8B.
- The overhead line prints 12.5%.
Open in the Playground No API key needed.
Starter code (Python)
# Work out the real bits per weight of block-quantized formats, then the file size of an 8B model.
# Each block of weights shares one scale (and sometimes a minimum), which adds a little to every weight.
FORMATS = {
# name: (bits per weight, weights per block, extra bits per block for scales)
"Q8_0-like": (8, 32, 16),
"Q4_0-like": (4, 32, 16),
"4-bit, block 128 (GPU style)": (4, 128, 32),
"FP8 per-tensor scale": (8, 10**9, 32),
}
def effective_bits(bits, block, extra):
# TODO: spread the block's extra scale bits over its weights and add them to the headline bits
return bits
def file_gb(params_billion, eff_bits):
# TODO: parameters x bits / 8 gives bytes (in billions, so GB)
return 0.0
for name, (bits, block, extra) in FORMATS.items():
eff = effective_bits(bits, block, extra)
print(f"{name:<30} {eff:5.2f} bits per weight, 8B model about {file_gb(8, eff):4.1f} GB")
# TODO: print how much larger (in %) the Q4_0-like format is than a pure 4.00 bits per weight.
Show a solution
# Work out the real bits per weight of block-quantized formats, then the file size of an 8B model.
# Each block of weights shares one scale (and sometimes a minimum), which adds a little to every weight.
FORMATS = {
# name: (bits per weight, weights per block, extra bits per block for scales)
"Q8_0-like": (8, 32, 16),
"Q4_0-like": (4, 32, 16),
"4-bit, block 128 (GPU style)": (4, 128, 32),
"FP8 per-tensor scale": (8, 10**9, 32),
}
def effective_bits(bits, block, extra):
return bits + extra / block
def file_gb(params_billion, eff_bits):
return params_billion * eff_bits / 8
for name, (bits, block, extra) in FORMATS.items():
eff = effective_bits(bits, block, extra)
print(f"{name:<30} {eff:5.2f} bits per weight, 8B model about {file_gb(8, eff):4.1f} GB")
eff_q4 = effective_bits(4, 32, 16)
print(f"Q4_0-like overhead vs 4.00 bits: {100 * (eff_q4 - 4) / 4:.1f}%")