# What is quantization?

> Quantization shrinks a model by storing each number with fewer bits. 4-bit is the usual default and most people never notice the difference.

## Fewer bits per number

A model is billions of numbers, and each one is stored with some number of bits. Models are trained at 16 bits per number. Quantization rounds each number to fewer bits, usually 4 to 8, so the file gets smaller.

A 27B model drops from about 54 GB at 16-bit to about 16 GB at 4-bit. You lose a little accuracy. Most people never notice.

**Rule of thumb.** 
At 4-bit, budget about 0.6 GB. At 8-bit, budget about 1.1 GB. Then add room for the context.

Smaller is also faster. Writing each token means reading the whole model out of memory, so a file half the size writes about twice as fast on the same machine. [What makes a model fast?](https://localagi.co/what-makes-it-fast) explains why.

## Reading the labels

Every download page lists the same model several times, once per quantization. The label tells you the bits and the method.

| Label | Where you see it | What it means |
| --- | --- | --- |
| `Q4_K_M` | GGUF files for llama.cpp, Ollama, LM Studio | About 4 bits per number. K is the method, M is the medium mix |
| `Q8_0` | GGUF files | 8 bits per number, the simplest scheme |
| `4bit`, `8bit` | MLX models on Hugging Face | Bits per number for Apple's MLX format |
| `MXFP4`, `NVFP4` | Models that ship pre-quantized, such as gpt-oss | 4-bit floating point formats. The model was built for them |
| `F16`, `BF16` | The original release | Full 16-bit. Usually too big to run at home |

The letters after the number vary by uploader. `_S`, `_M` and `_L` mean small, medium and large mixes. A larger mix keeps a few sensitive layers at higher precision and costs a little more memory.

## What you lose

Quality drops slowly from 8-bit to 4-bit, then quickly below that. Here is one 27B model at each level.

| Label | Bits per weight | 27B file | Quality |
| --- | --- | --- | --- |
| F16 / BF16 | about 16 | about 54 GB | The original. Reference quality. |
| Q8_0 | about 8.5 | about 29 GB | Indistinguishable from the original in practice. |
| Q6_K | about 6.6 | about 22 GB | Close to the original. |
| Q5_K_M | about 5.7 | about 19 GB | A small, rarely visible loss. |
| Q4_K_M | about 4.8 | about 16 GB | The common default. Most people never notice. |
| Q3_K_M | about 3.9 | about 13 GB | Noticeable on small models. Often fine on big ones. |
| Q2_K | about 3 | about 10 GB | Clearly degraded. Only to squeeze a much bigger model in. |

Q8 and Q6 are close to the original. Q4 is the common default, and we think it is the right starting point for almost everyone. Below Q4 the model starts to slip, more for small models than for large ones.

**The catch.** 
Coding and long chains of reasoning feel the loss first. A Q4 model that chats well can still make more small mistakes in code than its Q8 version. If you have the memory, test both on your own work.

## Bigger model, fewer bits

If two options fit in the same memory, the bigger model at lower precision usually wins. A mid-class model at 4-bit beats a small model at 8-bit of the same file size on most tasks.

The rule flips below about 3 bits. At that point the damage outweighs the extra size, so drop a class instead. [Which quantization should I download?](https://localagi.co/choosing-a-quantization) turns this into a decision ladder, and [Will it fit?](https://localagi.co/will-it-fit) does the sums for your machine.

## Vendor-tuned quantizations

Standard quantization rounds every layer the same way. A tuned quantization measures which parts of a specific model are sensitive, then spends more bits there and fewer elsewhere. The aim is better quality at the same size.

Several uploaders and runtime makers publish these, such as Unsloth's dynamic quants and Base Compute's [BaseQuant](https://www.basecompute.co/models). Treat their quality claims as vendor-reported until someone independent measures them.

Base Compute, for one, reports that BaseQuant stays closer to the original model than Unsloth's quants of the same size, measured by KL divergence. The files are in its [BaseQuant V1 collection](https://huggingface.co/collections/basecompute/basequant-v1) on Hugging Face, and [Which quantization should I download?](https://localagi.co/choosing-a-quantization) covers the tiers.

**Try it.** 
Open any model in LM Studio's search and expand its download options. Each line is the same model at a different quantization, with its file size. Pick the largest Q4 that leaves you a few GB free.

## Go deeper

### How the rounding works

Weights are not rounded one at a time. They are grouped into blocks of a few dozen, and each block stores a shared scale plus a small integer for every weight.

To use a weight, the engine multiplies its integer by the block's scale. The scale is where most of the accuracy is kept.

K-quants such as `Q4_K` nest blocks inside super-blocks, so the scales themselves are stored compactly. That is why a "4-bit" file averages closer to 5 bits per weight. The extra bits are the scales.

### Mixes and importance

The `_M` in `Q4_K_M` is a recipe. A few tensors that hurt most when squeezed, such as parts of the attention layers, stay at 5 or 6 bits while the rest go to 4. Some uploaders also use an importance matrix: they run sample text through the model, see which weights matter most, and round those more carefully.

Two files with the same label from different uploaders can differ in quality for this reason. [Where do I download models?](https://localagi.co/where-models-come-from) covers how to pick an uploader.

### The KV cache is separate

Quantizing the model does not shrink the [context](https://localagi.co/context-window). The context lives in the KV cache, which most runtimes keep at 16-bit by default.

Some let you quantize it to 8-bit to fit a longer context. That is a separate setting with its own small quality cost, covered in [How do I make it faster?](https://localagi.co/tuning-for-speed).
