Instructions to use Ttimms/MiniCPM5-2B-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ttimms/MiniCPM5-2B-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ttimms/MiniCPM5-2B-NVFP4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Ttimms/MiniCPM5-2B-NVFP4") model = AutoModelForCausalLM.from_pretrained("Ttimms/MiniCPM5-2B-NVFP4", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Ttimms/MiniCPM5-2B-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ttimms/MiniCPM5-2B-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ttimms/MiniCPM5-2B-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Ttimms/MiniCPM5-2B-NVFP4
- SGLang
How to use Ttimms/MiniCPM5-2B-NVFP4 with 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 "Ttimms/MiniCPM5-2B-NVFP4" \ --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": "Ttimms/MiniCPM5-2B-NVFP4", "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 "Ttimms/MiniCPM5-2B-NVFP4" \ --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": "Ttimms/MiniCPM5-2B-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Ttimms/MiniCPM5-2B-NVFP4 with Docker Model Runner:
docker model run hf.co/Ttimms/MiniCPM5-2B-NVFP4
MiniCPM5-2B — NVFP4 W4A16 (GPTQ)
NVFP4 weight-only (W4A16) quantization of openbmb/MiniCPM5-2B
— 4-bit float weights in 16-element blocks with FP8 block scales, activations
in bf16, lm_head + embeddings kept in bf16. Rounding is GPTQ (Hessian-aware),
not RTN, which recovers most of the quality NVFP4 otherwise loses on a small
model. Produced with llm-compressor 0.13.
- 2.03 GiB on disk (bf16 base is 4.68 GiB — 57 % smaller)
- Serves on vLLM (
compressed-tensors); on SM120 the weight-only path currently decodes via the Marlin kernel to a bf16 GEMM (no native FP4 compute), so the benefit here is footprint, not raw speed - Coding cost vs bf16: ~2.4 pp HumanEval / ~4.8 pp MBPP — see the eval
Pick this if you need to fit near 2 GB (e.g. an 8 GB card with a large KV cache). If you can spare ~0.8 GB, the FP8 build is near-lossless.
Evaluation
lm-evaluation-harness, vLLM backend, greedy, 3 draws each (the harness is
non-deterministic run-to-run even at greedy — median + range reported).
| build | HumanEval-instruct | MBPP (3-shot) | size |
|---|---|---|---|
| bf16 base | 86.59 % (85.98–86.59) | 50.60 % (50.40–51.00) | 4.68 GiB |
| NVFP4-W4A16 RTN | 79.88 % (77.44–79.88) | 41.20 % (41.20–41.80) | 2.03 GiB |
| NVFP4-W4A16 GPTQ (this) | 84.15 % (81.71–84.15) | 45.80 % (45.60–46.40) | 2.03 GiB |
| Δ vs bf16 (GPTQ) | −2.4 pp | −4.8 pp | −57 % |
GPTQ rounding recovers ~4.3 pp (HumanEval) / ~4.6 pp (MBPP) over plain RTN. A 2.5 B dense model still can't fully absorb 4-bit weights — the residual gap, especially on MBPP, is the cost of the extra 0.8 GB saved vs FP8.
v1 — updated as more evals land (RULER long-context, agentic SWE-style, IFEval), and a mixed-precision build (MLP-NVFP4 + attention-FP8) is in progress.
Usage
vllm serve Ttimms/MiniCPM5-2B-NVFP4 --max-model-len 32768 --kv-cache-dtype fp8
Method & provenance
- Quantizer:
llm-compressor0.13,GPTQModifier(scheme="NVFP4A16", dampening_frac=0.1), ignorelm_head+embed_tokens. Calibration: 512 samples oftheblackcat102/evol-codealpaca-v1(code, disjoint from the eval sets), 2048 tokens. - Base:
openbmb/MiniCPM5-2B(LlamaForCausalLM, 2.5 B, Apache-2.0). - Built and evaluated on an RTX 5070 Ti (Blackwell, SM120), vLLM 0.26.
- Full quant-format comparison + methodology: https://github.com/t-timms/blackwell-16gb-moe
License
Apache-2.0, inherited from openbmb/MiniCPM5-2B.
- Downloads last month
- -
Model tree for Ttimms/MiniCPM5-2B-NVFP4
Base model
openbmb/MiniCPM5-2B