Quantization

What quantization actually is — and what it costs you

A model's weights are just numbers. They are trained at 16-bit precision, which is more accuracy than inference actually needs. Quantization stores those same numbers in fewer bits — 8, 6, 5, 4, sometimes fewer — and accepts a small amount of rounding error in exchange for a much smaller file and much less memory traffic.

That is the whole trick. It is lossy compression with a calibration step, not a magic shrink. The art is in choosing the rounding so the error lands where it does the least damage.

Why it exists

Two reasons, and the second one is the one people miss.

Capacity. A 70B model at 16-bit needs about 140 GB for its weights alone. At 4-bit, a practical quantized version may use around 42 GB, depending on the format. That still exceeds the 24 GB of VRAM on a single RTX 3090—you need more GPU memory or must offload part of the model to system RAM. Quantization can make a 27B model practical on a 24 GB card, but the KV cache and runtime buffers also need room. Use the VRAM Fit Calculator to check your model, quantization, and context length.

Bandwidth. Token generation is memory-bound: every token requires reading the model's weights, so tokens per second is roughly bandwidth divided by bytes read per token. Cut the bits per weight in half and you roughly double the speed, minus overhead. This is why Q4 generates noticeably faster than Q8 on identical hardware — it is not a compute trick, it is a traffic trick.

Prefill — the part where the model reads your prompt — is compute-bound and benefits much less. A quantized model feels faster at talking and only slightly faster at reading.

The formats you will actually meet

FormatWhere it runsNotes
GGUFllama.cpp, Ollama, LM Studio, KoboldCppThe default for local use. CPU+GPU split, K-quant variants, most portable
GPTQvLLM, ExLlama, text-generation-webuiGPU-only, 4 or 8 bit, needs calibration data
AWQvLLM, AutoAWQActivation-aware weighting; strong quality at 4-bit
EXL2ExLlamaV2Variable bits per layer; fast on NVIDIA
NF4 / bitsandbytesTransformers, QLoRABetter known for fine-tuning than for inference
MLXApple SiliconApple's own format and runtime
FP8 / MXFP4 / NVFP4vLLM, TensorRT-LLM, newer GPUsHardware-native low precision; better quality than int4 at similar size

Who actually quantizes a model

Three groups do it, and which one made your file matters.

The lab that trained it. Increasingly, model authors ship their own quants. Qwen publishes GGUF, AWQ and GPTQ builds alongside the full-precision release; DeepSeek and Mistral do the same for their flagship models. These are the safest files to use, because the people who trained the model chose the calibration data.

Dedicated community quantizers. A small number of people quantize almost everything, within days of release — bartowski, mradermacher, unsloth, the lmstudio-community account, and the ggml-org uploads. They publish consistent naming, several bit depths, and usually an imatrix variant. Their reputation is the quality signal.

You, with the tooling. Every major runtime ships a converter:

  • llama-quantize for GGUF, with --imatrix for importance matrices
  • AutoGPTQ or GPTQModel for GPTQ
  • AutoAWQ for AWQ
  • ExLlamaV2's converter for EXL2
  • mlx_lm.convert for Apple Silicon
  • bitsandbytes for on-the-fly 8-bit and 4-bit in Transformers

Search Hugging Face for "GGUF" plus the model name and you will usually find several uploads of the same weights. Compare file sizes, read the model card, and prefer uploaders who state their method and calibration data. A 4-bit quant built with generic or random calibration can be meaningfully worse than one built with an imatrix from real text — same bit depth, worse model.

The cost of doing it yourself is mostly patience, not hardware. GGUF quantization needs no GPU at all: llama-quantize runs on the CPU, taking roughly five minutes for an 8B model and one to two hours for a 70B. The real constraints are memory and disk — you need enough RAM to hold the full-precision source (about 140 GB for a 70B in FP16) and roughly double that free, because both files exist at once. The step that actually eats a day is the imatrix: generating one means running the model across hundreds of chunks of calibration text, which on a 70B is an overnight job. GPTQ and AWQ are a different proposition — they want a 16–24 GB GPU and a calibration dataset, and run from half an hour to several hours depending on model size. Nothing here requires special hardware; it mostly rewards free disk space, patience, and a fast upload connection, which is why most community quantizers work on rented GPUs and publish the results in bulk.

The levels, and what they cost

Sizes below are approximate and assume a standard K-quant, weights only — you still need room for the KV cache and runtime overhead.

PrecisionBits/weight8B14B32B70B
FP16 / BF161616 GB28 GB64 GB140 GB
Q8_08.58.5 GB15 GB34 GB74 GB
Q6_K6.66.6 GB12 GB26 GB58 GB
Q5_K_M5.75.7 GB10 GB23 GB50 GB
Q4_K_M4.84.9 GB8.4 GB19 GB42 GB
Q3_K_M3.94.0 GB6.8 GB16 GB34 GB
Q2_K2.93.0 GB5.1 GB12 GB25 GB

