New Tool Radar

Local AI

How to Build a Quantized Copy of a Model with ollama create –quantize

Quantize full-precision Safetensors weights to Q4_K_M when you create a model, so the copy fits in less memory.

Schematic diagram with three steps: start from full-precision F16 weights, create the model with ollama create --quantize q4_K_M, then check the result shows quantization Q4_K_M and size 4.8 GB.

Pulling a model usually gives you a quantized version already, but if you have full-precision weights of your own, you can make the smaller copy yourself. Quantizing “creates a smaller or faster local model from higher-precision weights”, and Ollama does it with ollama create and the --quantize flag when the Modelfile starts from FP16 or FP32 model weights. Common levels include q8_0 and K-means levels such as q4_K_M.

When –quantize works and when it does not

The flag needs full-precision weights to work from. The import docs draw the line clearly: “Ollama does not quantize GGUF models during import. Prepare and quantize them first with a GGUF tool such as llama.cpp’s llama-quantize.” So check what your source is before you start.

Your source What to do
Full-precision FP16 or FP32 weights Use ollama create --quantize as below
A GGUF file Quantize it first with a GGUF tool such as llama.cpp’s llama-quantize, then import it

Try it: build example/gemma-q4 from F16 weights

First, write a Modelfile that points at the high-precision source, using the quantization guide’s own example path. Then create the quantized model. Both commands and the output below are the guide’s own example.

FROM /srv/models/gemma-f16

ollama create --quantize q4_K_M example/gemma-q4 -f Modelfile

Check What you should see
The create output transferring model data, then quantizing F16 model to Q4_K_M, then writing manifest and success
ollama show example/gemma-q4 A quantization line reading Q4_K_M
ollama list example/gemma-q4 at 4.8 GB

Expected result. We checked the Ollama quantization guide and Ollama’s import docs. We did not run ollama create on this machine.

Limits

A quantized copy trades precision for size, so the guide warns not to claim it is acceptable until it passes a real prompt or evaluation for the workload it will actually run. Keep the source weights until the quantized model passes those checks. And remember the import rule: if your source is already a GGUF file, --quantize will not shrink it during import, so quantize the GGUF first. We did not test any of this ourselves.

Sources

See all