Skip to content
NLEN
Illustration: OpenAI pipeline found 948 Linux root bugs in one run: what autonomous bug hunting means

llama.cpp now quantizes to a file size you choose

By Ivo Donker · — text: Claude (AI)

What is new in llama.cpp? Since build b12669 of November 24, llama-quantize can pick its own mix of quantization types per tensor to hit a given file size (--target-size) or an average number of bits per weight (--target-bpw), with as little error as possible. If you want a model to fit exactly in the memory of your GPU or Mac, you no longer have to choose between a standard variant that is too small and one that is too big. Improvements for Apple chips (Metal) landed the same day.

We read pull request #15550 and the release notes of builds b12667 to b12671 through the GitHub API.

What happened

The proposal by developer EAddario had been open since August 2025 and was merged on November 23 at 17:06 UTC. Build b12669 with the feature appeared on November 24 at 02:38 UTC. The new function target_bpw_type() solves an optimisation problem: which tensor gets how many bits, so that the total stays within budget and the error is as small as possible.

According to the description it works in four steps: estimate the error per tensor by quantizing and dequantizing a sample of rows, weighted by an importance matrix (imatrix); drop, per tensor, the types that are larger without being better; spread the bits across the whole model with a Lagrangian method; and save intermediate results in a --state-file so an interrupted run can resume.

What happened
ItemPer the pull request
New options--target-size (e.g. 23.85g) and --target-bpw (e.g. 4.5678)
Tested34 models, 238 tests
Equal to or better than standard (KLD)93 percent of cases
Time5 to 10 times longer than normal quantization
Requiresimatrix with activation data (recent llama-imatrix)

The pull request gives an example: on a system with 24 GB of video memory and a 70-billion-parameter model, standard types give a 16.8 GB file (quality left on the table) or a 24.1 GB file (does not fit). With --target-size 23.85g you get a 23.85 GiB file.

Also new for Macs

What this means

For anyone running models locally, the target size is the key change. The memory of a laptop or graphics card is a hard limit, and until now fixed rules per standard type decided how big a file became. The author lists the limits: it takes much more compute, the optimisation uses an estimated per-tensor error rather than actual quality, and without a suitable imatrix the option refuses to run. The 93 percent figure comes from the author's own tests. Background on quantization is in our article on quantization from 16 to 4 bits. Earlier steps in the project are in our article on the stable llama.cpp API, and the Inkling models in our article on running Inkling 2 Mini locally.

What we did not check

We did not test the new option ourselves: it needs a model plus a recent imatrix and, per the author, takes 5 to 10 times longer than a normal quantization. The test results (KLD per model) come from the pull request. llama.cpp builds are marked 'prerelease' on GitHub.

Checked on November 24, 2026.

This article was written with AI (Claude) and checked against the sources below.

Sources