whisper.cpp/examples/quantize
haopeng b5de98b430
Merge branch 'ggml-org:master' into master
2026-01-18 23:50:18 +08:00
..
CMakeLists.txt examples : fix executable example targets (#3600) 2026-01-13 08:08:18 +01:00
README.md Support Mixed-Precision Quantization 2026-01-12 14:44:23 +08:00
quantize.cpp Support Mixed-Precision Quantization 2026-01-12 14:44:23 +08:00

README.md

quantize

Tool for integer quantization of Whisper ggml model files

Features

  • Standard uniform quantization (Q4_0, Q4_1, Q5_0, Q5_1, Q8_0, Q2_K, Q3_K, Q4_K, Q5_K, Q6_K)
  • Mixed precision quantization - quantize different layers with different quantization types (NEW!)

Basic Usage

./quantize model-f32.bin model-quant.bin type

Where type is one of: q4_0, q4_1, q5_0, q5_1, q8_0, q2_k, q3_k, q4_k, q5_k, q6_k

Mixed Precision Quantization

You can now specify different quantization types for different tensors using the --tensor-type option:

./quantize [--tensor-type PATTERN=TYPE ...] model-f32.bin model-quant.bin default_type

Examples

Quantize encoder with Q8_0 (higher quality) and decoder with Q4_0 (smaller size):

./quantize \
  --tensor-type 'encoder\..*\.weight'=q8_0 \
  --tensor-type 'decoder\..*\.weight'=q4_0 \
  model-f32.bin model-mixed.bin q4_k

Keep attention layers at higher precision:

./quantize \
  --tensor-type '.*attn.*'=q8_0 \
  model-f32.bin model-mixed.bin q4_0

For more detailed documentation and examples, see README_MIXED_PRECISION.md.