Glossary

Quantization: Smaller Models, Less Memory

Checked 2026-10-31

Loading poll...

Quantization stores a model's weights, the numbers that make up its knowledge, at lower precision. Instead of 16 bits per weight, you might use 8 or 4. The file shrinks, memory needs drop and the model can run on a smaller GPU or a laptop, usually with a small loss in quality. It is the main reason large open models run on ordinary hardware. Checked 31 October 2026.

At a glance

Item

Detail

What changes

The precision of stored weights, for example 16-bit to 4-bit

Main gain

Less memory, smaller downloads, often faster inference

Main cost

Some accuracy loss, which varies by method and model

Common formats

GGUF (llama.cpp, Ollama), AWQ, GPTQ, bitsandbytes, FP8, NVFP4

How loss is measured

Perplexity and KL divergence (per llama.cpp's docs)

Related ideas

Quantization-aware training, importance matrices

Where it matters

Running models locally and self-hosting

What it is

The Hugging Face documentation puts it this way: quantization lowers the memory requirements of loading and using a model by storing the weights in lower precision while trying to preserve as much accuracy as possible. Weights are typically stored in full-precision floating point (fp32), and half-precision formats (fp16 or bf16) are increasingly popular given the size of today's models. Some methods go much lower: the docs' compatibility table lists methods that work at 8, 4, 3, 2 and even 1 bit.

A picture helps. Imagine every weight is a number written to many decimal places. Quantizing rounds each one to the nearest of a smaller set of values, such as 16 levels for 4 bits. Rounding throws away detail, so the model's answers can drift, and clever methods choose the rounding to keep the important weights accurate.

The arithmetic

Memory for weights is roughly the parameter count times the bytes per weight.

Worked example (our arithmetic, weights only). A model with 27 billion parameters:

Precision

Bytes per weight

Approximate weight memory

16-bit (bf16)

2

54 GB

8-bit

1

27 GB

4-bit

0.5

13.5 GB

Real files run a little larger, because some layers stay at higher precision and there is metadata. Our model pages show the real numbers from Hugging Face. Qwen3.8-27B is listed at about 56 GB in its 16-bit repository, close to the 54 GB estimate. Gemma 4 31B shows about 63 GB in its standard repository, and a 4-bit quantisation-aware-trained build from Google at about 23 GB. Mistral Large 4 weights come to about 1,061 GB, with an NVFP4 build of about 610 GB. See Qwen models, Gemma models and Mistral models.

The estimate leaves out two other memory users: the key-value cache that grows with the context window, and the runtime's own overhead. A model that fits at a short context can run out of memory at a long one.

Formats you will meet

Format or method

Typical bits

Where used

Notes from the docs

GGUF (llama.cpp)

1 to 8

llama.cpp, Ollama and others

Runs on CPU, CUDA, Apple Metal and Intel GPU; created from a high-precision GGUF with llama-quantize

AWQ

4

GPU serving

Listed with CPU, CUDA and ROCm support

GPTQ (GPT-QModel)

2, 3, 4, 8

GPU serving

Needs calibration for accuracy at low bit counts

bitsandbytes

4, 8

Transformers, on-the-fly

Quantizes while loading, no pre-built file needed

FP8

8

Newer GPUs

Listed as FBGEMM_FP8, 8-bit

NVFP4

4

NVIDIA hardware

Used in some large releases such as Mistral Large 4's smaller build

The Hugging Face overview adds that some methods need calibration for greater accuracy and extreme compression of 1 to 2 bits, while others work out of the box with on-the-fly quantization. Its quantization picker tool helps choose by model, hardware and goal.

GGUF and the Q-names

If you use Ollama or llama.cpp you will see names such as Q80 or Q4K_M. They describe the scheme and rough bit width. The llama.cpp quantize README shows the two-step process:

python convert_hf_to_gguf.py --outfile gemma-4-E2B-it-bf16.gguf --outtype bf16 --remote google/gemma-4-E2B-it
./build/bin/llama-quantize gemma-4-E2B-it-bf16.gguf gemma-4-E2B-it-Q4_K_M.gguf Q4_K_M

First convert the original model to a high-quality GGUF, then quantize that file. The README warns that quantization may introduce accuracy loss, usually measured as perplexity or KL divergence, and that a suitable importance matrix (--imatrix) can reduce it. It also warns that the --allow-requantize option can severely reduce quality compared with quantizing from 16-bit or 32-bit weights. Practical advice: download a published quant from a source you trust, or make your own from the original weights, and never squeeze a quantized file again.

Quantization-aware training

Most quantization happens after training. The alternative is to train with the low precision in mind. Google's Gemma 4 repositories include a 4-bit quantisation-aware-trained build, about 23 GB against the 63 GB standard one for the 31B model. The idea is that the model learns to work around the rounding, so a quantized version can lose less quality. Check the card of any model you plan to run; if the maker supplies a quantized build, start there. See Gemma models.

What you lose and how to check

Loss is usually small at 8 bits, modest at 4 bits and larger below that, though it varies by model and method. It shows up first in hard reasoning, long outputs, tool-call formatting and rarer languages, not in everyday chat. The only reliable check is your own task:

  1. Run the full-precision model or a vendor API on 20 of your real prompts, if you can.
  2. Run the quantized build on the same prompts.
  3. Compare blind, and note any broken tool calls or formatting errors.
  4. Try the next level up if the first quant fails a task.

For coding agents, watch tool-call syntax: small quantized models more often emit malformed edits. That matters for local coding agents with Ollama. Benchmarks usually come from full-precision runs through a vendor API, so a published score may not apply to your 4-bit build. See how to read AI benchmarks.

Choosing a level

If you have

Try

Why

Plenty of GPU memory

8-bit or the vendor's FP8

Little quality loss, easy

A single consumer GPU

4-bit of a model that fits

The best size and quality balance for many people

A laptop or phone

A small model at 4-bit, or an on-device build

Memory is the limit

A server for many users

The runtime's supported formats, for example in vLLM

Throughput depends on kernel support

A need for the highest quality

Full precision or 8-bit, via an API if needed

Avoid avoidable loss

Tooling notes: Ollama and llama.cpp use GGUF. For multi-user serving, see Ollama vs vLLM. For sizing a GPU, see GPU requirements for LLMs.

Quantization is not distillation or pruning

Technique

What it does

Quantization

Same model, lower-precision numbers

Distillation

Trains a smaller model to imitate a larger one

Pruning

Removes weights or layers

Fine-tuning

Changes weights for a new task

Quantization keeps the model's shape and changes how its numbers are stored. The llama.cpp tool does have a layer-pruning option, which is a separate operation.

Our take

Quantization is why a 27-billion-parameter model fits on a normal machine. It is also a quality trade that you should measure instead of assume. Prefer maker-supplied quants, avoid requantizing and test your own prompts at the level you plan to run. Figures here come from Hugging Face and llama.cpp documentation and from our model pages, checked on the date above. We have not benchmarked any quantized build ourselves.

Questions

What is quantization in AI?

Storing a model's numbers (weights) at lower precision, such as 4 or 8 bits instead of 16, so the model needs less memory and can run on smaller hardware, usually with a small loss in accuracy.

Does quantization make a model worse?

Usually a little. llama.cpp's docs say it may introduce accuracy loss, measured by perplexity or KL divergence, and that a suitable importance matrix can minimise it.

What is GGUF?

The file format used by llama.cpp and tools built on it, such as Ollama. A GGUF file can hold a model at a chosen quantization level, such as Q4_K_M.

Should I quantize an already quantized model?

Avoid it. llama.cpp's quantize tool warns that requantizing can severely reduce quality compared with quantizing from 16-bit or 32-bit weights.

Loading poll...

Sources

  1. huggingface.co/docs/transformers/main/en/quantization/overview
  2. github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md
  3. huggingface.co/google/gemma-4-31B-it
  4. huggingface.co/mistralai/Mistral-Large-4-1T-A52B
  5. huggingface.co/Qwen/Qwen3.8-27B

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com