llama.cpp can now build a quant to fit an exact file size: --target-size and --target-bpw
TL;DR A merged llama.cpp change lets llama-quantize pick the quantization type of each tensor automatically to reach a target file size or bits-per-weight at the lowest measured error. The author reports it matches or beats the standard presets in 93% of 238 tests across 34 models.
In plain words: to run a big model on your own graphics card you shrink it (“quantize” it). Until now you picked from fixed sizes, and often one was a bit too small (wasting memory) and the next one did not fit. llama.cpp can now make a version sized to exactly what you ask for, choosing where to save space with the least damage.
What happened
On November 23 llama.cpp merged PR #15550 by Ed Addario. It adds two options to llama-quantize:
--target-size: the file size you want.--target-bpw: the average bits per weight you want.
The tool then measures the error of different quantization types for each tensor and picks a mix that reaches the target with the lowest overall error. The author reports that the result ties or beats the standard presets in 93% of 238 KL-divergence tests across 34 models (author’s measurement).
Who is affected
Anyone who makes their own GGUF files for llama.cpp or engines based on it, especially on a single 12, 16 or 24 GB card where the jump between preset sizes hurts.
Why it matters
Example from the announcement: on a 24 GB card, a 70B quant of 16.8 GB leaves memory idle, and the next one at 24.1 GB does not fit. A quant built for, say, 21 GB uses the card fully and leaves room for context. It also makes comparisons fairer: two quants at the exact same size can be compared on quality alone.
What to do
- Update llama.cpp to a build that includes PR #15550.
- Start from the full-precision model (BF16) and set
--target-sizea little below your free memory, leaving room for the context (KV cache). - Check the result with your own test (perplexity or KL divergence against the original) before trusting the author’s numbers for your model.