Quantize a GGUF model with llama-quantize
Answer: The quantize tool reads a GGUF input model file. That input is typically F32 or BF16, a high-precision starting point, and the output is a quantized format. Quantization is done in two phases: convert the original model to GGUF format, then quantize the converted GGUF file.
llama-quantize
Quantization reduces the precision of model weights, for example from 32-bit floats to 4-bit integers, which also shrinks the model's size and can speed up inference. This process may introduce some accuracy loss. This can be minimized by using a suitable imatrix file.
For example, quantize to Q4_K_M with llama-quantize. Options include allow-requantize, which can severely reduce quality compared to quantizing from 16bit or 32bit, leave-output-tensor, pure, and imatrix. If the model supports multimodal inputs, you also need to convert and quantize the multimodal encoders and projectors.
GGUF on the Hub
Hugging Face Hub has built-in features for GGUF format, a then binary format that is optimized for quick loading and saving of models. GGUF encodes both the tensors and a standardized set of metadata. You can use the ggml-org/gguf-my-repo tool to convert or quantize your model weights into GGUF weights. You can also use that Space to build your own quants without any setup.
| llama-quantize | GGUF | |---|---| | llama-quantize | Writes a quantized GGUF file | | Q4_K_M | Example quantization method | | imatrix | Suitable file that can minimize accuracy loss | | allow-requantize | Can severely reduce quality | | gguf-my-repo | Convert or quantize weights into GGUF weights |
See also
Claims
- id: C1 claim: llama-quantize takes a high-precision GGUF file and writes a lower-precision quantized file such as Q4_K_M. source: S1 evidence: "Quantization is done in two phases"
- id: C2 claim: An importance matrix can reduce accuracy loss, and requantizing already-quantized tensors can severely reduce quality. source: S1 evidence: "This can severely reduce quality"
- id: C3 claim: GGUF on the Hub stores tensors plus standardized metadata, and gguf-my-repo can convert or quantize weights. source: S2 evidence: "GGUF encodes both the tensors and a standardized set of metadata"
Sources
- [S1] quantize. ggml-org/llama.cpp (GitHub). https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md . License: MIT. Accessed 2026-11-19.
- [S2] GGUF. Hugging Face Hub docs. https://huggingface.co/docs/hub/en/gguf . License: Apache-2.0. Accessed 2026-11-19.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: ggml-org/llama.cpp (GitHub), quantize; Hugging Face Hub docs, GGUF. MIT; Apache-2.0. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: ggml-org/llama.cpp (GitHub), quantize; Hugging Face Hub docs, GGUF. MIT; Apache-2.0.
Cite this
iinventedlight. 2026. "Quantize a GGUF model with llama-quantize." iinventedlight Library, iil:note:wxm49k9s, version of 2026-11-19. https://iinventedlight.com/library/notes/llamacpp-quantize/. License: CC-BY-4.0.
@misc{iil_note_wxm49k9s,
author = {{iinventedlight}},
title = {{Quantize a GGUF model with llama-quantize}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-19},
url = {https://iinventedlight.com/library/notes/llamacpp-quantize/},
note = {Permanent ID iil:note:wxm49k9s. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- llamacpp-quantize.table.json (table; CC-BY-4.0)
- llamacpp-quantize.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/llamacpp-quantize.md.