← All posts

We compressed Qwen3 from 16 bits to 2. Here is where it broke.

At 4-bit a model is under a third of its size and more than twice as fast, and its scores barely move. At 2-bit it solves only 50% to 60% of the coding problems it used to. Seven levels, two models.

Open-weight models are rarely run the way they were trained. The files most people download have names like Q4_K_M or Q8_0: they are quantized.

A model is a few billion numbers. Quantization stores each number more coarsely: instead of 16 bits each, it uses 8, or 4, or even 2. The file gets smaller and the model gets faster. The question is what you give up.

We took two models, made seven versions of each from 16 bits per number down to 2, and ran the same tests on every version. Below: the results in brief, then what quantization actually does and how to do it yourself, then the data for each test.

The short version:

  • Down to 5-bit, nothing we measured changed.
  • 4-bit is under a third of the size and more than twice as fast. Coding results did not move. Multiple-choice accuracy stayed within about a point.
  • 3-bit is where real losses start. Qwen3-8B went from 143 coding problems solved to 129.
  • 2-bit breaks the model. Coding problems solved fell from 140 to 70 on Qwen3-4B and from 143 to 86 on Qwen3-8B.
  • The same score does not mean the same answers. At 4-bit, 8% to 10% of answers were different from full precision, even though the score was nearly identical.
  • Heavy compression can also remove refusals. At 2-bit, Qwen3-8B refused 71 of 100 harmful requests, down from 91.

What quantization is

A model is a very large set of numbers called weights. Qwen3-4B has about 4 billion of them. As released, each weight takes 16 bits, which is 2 bytes. 4 billion times 2 bytes is the 8 GB file.

16 bits can represent 65,536 different values, so each weight can be stored very finely. Quantization gives that up: it fixes a small set of allowed values and replaces each weight with the nearest one. The file only has to record which one it was. With 16 allowed values that record takes 4 bits, which is what 4-bit means. With only 4 allowed values, 2 bits are enough.

It is the same idea as reducing the colours in a photo. Go from 65,536 colours to 16 and the photo is still recognisable in a much smaller file. Go to 4 and only an outline is left.

4-bit: 16 allowed valuesoriginalstored2-bit: 4 allowed valuesoriginalstored
The same 20 weights, rounded twice. In each panel the top row is where the weights were and the bottom row is where they are stored. At 4-bit each one moves a little. At 2-bit the 20 different weights end up as 4. This is an illustration, not real weights.

Here it is with numbers. Say all the weights lie between −0.75 and 0.75, and the allowed values are spread evenly across that range.

Original weight 4-bit: 16 values, 0.1 apart 2-bit: 4 values, 0.5 apart
0.31 0.35 0.25
−0.08 −0.05 −0.25
−0.43 −0.45 −0.25
0.52 0.55 0.75
0.02 0.05 0.25

At 4-bit no weight is off by more than 0.05. At 2-bit a weight can be off by 0.25, and −0.08 and −0.43, two weights that were far apart, have become the same number. Each bit you remove halves the number of allowed values and roughly doubles the gap between them.

Why does a model survive this at all? Every step of its computation adds up the results from a few thousand weights. If each weight is slightly off, some too high and some too low, most of the error cancels in the sum. Once the gaps are wide enough, it no longer cancels. Where that happens is what this post measures.

Fewer bits means a smaller file and less memory. On a GPU it also means faster output, because producing each token involves reading all the weights.

How to quantize a model

Quantizing does not involve any training. It only stores the same numbers in a different way. With llama.cpp it takes two steps, and this is how we made the files for this post.

First, convert the model's original weights to GGUF, the format llama.cpp uses, at unchanged precision:

python convert_hf_to_gguf.py ./Qwen3-4B --outtype f16 --outfile qwen3-4b-F16.gguf

Second, produce the level you want from that full-precision file. The last argument is the name of the level:

llama-quantize qwen3-4b-F16.gguf qwen3-4b-Q4_K_M.gguf Q4_K_M

The result runs as it is. -ngl 99 puts every layer on the GPU:

llama-server -m qwen3-4b-Q4_K_M.gguf -ngl 99

The second step does the rounding described above, with a few refinements over the worked example:

  • Blocks. The weights do not share one range across the whole model. They are cut into small blocks and each block gets its own range, so the 16 allowed values sit where that block's weights actually are.
  • An index and a scale. Each weight is stored as an index, and each block also stores its range. At run time the index and the range give back the approximate weight.
  • Different precision for different parts. The more sensitive parts of the model are kept at higher precision.

That is why the number in a level's name is nominal and the real average is higher. Measured from file size, Q4_K_M comes to about 5 bits per weight and Q2_K to a little over 3.

Most people never run these two steps. For popular models, files at every level have already been made and uploaded to Hugging Face. We made our own so that all seven levels came from the same weights and the same version of the tool.

