Llamacpp imatrix Quantizations of MiniCPM5-2B by openbmb

Using llama.cpp release b10883 for quantization.

Original model: https://huggingface.co/openbmb/MiniCPM5-2B

Model details:

  • Parameter count: 3B
  • Input support: text
  • Speculative decoding: no
  • imatrix: yes - details

How to run

Prompt format

<s><|im_start|>system
{system_prompt}<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant

Don't know which to choose? Grab Q4_K_M (1.62GB) - usually a good mix of size and performance. Download instructions available here

Available files:

Filename Quant type File Size Split Description
MiniCPM5-2B-bf16.gguf bf16 5.04GB false Full BF16 weights.
MiniCPM5-2B-Q8_0.gguf Q8_0 2.68GB false Extremely high quality, generally unneeded but max available quant.
MiniCPM5-2B-Q6_K_L.gguf Q6_K_L 2.28GB false The large size of Q6_K, about halfway to Q8_0 in size. Very high quality, near perfect, recommended.
MiniCPM5-2B-Q6_K.gguf Q6_K 2.11GB false Very high quality, near perfect, recommended.
MiniCPM5-2B-Q5_K_M.gguf Q5_K_M 1.92GB false High quality, recommended.
MiniCPM5-2B-Q5_K_S.gguf Q5_K_S 1.82GB false High quality, recommended.
MiniCPM5-2B-Q4_K_L.gguf Q4_K_L 1.71GB false The large size of Q4_K, between Q4_K_M and Q5_K_S: more of the most sensitive weights kept at higher precision, recommended.
MiniCPM5-2B-Q4_1.gguf Q4_1 1.65GB false Legacy format, similar performance to Q4_K_S but with improved tokens/watt on Apple silicon.
MiniCPM5-2B-Q4_K_M.gguf Q4_K_M 1.62GB false Good quality, default size for most use cases, recommended.
MiniCPM5-2B-IQ4_NL.gguf IQ4_NL 1.61GB false Similar to IQ4_XS, but slightly larger.
MiniCPM5-2B-Q4_K_S.gguf Q4_K_S 1.53GB false Slightly lower quality with more space savings, recommended.
MiniCPM5-2B-Q4_0.gguf Q4_0 1.52GB false Legacy format, kept for compatibility with older tools.
MiniCPM5-2B-IQ4_XS.gguf IQ4_XS 1.46GB false Decent quality, smaller than Q4_K_S with similar performance, recommended.
MiniCPM5-2B-IQ3_M.gguf IQ3_M 1.36GB false Medium-low quality, new method with decent performance comparable to Q3_K_M.
MiniCPM5-2B-Q3_K_L.gguf Q3_K_L 1.29GB false Lower quality but usable, good for low RAM availability.
MiniCPM5-2B-Q3_K_M.gguf Q3_K_M 1.24GB false Low quality.
MiniCPM5-2B-IQ3_XS.gguf IQ3_XS 1.19GB false Lower quality, new method with decent performance, slightly better than Q3_K_S.
MiniCPM5-2B-Q3_K_S.gguf Q3_K_S 1.19GB false Low quality, not recommended.
MiniCPM5-2B-IQ3_XXS.gguf IQ3_XXS 1.14GB false Lower quality, new method with decent performance, comparable to Q3 quants.
MiniCPM5-2B-Q2_K.gguf Q2_K 1.01GB false Very low quality but surprisingly usable.
MiniCPM5-2B-IQ2_M.gguf IQ2_M 0.97GB false Relatively low quality, uses SOTA techniques to be surprisingly usable.

Download a specific file:

hf download bartowski/MiniCPM5-2B-GGUF --include "MiniCPM5-2B-Q4_K_M.gguf" --local-dir ./

Downloading using the Hugging Face CLI

Click to view download instructions

First, make sure you have the Hugging Face CLI installed:

pip install -U "huggingface_hub[cli]"

Download a specific file:

hf download bartowski/MiniCPM5-2B-GGUF --include "MiniCPM5-2B-Q4_K_M.gguf" --local-dir ./

How to run

These quants run with llama.cpp - installable in one line via llama.app:

curl -LsSf https://llama.app/install.sh | sh
llama-server -hf bartowski/MiniCPM5-2B-GGUF:Q4_K_M

llama-server includes a built-in chat web UI, served at http://localhost:8080 by default.

These quants were made with llama.cpp release b10883 - if this model's architecture is newly supported, you'll need that release or newer to run them.

They also work in: LM Studio · koboldcpp · ramalama · Jan AI · Text Generation Web UI · LoLLMs · Atomic Chat

Per-tensor layouts

Some of these files were built with a layout computed for this model instead of llama.cpp's standard one-size-fits-all rules. A Q4_K_M is still mostly Q4_K; the extra precision goes to the weights this particular model is most sensitive to. The S, M or L in a name says how much of the model stays at the base precision: about 90 % for S, 70 % for M and 50 % for L. An _L name is simply the large size of its family. Q4_K_L is to Q4_K_M what Q4_K_M is to Q4_K_S, and Q6_K_L sits about halfway between Q6_K and Q8_0. In earlier releases an _L name meant the embedding and output weights were kept at Q8_0; in these files it means the larger size of the base type. There is no size target, so each file's bits per weight is reported rather than promised.

