New Tool Radar

AI Concepts

How to Read GGUF Quantization Levels from Q4_K_M to Q8_0

Read a GGUF file name as a recipe: the number is the bits per weight and the letters say how the sensitive tensors are kept.

Schematic illustration of read gguf quantization levels from q4_k_m to q8_0: step one read the number, step two read the letters, step three check the size.

Quantization shrinks an open language model by storing its weights in fewer bits per number, so a model that needs 16 GB at full precision can run in under 5 GB. GGUF is the single-file format of llama.cpp, Ollama and LM Studio, and the suffix on the file name is its quantization level. The number is roughly the bits per weight, the K marks the k-quant family, and the final letter says how many sensitive tensors get extra bits.

Prerequisites

  • A GGUF file name to read, such as a model downloaded from a model hub.
  • The llama.cpp quantization figures for bits per weight, open for reference.
  • A note of your memory budget in gigabytes.

Steps

Step 1: Read the number

The number after the Q is roughly the bits per weight: Q8 is about 8 bits, Q4 is about 4. Fewer bits means a smaller file and faster generation, because each token means reading every active weight from memory once.

Step 2: Read the letters

The K marks the k-quant family, which groups weights into super-blocks and quantizes the scales themselves. The final letter, S, M or L, says how many sensitive tensors get extra bits: Q4_K_M keeps half of the attention value and feed-forward down-projection tensors at 6-bit, and stores the rest at 4-bit.

Step 3: Check the size

Check the real bits per weight, which run higher than the name suggests because the per-block scales take space. For Llama 3.1 8B, llama.cpp measures Q4_K_M at 4.89 bits per weight and Q8_0 at 8.50.

Worked example: Llama 3.1 8B quantization levels

The table below uses llama.cpp’s published figures for Llama 3.1 8B: bits per weight and file size against the 16-bit original.

Level Bits per weight Size for an 8B model Share of the 16-bit size
F16 16.00 16.00 GB 100%
Q8_0 8.50 7.95 GiB 53%
Q6_K 6.56 6.14 GiB 41%
Q5_K_M 5.70 About 5.3 GiB 36%
Q4_K_M 4.89 4.58 GiB 31%
Q3_K_M 4.00 3.74 GiB 25%
Q2_K 3.16 2.96 GiB 20%

Q4_K_M is 4.58 GiB, 31 percent of the 16-bit size, and Q8_0 is 7.95 GiB, 53 percent, so the levels form a clear ladder from small to near-lossless.

Expected result. You can read any GGUF suffix, say its bits per weight, and estimate its file size from the level table. UNTESTED: this guide was not run against a live model or API. The worked example below is fictional practice material, and its result is the expected result, not a measured one.

Limits

  • The label is a recipe, not a guarantee of identical bytes; two files with the same label can differ slightly.
  • Bits per weight figures are measured on one model; another model gives slightly different numbers.
  • This guide does not cover choosing a level for your task; that is a separate decision.

Sources

See all