The setup

  • Models. Qwen3-4B-Instruct-2507 and Qwen3-8B, with thinking turned off.
  • Levels. Full precision (F16), then Q8_0, Q6_K, Q5_K_M, Q4_K_M, Q3_K_M and Q2_K. We made all the files ourselves from the original weights, with one version of llama.cpp, so the seven levels differ in nothing else.
  • Hardware. One RTX 5090. Every level of both models fits in its memory.
  • Knowledge. 3,000 multiple-choice questions from MMLU. The model had to answer with a single letter.
  • Code. The 164 problems of HumanEval. We ran the model's code against each problem's tests, in a sandbox with no network.
  • Refusals. The 100 harmful requests from JailbreakBench, judged by the same classifier as in our refusal experiment.
  • Drift. For every question, whether the compressed model gave the same answer as the full-precision one.

Replies were generated without sampling.

Smaller and faster

Level Qwen3-4B Qwen3-8B
F16 8.05 GB, 178 tokens/s 16.39 GB, 101 tokens/s
Q8_0 4.28 GB, 285 tokens/s 8.71 GB, 175 tokens/s
Q6_K 3.31 GB, 337 tokens/s 6.73 GB, 214 tokens/s
Q5_K_M 2.89 GB, 356 tokens/s 5.85 GB, 237 tokens/s
Q4_K_M 2.50 GB, 383 tokens/s 5.03 GB, 261 tokens/s
Q3_K_M 2.08 GB, 407 tokens/s 4.12 GB, 297 tokens/s
Q2_K 1.67 GB, 461 tokens/s 3.28 GB, 341 tokens/s

No surprises here: every step down is smaller and faster. At Q4_K_M both models are 31% of their full size. Qwen3-4B generates 2.2 times as fast as at full precision and Qwen3-8B 2.6 times.

Memory follows the file size. With a 16K context loaded, Qwen3-8B used about 18 GB of GPU memory at full precision and about 8 GB at Q4_K_M.

Knowledge: flat, then a cliff

25%50%75%F16Q8Q6Q5Q4Q3Q2random guessingQwen3-8B · F16: 68.3%Qwen3-8B · Q8_0: 68.3%Qwen3-8B · Q6_K: 68.3%Qwen3-8B · Q5_K_M: 68.6%Qwen3-8B · Q4_K_M: 68.9%Qwen3-8B · Q3_K_M: 66.7%Qwen3-8B · Q2_K: 47.6%Qwen3-4B · F16: 69.5%Qwen3-4B · Q8_0: 69.6%Qwen3-4B · Q6_K: 69.3%Qwen3-4B · Q5_K_M: 69.7%Qwen3-4B · Q4_K_M: 68.1%Qwen3-4B · Q3_K_M: 67.6%Qwen3-4B · Q2_K: 56.8%Qwen3-4BQwen3-8BMultiple-choice accuracy, 3,000 MMLU questionsCompression level, full precision (F16) to 2-bit (Q2)
Accuracy on 3,000 multiple-choice questions. The bottom of the chart is 25%, what guessing would score. Both models hold their level down to Q3_K_M and fall at Q2_K.

From full precision down to Q5_K_M, accuracy stays within 0.3 points on both models. At Q4_K_M, Qwen3-4B is down 1.3 points and Qwen3-8B is up 0.6. At Q3_K_M they are down 1.9 and 1.6 points.

At Q2_K the bottom falls out: Qwen3-4B drops from 69.5% to 56.8% and Qwen3-8B from 68.3% to 47.6%. The larger model fell further.

Code: the same shape, sharper

082164F16Q8Q6Q5Q4Q3Q2Qwen3-8B · F16: 143Qwen3-8B · Q8_0: 142Qwen3-8B · Q6_K: 142Qwen3-8B · Q5_K_M: 140Qwen3-8B · Q4_K_M: 142Qwen3-8B · Q3_K_M: 129Qwen3-8B · Q2_K: 86Qwen3-4B · F16: 140Qwen3-4B · Q8_0: 142Qwen3-4B · Q6_K: 143Qwen3-4B · Q5_K_M: 142Qwen3-4B · Q4_K_M: 144Qwen3-4B · Q3_K_M: 141Qwen3-4B · Q2_K: 70Qwen3-4BQwen3-8BCoding problems solved, out of 164Compression level, full precision (F16) to 2-bit (Q2)
HumanEval problems solved, out of 164. Nothing moves until Q3_K_M, where Qwen3-8B starts to slip. At Q2_K Qwen3-4B solves half of what it did and Qwen3-8B 60%.

From full precision down to Q4_K_M, both models solve between 140 and 144 of the 164 problems. The small differences are noise: they do not follow the order of the levels, and Qwen3-4B's best result is at Q4_K_M.

At Q3_K_M, Qwen3-4B still solves 141. Qwen3-8B drops to 129. At Q2_K they solve 70 and 86.

The same score does not mean the same answers

A benchmark score is an average. It can stay put while the answers underneath it change.

