How to use from
SGLang
Install from pip and serve model
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
    --model-path "PureTensorAI/MiniCPM5-2B-NVFP4A16" \
    --host 0.0.0.0 \
    --port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "PureTensorAI/MiniCPM5-2B-NVFP4A16",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Use Docker images
docker run --gpus all \
    --shm-size 32g \
    -p 30000:30000 \
    -v ~/.cache/huggingface:/root/.cache/huggingface \
    --env "HF_TOKEN=<secret>" \
    --ipc=host \
    lmsysorg/sglang:latest \
    python3 -m sglang.launch_server \
        --model-path "PureTensorAI/MiniCPM5-2B-NVFP4A16" \
        --host 0.0.0.0 \
        --port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
	-H "Content-Type: application/json" \
	--data '{
		"model": "PureTensorAI/MiniCPM5-2B-NVFP4A16",
		"messages": [
			{
				"role": "user",
				"content": "What is the capital of France?"
			}
		]
	}'
Quick Links

MiniCPM5-2B NVFP4A16 (GPTQ, weights only)

NVFP4 quantization of openbmb/MiniCPM5-2B, made by PureTensor from the official BF16 weights. Weights are 4-bit; activations stay 16-bit (W4A16). The file is 2.18 GB against 5.03 GB for BF16.

This is a test release. It is not affiliated with or endorsed by OpenBMB.

Read this first: this checkpoint is measurably below BF16: 2.7 points on MMLU and 4.0 on GSM8K, both statistically significant. In exchange it served about 40% faster than BF16 for a single stream on vLLM in our test. Numbers below.

What was done

Source openbmb/MiniCPM5-2B, BF16
Format compressed-tensors nvfp4-pack-quantized, scheme NVFP4A16: 4-bit E2M1 values, one FP8 E4M3 scale per group of 16, one FP32 scale per tensor
Quantized the weights of every Linear layer in the 42 transformer blocks
Kept in BF16 token embeddings, output head, all norms, all activations
Method GPTQ (block_size 128, dampening_frac 0.01, actorder static)
Calibration the first 512 samples of mlabonne/open-perfectblend, up to 2,048 tokens each
Tools llm-compressor 0.15.0, compressed-tensors 0.20.1, transformers 5.21.0, torch 2.14.1
from llmcompressor import oneshot
from llmcompressor.modifiers.quantization import GPTQModifier

recipe = GPTQModifier(targets="Linear", scheme="NVFP4A16", ignore=["lm_head"])
oneshot(model=model, processor=tokenizer, recipe=recipe, dataset="perfectblend",
        splits="train[:512]", num_calibration_samples=512, max_seq_length=2048)
model.save_pretrained(out_dir, save_compressed=True)

Measured quality

Measured by us in one harness with the BF16 model as reference. The saved checkpoint reloaded from disk to logits identical to the in-memory quantized model.

BF16 This checkpoint Change Paired test
MMLU, accuracy (14,042 questions) 57.29 54.60 -2.69 1,176 lost, 799 gained, p = 2e-17
GSM8K, exact match (1,319 problems) 72.48 68.46 -4.02 130 lost, 77 gained, p = 3e-4
WikiText-2 perplexity (131,072 tokens) 15.64 16.27 +0.63
Text Tokens Mean KL divergence 99th percentile KL Same top token as BF16
WikiText-2 test 131,072 0.064 0.52 87.5%
Chat (HuggingFaceH4/ultrachat_200k, test_sft, 256 conversations) 224,534 0.068 0.97 90.2%
  • MMLU and GSM8K: default mmlu and gsm8k configurations of lm-evaluation-harness 0.4.13, no chat template, GSM8K flexible-extract. The paired test is an exact McNemar test on per-question correctness.
  • KL divergence: full next-token distribution, teacher-forced, windows of 1,024 tokens.
  • Calibration caveat: 180 of the 512 calibration samples are math word problems (MetaMathQA and Orca-Math), and 75 come from UltraChat, the dataset family our chat evaluation set is drawn from. MetaMathQA is built from the GSM8K and MATH training sets. The GSM8K and chat rows may therefore flatter this checkpoint; the MMLU and WikiText rows are unrelated to the calibration data.

On a real serving engine

Served with vLLM 0.34.0 on one NVIDIA Blackwell workstation GPU (compute capability 12.0). vLLM runs this checkpoint with its weight-only FP4 kernel (MarlinNvFp4LinearKernel).

BF16 This checkpoint
GSM8K through the completions API (flexible-extract) 72.10 68.23
Throughput, single stream 1.00x 1.40x
Throughput, 8 concurrent 1.00x 1.53x
Throughput, 32 concurrent 1.00x 1.28x

The served GSM8K score matches the offline one (68.23 against 68.46), so the offline numbers above describe what the engine does. Throughput is fixed 256-token generations, greedy, and will differ on other hardware.

How it compares with other 4-bit builds of this model

All scored by us in the same harness. Public builds are described by method.

Build Activations MMLU GSM8K KL, wiki KL, chat
BF16 reference 16-bit 57.29 72.48 0 0
This checkpoint: GPTQ, dampening 0.01 16-bit 54.60 68.46 0.064 0.068
A public GPTQ build, dampening 0.1 16-bit 55.92 62.93 0.069 0.099
A public AWQ build with searched scales 16-bit 50.45 61.71 0.103 0.149
Our GPTQ build with 4-bit activations (not published) 4-bit 49.88 59.59 0.167 0.205
A public AWQ build with 4-bit activations 4-bit 47.14 52.92 0.208 0.286

This checkpoint is the closest to BF16 on token-level agreement and on GSM8K. The public GPTQ build with heavier dampening is 1.3 points better on MMLU, which is inside the noise: when we repeated our own recipe with different calibration samples, MMLU moved by about 2 points from build to build (51.9 to 56.2 over eight builds), while GSM8K stayed within 66.1 to 69.6 and KL divergence barely moved. Treat MMLU differences of a point or two between rows as ties. With 4-bit activations this model loses 7 to 10 MMLU points, which is why we publish the weights-only form.

Usage

vLLM:

vllm serve PureTensorAI/MiniCPM5-2B-NVFP4A16

Transformers (requires pip install compressed-tensors):

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

repo = "PureTensorAI/MiniCPM5-2B-NVFP4A16"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16).to("cuda")

msgs = [{"role": "user", "content": "Summarise the water cycle in two sentences."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True).to("cuda")
out = model.generate(**ids, max_new_tokens=128)
print(tok.decode(out[0, ids["input_ids"].shape[1]:], skip_special_tokens=True))

Limitations

  • Quality is below BF16, as measured above. If you need the base model's quality, use BF16.
  • In Transformers the weights are expanded back to 16-bit at load, so there the saving is disk and download size only. The speed gain needs an engine with an FP4 weight kernel, such as vLLM.
  • English-language benchmarks only. One calibration draw, no repeated seeds. No safety, multilingual, or long-context evaluation was run on the quantized model.

License

Apache-2.0, as the base model. Changes from the base release: the Linear weights are quantized to NVFP4 and stored packed, and config.json gains a quantization_config block.

Downloads last month
50
Safetensors
Model size
3B params
Tensor type
BF16
·
U8
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for PureTensorAI/MiniCPM5-2B-NVFP4A16

Quantized
(144)
this model

Collection including PureTensorAI/MiniCPM5-2B-NVFP4A16