Model reference · open weights
MiniCPM3 is an open-weight language model from openbmb. MiniCPM3-4B (BF16) weighs 8.1 GB; the smallest configuration that runs it is RTX 3060 12 GB.
Summary of the openbmb/MiniCPM3-4B model card, 2026-10-01
What it is
| Released by | openbmb |
|---|---|
| Released | 2024-09-03 |
| VRAM | 8.1 GB for the weights |
What it runs on
| Card | Requests at once | Context max | Memory | |
|---|---|---|---|---|
| 8K each | 32K each | |||
| RTX 3060 12 GB | 9 | 2 | all 32K | 11.6 GB |
| RTX 4060 Ti 16 GB | 22 | 5 | all 32K | 15.4 GB |
| RTX 3090 24 GB | 50 | 12 | all 32K | 23.4 GB |
| RTX 4090 24 GB | 49 | 12 | all 32K | 23.4 GB |
| RTX 5090 32 GB | 76 | 19 | all 32K | 31.0 GB |
| L40S 48 GB | 120 | 30 | all 32K | 44.0 GB |
| A100 80 GB | 237 | 59 | all 32K | 78.2 GB |
| H100 80 GB | 226 | 56 | all 32K | 78.1 GB |
| RTX PRO 6000 Blackwell 96 GB | 279 | 69 | all 32K | 93.8 GB |
| DGX Spark (GB10) 128 GB unified | 325 | 81 | all 32K | 107 GB |
| H200 141 GB | 430 | 107 | all 32K | 138 GB |
| B200 180 GB | 560 | 140 | all 32K | 176 GB |
| Requests at once | 8K tokens each | 32K tokens each |
|---|---|---|
| 1 | 9.0 GB | 9.9 GB |
| 5 | 10.2 GB | 14.6 GB |
| 8 | 11.1 GB | 18.1 GB |
| 16 | 13.4 GB | 27.5 GB |
| 32 | 18.1 GB | 46.2 GB |
| 64 | 27.5 GB | 83.6 GB |
One card, with vLLM's small-card settings.
From the model card
MiniCPM3-4B is the 3rd generation of MiniCPM series. The overall performance of MiniCPM3-4B surpasses Phi-3.5-mini-Instruct and GPT-3.5-Turbo-0125, being comparable with many recent 7B~9B models.
Compared to MiniCPM1.0/MiniCPM2.0, MiniCPM3-4B has a more powerful and versatile skill set to enable more general usage. MiniCPM3-4B supports function call, along with code interpreter. Please refer to Advanced Features for usage guidelines.
MiniCPM3-4B has a 32k context window. Equipped with LLMxMapReduce, MiniCPM3-4B can handle infinite context theoretically, without requiring huge amount of memory.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
path = "openbmb/MiniCPM3-4B"
device = "cuda"
tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16, device_map=device, trust_remote_code=True)
messages = [
{"role": "user", "content": "推荐5个北京的景点。"},
]
model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to(device)
model_outputs = model.generate(
model_inputs,
max_new_tokens=1024,
top_p=0.7,
temperature=0.7
)
output_token_ids = [
model_outputs[i][len(model_inputs[i]):] for i in range(len(model_inputs))
]
responses = tokenizer.batch_decode(output_token_ids, skip_special_tokens=True)[0]
print(responses)
For now, you need to install our forked version of vLLM.
pip install git+https://github.com/OpenBMB/vllm.git@minicpm3
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
model_name = "openbmb/MiniCPM3-4B"
prompt = [{"role": "user", "content": "推荐5个北京的景点。"}]
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
input_text = tokenizer.apply_chat_template(prompt, tokenize=False, add_generation_prompt=True)
llm = LLM(
model=model_name,
trust_remote_code=True,
tensor_parallel_size=1
)
sampling_params = SamplingParams(top_p=0.7, temperature=0.7, max_tokens=1024, repetition_penalty=1.02)
outputs = llm.generate(prompts=input_text, sampling_params=sampling_params)
print(outputs[0].outputs[0].text)
@article{hu2024minicpm,
title={MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies},
author={Hu, Shengding and Tu, Yuge and Han, Xu and He, Chaoqun and Cui, Ganqu and Long, Xiang and Zheng, Zhi and Fang, Yewei and Huang, Yuxiang and Zhao, Weilin and others},
journal={arXiv preprint arXiv:2404.06395},
year={2024}
}
Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.