CoolFace
Modelpublic

bartowski/MiniCPM5-2B-GGUF

sourceHugging Faceapache-2.0updated 12d agoView on Hugging Face
30likes19kdownloads
Model Card

Llamacpp imatrix Quantizations of MiniCPM5-2B by openbmb

Using <a href="https://github.com/ggml-org/llama.cpp/">llama.cpp</a> release <a href="https://github.com/ggml-org/llama.cpp/releases/tag/b10883">b10883</a> 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:

FilenameQuant typeFile SizeSplitDescription
MiniCPM5-2B-bf16.ggufbf165.04GBfalseFull BF16 weights.
MiniCPM5-2B-Q8_0.ggufQ8_02.68GBfalseExtremely high quality, generally unneeded but max available quant.
MiniCPM5-2B-Q6_K_L.ggufQ6KL2.28GBfalseThe large size of Q6K, about halfway to Q80 in size. Very high quality, near perfect, recommended.
MiniCPM5-2B-Q6_K.ggufQ6_K2.11GBfalseVery high quality, near perfect, recommended.
MiniCPM5-2B-Q5_K_M.ggufQ5KM1.92GBfalseHigh quality, recommended.
MiniCPM5-2B-Q5_K_S.ggufQ5KS1.82GBfalseHigh quality, recommended.
MiniCPM5-2B-Q4_K_L.ggufQ4KL1.71GBfalseThe large size of Q4K, between Q4KM and Q5K_S: more of the most sensitive weights kept at higher precision, recommended.
MiniCPM5-2B-Q4_1.ggufQ4_11.65GBfalseLegacy format, similar performance to Q4KS but with improved tokens/watt on Apple silicon.
MiniCPM5-2B-Q4_K_M.ggufQ4KM1.62GBfalseGood quality, default size for most use cases, recommended.
MiniCPM5-2B-IQ4_NL.ggufIQ4_NL1.61GBfalseSimilar to IQ4_XS, but slightly larger.
MiniCPM5-2B-Q4_K_S.ggufQ4KS1.53GBfalseSlightly lower quality with more space savings, recommended.
MiniCPM5-2B-Q4_0.ggufQ4_01.52GBfalseLegacy format, kept for compatibility with older tools.
MiniCPM5-2B-IQ4_XS.ggufIQ4_XS1.46GBfalseDecent quality, smaller than Q4KS with similar performance, recommended.
MiniCPM5-2B-IQ3_M.ggufIQ3_M1.36GBfalseMedium-low quality, new method with decent performance comparable to Q3KM.
MiniCPM5-2B-Q3_K_L.ggufQ3KL1.29GBfalseLower quality but usable, good for low RAM availability.
MiniCPM5-2B-Q3_K_M.ggufQ3KM1.24GBfalseLow quality.
MiniCPM5-2B-IQ3_XS.ggufIQ3_XS1.19GBfalseLower quality, new method with decent performance, slightly better than Q3KS.
MiniCPM5-2B-Q3_K_S.ggufQ3KS1.19GBfalseLow quality, not recommended.
MiniCPM5-2B-IQ3_XXS.ggufIQ3_XXS1.14GBfalseLower quality, new method with decent performance, comparable to Q3 quants.
MiniCPM5-2B-Q2_K.ggufQ2_K1.01GBfalseVery low quality but surprisingly usable.
MiniCPM5-2B-IQ2_M.ggufIQ2_M0.97GBfalseRelatively 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

<details> <summary>Click to view download instructions</summary>

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 ./

</details>

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 Q4KM is still mostly Q4K; 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 Q80; 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: Q4KM reached 0.94×, Q3KM 0.69× and IQ2_M 0.65× the KL divergence of the standard layout at the same file size.

<details> <summary>Layout details</summary>

Files built from a computed layout:

QuantSizeBody bits/weightFile bits/weightBody kept at base type
Q6KL2.28GB7.417.2450 %
Q6_K2.11GB6.716.7090 %
Q5KM1.92GB6.106.1070 %
Q5KS1.82GB5.685.7790 %
Q4KL1.71GB5.415.4550 %
Q4KM1.62GB5.015.1470 %
IQ4_NL1.61GB4.965.1070 %
Q4KS1.53GB4.684.8890 %
IQ4_XS1.46GB4.434.6590 %
IQ3_M1.36GB4.264.3350 %
Q3KL1.29GB3.964.0950 %
Q3KM1.24GB3.753.9370 %
IQ3_XS1.19GB3.583.7990 %
Q3KS1.19GB3.563.7890 %
IQ3_XXS1.14GB3.383.6470 %
Q2_K1.01GB3.003.2270 %
IQ2_M0.97GB2.823.0870 %

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.

QuantComputed layout KLDStandard layout KLDRatio at equal sizeSize vs standard file
Q4KM0.0428 ± 0.00040.0468 ± 0.00040.94×equal
Q3KM0.2007 ± 0.00170.1696 ± 0.00150.69×−6.9 %
IQ2_M0.8957 ± 0.00970.8516 ± 0.00950.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 Q80, a large one follows the file's bitrate. A K-quant and the IQ quant with the same base bitrate (Q3KS and IQ3XS, Q3KM and IQ3S, Q3KL and IQ3M) 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.

</details>

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 Q4044/48/88 files; those are long gone. Online repacking now covers Q40, IQ4_NL, and most K-quants, so no special quant choice is needed for CPU inference.

Which file should I choose?

<details> <summary>Click here for details</summary>

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 'QXKX', like Q5KM.

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 IQXX, like IQ3M. 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.

</details>

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