Q8 is effectively free. Benchmarks and real conversations are indistinguishable from 16-bit. You use it when you have spare memory and no reason to think about it.

Q6 and Q5 are close to free. A small, measurable difference on hard reasoning and code, invisible in ordinary use.

Q4_K_M is the default for a reason. It is the point where file size drops sharply while quality drops slightly. For most models and most tasks this is the correct choice.

Q3 is a real trade. Coherence and instruction-following start to wobble, and on small models it shows up immediately.

Q2 is a last resort. It exists so a model can load at all, not so it can be good. Expect repetition, broken formatting, and confident nonsense.

Why quantize — and why not

AdvantagesDisadvantages
Fits models that otherwise would not load at allCosts accuracy, unevenly across tasks
Two to four times faster token generationSmall models degrade far more than large ones
Runs on cheaper hardware you already ownBad calibration is worse than the bit depth suggests
Less power, less heat, quieter machinesSome formats lock you to one engine
A bigger model at Q4 usually beats a smaller one at FP16Quantized KV cache adds its own small error
Smaller downloads and far less disk useBenchmark scores do not transfer to your task
Makes CPU-only inference viableFull fine-tuning is no longer practical

The case for quantizing is overwhelming. If you are running on a consumer GPU, a laptop, or a Mac, quantization is what makes a 27B or 70B model exist for you at all. There is no version of local AI at home without it.

The case against is narrower but real. Four situations where you should not:

You have the memory. If a model fits at Q8 or FP16, run it there — especially when evaluating, benchmarking, or doing research where you would rather not have the quantizer in the loop.

You are fine-tuning. Train in 16-bit. QLoRA quantizes the frozen base model but trains adapters at higher precision; starting from already-quantized weights for further training is a bad idea.

You are comparing models. Compare at the same bit depth, always. A Q4 of one model against a Q8 of another tells you nothing about either model.

The output is high-stakes. Quantization errors are rare, unpredictable, and usually surface as a confident wrong detail rather than obvious gibberish — exactly the failure mode you do not want in legal, medical, or financial work.

For everything else — chat, drafting, coding assistance, local agents — Q4 is not a compromise you will notice. It is the default for a reason.

The interaction nobody warns you about: model size

Quantization hurts small models more than large ones. A 70B at Q4 has enormous redundancy to lose; a 4B at Q4 does not. That produces a rule that surprises people:

Prefer the larger model at a lower quant — down to about Q3. Two examples at the same memory budget:

BudgetOption AOption BUsually better
~9 GB14B at Q48B at Q814B at Q4
~20 GB32B at Q414B at Q832B at Q4
~42 GB70B at Q432B at Q870B at Q4
~25 GB70B at Q232B at Q432B at Q4

The last row is the exception that matters: below roughly Q3, the damage compounds faster than the parameter advantage helps. A well-quantized 32B beats a mangled 70B in almost every comparison you will run yourself.

The memory nobody budgets for: the KV cache

Your context window lives in memory too, and it is not quantized by default. At 16-bit, an 8B model with a 32K context can spend several gigabytes on KV cache alone — often more than the difference between Q4 and Q8.

The cache scales with layers × attention heads × context length × precision. Practical consequence: a model that fits comfortably at 8K context will run out of memory at 32K, and people blame the model file.

Quantizing the KV cache to 8-bit typically halves it with no measurable quality cost; 4-bit cuts it to a quarter with a small cost. In llama.cpp this is --cache-type-k q8_0 --cache-type-v q8_0.

If you are short on memory because of context, quantize the cache first — not the model.

How to choose

Start at Q4_K_M. It fits, it is fast, and it is good enough that you will not notice what you gave up.

Move to Q5_K_M or Q6_K if you have headroom, particularly for code and math, where small degradations show up first.

Use Q8 when memory is not the constraint — small models, big GPUs, or a task you are evaluating rather than running daily.

Do not go below Q4 on anything under about 14B. The model loses more than it saves.

Prefer imatrix quants when a model offers them. They calibrate against real usage and hold up better at 4-bit than generic ones.

Check the vendor's recommended quant. Some models are published with a specific level that the authors benchmarked and recommend; that is better information than a general rule.

Four myths worth killing

'Quantization is lossless.' No. Q8 is close enough that you cannot tell; that is not the same thing.

'Q4 is always fine.' It is the right default, but a 3B model at Q4 is noticeably dumber than the same model at Q8, and a coding task will show it before a chat will.

'Lower bits are always faster.' Only while you are bandwidth-bound. Very aggressive quants add dequantization overhead on some backends, and on CPU-only systems the gains are smaller than the numbers suggest.

'GGUF, GPTQ and AWQ differ in quality.' Mostly they differ in hardware support and tooling. Quality comes from the bit depth and the calibration method, not the three-letter acronym.

The rule

Quantization is the single highest-leverage decision in local AI, because it decides which models exist for your hardware at all. Get it roughly right — Q4_K_M by default, Q5 or Q6 when you have room, never below Q3 on small models — and you will spend your time using models instead of tuning them.