Skip to main content

MiniCPM5-2B

MiniCPM Text Series

MiniCPM5-2B is the second model in the MiniCPM5 series. It scales the MiniCPM5-1B training recipe to 2B parameters for local assistants, coding agents, tool-calling workflows and inference scenarios that need a compact model. While keeping a small deployment footprint and native long context, it further strengthens coding, math, long-text, tool-calling and agent capabilities, reaching state of the art among open models of its size and competing with some 4B-class models overall.

Choose the weight format that matches your deployment tool, or look at the Base, Midtrain, SFT and other versions according to your training needs. Weights from different training stages serve different purposes, so please read the corresponding model card first.

Model Downloads​

Currently recommended version: MiniCPM5-2B (BF16 / GGUF / MLX / GPTQ):

Quick Start​

For the three most common inference paths, you can start a server or run local inference as shown below. The recommended settings for MiniCPM5-2B are temperature=1.0, top_p=0.95.

vLLM (OpenAI-compatible server, NVIDIA GPU)​

Bash
pip install "vllm>=0.21"
vllm serve openbmb/MiniCPM5-2B --port 8000

Test request:

Bash
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "openbmb/MiniCPM5-2B",
"messages": [{"role": "user", "content": "你是谁?可以简单介绍一下自己吗?"}],
"max_tokens": 128,
"temperature": 1.0,
"top_p": 0.95
}'

SGLang (OpenAI-compatible server, NVIDIA GPU)​

Bash
pip install "sglang[srt]>=0.5.16"
python -m sglang.launch_server --model-path openbmb/MiniCPM5-2B --port 30000

Test request:

Bash
curl http://localhost:30000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "openbmb/MiniCPM5-2B",
"messages": [{"role": "user", "content": "你是谁?可以简单介绍一下自己吗?"}],
"max_tokens": 128,
"temperature": 1.0,
"top_p": 0.95
}'

DSpark Speculative Decoding​

Alongside the model, we have released MiniCPM5-2B-DSpark, a draft model trained for MiniCPM5-2B. Enabling it in SGLang speeds up decoding while keeping the target model's output unchanged.

Bash
python -m sglang.launch_server \
--model-path openbmb/MiniCPM5-2B \
--trust-remote-code \
--speculative-algorithm DSPARK \
--speculative-draft-model-path openbmb/MiniCPM5-2B-DSpark \
--speculative-dspark-block-size 7 \
--port 30000

Transformers (local Python inference, CPU or GPU)​

Bash
pip install -U "transformers>=5.6" accelerate torch

Local inference test:

Python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "openbmb/MiniCPM5-2B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto",
)

messages = [{"role": "user", "content": "你是谁?可以简单介绍一下自己吗?"}]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
enable_thinking=True,
return_dict=True,
return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(
outputs[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True,
))

Recommended sampling parameters: temperature=1.0, top_p=0.95 For the other backends (llama.cpp / Ollama / LM Studio / MLX / ArcLight / vLLM Ascend), see the Deployment Guide.

Tool Calling (Function Call)​

SGLang is recommended. MiniCPM5-2B emits tool calls in XML format, and SGLang's built-in minicpm5 parser automatically converts them into the OpenAI-compatible tool_calls field.

Bash
python -m sglang.launch_server --model-path openbmb/MiniCPM5-2B --port 30000 \
--tool-call-parser minicpm5 # or: --tool-call-parser auto

Developer Showcase

View all →