Picking a quantisation level for a local AI model has always involved some guesswork. You choose Q4_K_M or Q5_K_M, check the file size, and if it's a little too big for your graphics card you drop a level and lose more quality than you needed to. llama.cpp 1.1, released on 26 November 2026, adds a better way: tell llama-quantize the file size or average bits per weight you want, and it chooses the quantisation type for each tensor to hit that target.
This guide is based on llama.cpp's official quantize and imatrix documentation and the v1.1.0 release notes, read on 26 November 2026.
What you need
llama.cpp 1.1 or later. The --target-size and --target-bpw options are new in v1.1.0. On Windows, the pre-built zip files on llama.cpp's GitHub releases page include llama-quantize.exe and llama-imatrix.exe alongside llama-server.exe (we checked the CPU build b12774). Our guide to running llama.cpp on Windows explains which download to pick.
A high-precision GGUF of the model, usually BF16, F16 or F32. If you only have the original Hugging Face files, follow our guide to converting a model to GGUF first. Don't start from an already quantised file: the documentation warns that re-quantising "can severely reduce quality" compared with quantising from 16-bit or 32-bit.
Enough disk space and RAM. The quantize documentation says models are loaded fully into memory, so you need enough RAM to load them and enough disk space for the intermediate files. Its own example lists Llama 3.1 8B at 32.1GB in its original form and 4.9GB at Q4_K_M.
Some calibration text for the importance matrix (step 2). The imatrix documentation uses a plain text file, such as wiki.train.raw, as its example.
Step 1: Decide on a target
First work out how big the file can be. The model weights aren't the only thing that has to fit in video memory: the context (KV cache) needs room too, and it grows with the context length you choose. Our explainer on context length and VRAM covers this, and our guide to checking whether a model fits your GPU shows how to estimate it before downloading.
You can set the target in one of two ways:
--target-size sets a file size, written like 1.5g in the documentation's example. This is the easiest option if you know how much VRAM you want the model to use.
--target-bpw sets an average number of bits per weight, such as 4.5678 in the documentation. This is useful if you're used to thinking in quantisation levels. For reference, the same document's table for Llama 3.1 8B lists Q4_K_M at about 4.9 bits per weight and Q3_K_M at about 4.0.
Leave some headroom rather than aiming for exactly your card's total VRAM. Windows and your other programs use some of it, and you can see how much is free with our guide to checking VRAM usage in Windows.
Step 2: Make an importance matrix
The examples in the documentation for both target options pass an importance matrix with --imatrix. The quantize documentation says a suitable imatrix file can minimise the accuracy loss that quantisation causes, and the imatrix tool exists to calculate one from a model and a text file.
Run llama-imatrix on your high-precision GGUF and a calibration text file. The documentation's example offloads the work to the graphics card with -ngl 99, which it recommends for faster computation:
llama-imatrix -m model-bf16.gguf -f calibration-data.txt -ngl 99
By default this writes imatrix.gguf. The -ngl (--n-gpu-layers) option sets how many layers are offloaded to the graphics card, so use a lower number if the high-precision model is too big for your VRAM.
Step 3: Quantise to the target
Now run llama-quantize with your target. To aim for a file of about 12GB, for example:
llama-quantize --target-size 12g --state-file --imatrix imatrix.gguf model-bf16.gguf model-12g.gguf
Or to aim for an average bits per weight:
llama-quantize --target-bpw 4.5 --state-file --imatrix imatrix.gguf model-bf16.gguf model-4.5bpw.gguf
The documentation notes that the model type at the end of the command is optional with these options, because the tool picks the types itself. Its examples also run the tool from a build folder (./build/bin/llama-quantize or ./llama-quantize); on Windows, run llama-quantize.exe from the folder you unzipped.
Step 4: Let it resume if you stop it
Choosing types for every tensor takes extra work, so the tool stores its scores in a state file. If you pass --state-file without a name, the documentation says it uses a default name based on the model name and a hash, ending in .bpw_state. You can also give your own name, as in its --target-size 1.5g --state-file my-state-file.dat example.
The documentation says progress "is automatically preserved upon interruptions (SIGTERM or Ctrl-C)", so running the same command again resumes the job. You can also reuse the saved computations to make a second file at a different target from the same model, as the documentation's 2.345 bpw example does.
Step 5 (optional): Rule out quant types or fix key tensors
Two extra options give you more control:
--target-exclude takes a comma-separated list of quantisation types that the automatic selection must ignore. The documentation's example excludes IQ2_XXS, IQ2_XS and IQ2_S. It notes that a state checkpoint isn't written while this option is active.
--tensor-type, --token-embedding-type and --output-tensor-type still work. Tensors you set this way keep the types you chose, and their size counts towards the overall target. The documentation warns that quantisation will fail if those fixed tensors leave too little room for the rest of the model.
Step 6: Check and run the result
Look at the size of the finished file, then load it in llama-server or any app that accepts GGUF files and keep an eye on VRAM use. If a vision model needs it, remember that the multimodal part (the mmproj file) is separate. The documentation says these components are usually kept in a high-quality format such as BF16 or Q8, because they're small and have a direct effect on the quality of the model's output.
Tips
Quantise from BF16 or F16, never from an existing Q4 file. The documentation is clear that re-quantising hurts quality.
Try a dry run of a standard quantisation. --dry-run simulates the quantisation process without producing a model file. The documentation's example uses it with a normal Q4_K_M command; it doesn't say whether it works with the new target options.
Running short of RAM? --max-buffer-size caps how much of a single tensor is kept in memory while it's being quantised (8192MiB by default), which the documentation suggests for very large tensors on machines with little RAM.
Not sure what the quant names mean? Our GGUF quantisation explainer covers K-quants and I-quants.
Our verdict
If you make your own GGUF files, --target-size in llama.cpp 1.1 removes the guesswork of picking a single quantisation type and hoping it fits. Build an importance matrix from your BF16 or F16 model, ask llama-quantize for a file that leaves headroom on your graphics card, and use a state file so a long job can resume. If you'd rather not do this yourself, ready-made GGUF downloads remain the simpler route, but for squeezing a model onto an 8GB, 12GB or 16GB card, a size target is a more precise way to do it than picking a single quantisation type.