50%75%100%F16Q8Q6Q5Q4Q3Q2Qwen3-8B · F16: 100.0%Qwen3-8B · Q8_0: 98.6%Qwen3-8B · Q6_K: 96.7%Qwen3-8B · Q5_K_M: 94.6%Qwen3-8B · Q4_K_M: 90.1%Qwen3-8B · Q3_K_M: 77.8%Qwen3-8B · Q2_K: 56.2%Qwen3-4B · F16: 100.0%Qwen3-4B · Q8_0: 98.6%Qwen3-4B · Q6_K: 97.7%Qwen3-4B · Q5_K_M: 95.4%Qwen3-4B · Q4_K_M: 92.0%Qwen3-4B · Q3_K_M: 85.1%Qwen3-4B · Q2_K: 65.4%Qwen3-4BQwen3-8BQuestions answered the same as at full precisionCompression level, full precision (F16) to 2-bit (Q2)
Share of the 3,000 questions where the compressed model picked the same answer as the full-precision one, right or wrong. Unlike the scores, this falls at every step.

Take Qwen3-8B at Q4_K_M. Its accuracy is slightly higher than at full precision. Yet it gave a different answer on 297 of the 3,000 questions.

At Q4_K_M, out of 3,000 questions Qwen3-4B Qwen3-8B
Answers that changed 241 297
Was right, now wrong 101 95
Was wrong, now right 61 113
Was wrong, now wrong in a different way 79 89

The gains and losses nearly cancel, so the score hides them. Even at Q8_0, where nobody expects a difference, about 40 answers changed on each model.

Ordinary text shows the same thing. Reading Wikipedia text, the Q4_K_M models agree with full precision about the most likely next token 92% and 91% of the time. At Q2_K it is 67% for both.

For one question this hardly matters. It matters when you expect a compressed model to behave like the original: when you rerun an evaluation, compare against saved outputs, or chain many steps where each one builds on the last.

Compression can remove refusals

050100F16Q8Q6Q5Q4Q3Q2Qwen3-8B · F16: 91Qwen3-8B · Q8_0: 91Qwen3-8B · Q6_K: 91Qwen3-8B · Q5_K_M: 92Qwen3-8B · Q4_K_M: 92Qwen3-8B · Q3_K_M: 95Qwen3-8B · Q2_K: 71Qwen3-4B · F16: 98Qwen3-4B · Q8_0: 97Qwen3-4B · Q6_K: 98Qwen3-4B · Q5_K_M: 98Qwen3-4B · Q4_K_M: 98Qwen3-4B · Q3_K_M: 96Qwen3-4B · Q2_K: 96Qwen3-4BQwen3-8BRefusals out of 100 harmful requestsCompression level, full precision (F16) to 2-bit (Q2)
Refusals out of 100 harmful requests. Qwen3-4B barely changes at any level. Qwen3-8B loses a fifth of its refusals at Q2_K.

Compression is not meant to change what a model is willing to do, and mostly it does not. Qwen3-4B refused between 96 and 98 of the 100 requests at every level.

Qwen3-8B refused 91 at full precision and 71 at Q2_K. Nobody edited it. In the refusal experiment we removed refusals on purpose, by taking one direction out of the model. Here some of the same behaviour fell away as a side effect of rounding the weights. A model's refusals are part of what should be tested again after compression.

At the same file size

Is a larger model at fewer bits better than a smaller model at more bits? Our two models give one comparison. They score about the same at full precision, so neither starts with an advantage.

About the same file size Accuracy Coding problems solved
Qwen3-4B at Q8_0, 4.28 GB 69.6% 142
Qwen3-8B at Q3_K_M, 4.12 GB 66.7% 129
Qwen3-4B at Q6_K, 3.31 GB 69.3% 143
Qwen3-8B at Q2_K, 3.28 GB 47.6% 86

In both pairs the smaller model at higher precision did better. That is what happens once the larger model has to go to 3-bit or below to fit.

What we take from this

  • Q8_0 to Q5_K_M: no difference from full precision on anything we measured, at 36% to 53% of the size.
  • Q4_K_M: the usual default, and these results support it. Under a third of the size, coding unchanged, a point or so at most on multiple choice.
  • Q3_K_M: only if memory forces it. This is where losses begin.
  • Q2_K: not usable for real work on either model.

What this does and does not show

  • Two models from one family, 4B and 8B. We did not test larger models, which may tolerate compression differently.
  • One tool and its standard levels. Other methods, including ones that calibrate on sample text before rounding, may do better at 2 and 3 bits.
  • Small tests. With 164 coding problems, one or two either way is noise. When we ran the whole experiment a second time, the counts moved by that much at most levels.
  • Short tasks. Each test is one question and one answer. We did not measure long multi-step work, where changed answers could add up.
  • One GPU. Speeds are from a card that holds every level in memory. We did not measure hardware where the larger files do not fit.
Try it in your own agent

Setup guides and test results for 11 coding agents.

See setup guidesGet started
Additional services
Need this done for you?

Agent setup, model evaluations, security testing: if it runs on LLM tokens, we take it on.

Talk to us on Discord

More posts