The layout each of these files was built with is published in the layouts/ folder: <file>.tensor-types.txt is the exact --tensor-type-file given to llama-quantize, and <file>.layout.json records how it was computed, including the generator version, the llama.cpp release and the commit, so any of them can be rebuilt.

Checked on this model before any of these files were released: Q4_K_M reached 0.94×, Q3_K_M 0.69× and IQ2_M 0.65× the KL divergence of the standard layout at the same file size.

Layout details

Files built from a computed layout:

Quant Size Body bits/weight File bits/weight Body kept at base type
Q6_K_L 2.28GB 7.41 7.24 50 %
Q6_K 2.11GB 6.71 6.70 90 %
Q5_K_M 1.92GB 6.10 6.10 70 %
Q5_K_S 1.82GB 5.68 5.77 90 %
Q4_K_L 1.71GB 5.41 5.45 50 %
Q4_K_M 1.62GB 5.01 5.14 70 %
IQ4_NL 1.61GB 4.96 5.10 70 %
Q4_K_S 1.53GB 4.68 4.88 90 %
IQ4_XS 1.46GB 4.43 4.65 90 %
IQ3_M 1.36GB 4.26 4.33 50 %
Q3_K_L 1.29GB 3.96 4.09 50 %
Q3_K_M 1.24GB 3.75 3.93 70 %
IQ3_XS 1.19GB 3.58 3.79 90 %
Q3_K_S 1.19GB 3.56 3.78 90 %
IQ3_XXS 1.14GB 3.38 3.64 70 %
Q2_K 1.01GB 3.00 3.22 70 %
IQ2_M 0.97GB 2.82 3.08 70 %

Checked on this model: the computed layout against the standard one, measured by KL divergence against the unquantized model. The ratio compares each computed file with the standard ladder read at that file's own size, so it can differ from the two KLD columns when the two files differ in size.

Quant Computed layout KLD Standard layout KLD Ratio at equal size Size vs standard file
Q4_K_M 0.0428 ± 0.0004 0.0468 ± 0.0004 0.94× equal
Q3_K_M 0.2007 ± 0.0017 0.1696 ± 0.0015 0.69× −6.9 %
IQ2_M 0.8957 ± 0.0097 0.8516 ± 0.0095 0.65× −7.8 %

How it works: the base type is a floor for every body tensor and a fixed share of the body bytes stays at it (90 % for S, 70 % for M, 50 % for L); the remaining bytes go where a cross-model sensitivity prior, measured by KL divergence against the unquantized model, says they buy the most quality. The embedding and output tensors are sized by their share of the file: a small table is kept at Q8_0, a large one follows the file's bitrate. A K-quant and the IQ quant with the same base bitrate (Q3_K_S and IQ3_XS, Q3_K_M and IQ3_S, Q3_K_L and IQ3_M) come out at about the same size; the IQ file is the GPU-oriented twin. The whole-file bitrates sit above the body bitrates because the embedding tables are a large share of this model's files.

imatrix

All quants made using imatrix option with dataset from here. The imatrix is available here: MiniCPM5-2B-imatrix.gguf.

ARM/AVX information

llama.cpp automatically "repacks" weights into an interleaved layout at load time for faster inference on ARM and AVX machines - details in this PR. This once required downloading special Q4_0_4_4/4_8/8_8 files; those are long gone. Online repacking now covers Q4_0, IQ4_NL, and most K-quants, so no special quant choice is needed for CPU inference.

Which file should I choose?

Click here for details

An older (early 2024) but still useful write-up with charts comparing quant performances is provided by Artefact2 here

The first thing to figure out is how big a model you can run. To do this, you'll need to figure out how much RAM and/or VRAM you have.

If you want your model running as FAST as possible, you'll want to fit the whole thing on your GPU's VRAM. Aim for a quant with a file size 1-2GB smaller than your GPU's total VRAM.

If you want the absolute maximum quality, add both your system RAM and your GPU's VRAM together, then similarly grab a quant with a file size 1-2GB Smaller than that total.

Hugging Face can also do this math for you: add your hardware in your Local Apps settings and the model page will show which files fit.

Next, you'll need to decide if you want to use an 'I-quant' or a 'K-quant'.

If you don't want to think too much, grab one of the K-quants. These are in format 'QX_K_X', like Q5_K_M.

If you want to get more into the weeds, you can check out this extremely useful feature chart:

llama.cpp feature matrix

But basically, if you're aiming for below Q4, and you're running cuBLAS (Nvidia) or rocBLAS (AMD), you should look towards the I-quants. These are in format IQX_X, like IQ3_M. These are newer and offer better performance for their size.

These I-quants can also be used on CPU, but will be slower than their K-quant equivalent, so speed vs performance is a tradeoff you'll have to decide.

Credits

Thank you kalomaze and Dampf for assistance in creating the imatrix calibration dataset.

Thank you ZeroWw for the inspiration to experiment with embed/output.

Want to support my work? Visit my ko-fi page here: https://ko-fi.com/bartowski

Downloads last month
1,714
GGUF
Model size
3B params
Architecture
llama
Hardware compatibility
Log In to add your hardware

2-bit

3-bit

4-bit

5-bit

6-bit

8-bit

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for bartowski/MiniCPM5-2B-GGUF

Quantized
(64)
this model

Datasets used to train bartowski/MiniCPM5-2B-GGUF

Collections including bartowski/MiniCPM5-2B-GGUF