MiniCPM4.1 & MiniCPM4
MiniCPM Text Series
MiniCPM4.1 and MiniCPM4 are built for on-device deployment, with efficiency work across model architecture, learning algorithms, training data and the inference system. This page collects resources for MiniCPM4.1-8B, MiniCPM4-8B and MiniCPM4-0.5B; MiniCPM4.1 adds a hybrid thinking mode, so check capabilities and configuration for the specific version you use.
Choose MiniCPM4.1-8B, MiniCPM4-8B or MiniCPM4-0.5B based on your task needs and device constraints. The entries below are kept separate per version; when deploying, use the model identifier and configuration that match the weights you chose.
Key Features
-
Efficient model architecture:
- InfLLM-V2 -- trainable sparse attention: uses a trainable sparse attention architecture in which, for 128K long-text processing, each token only needs to compute relevance with fewer than 5% of tokens, significantly reducing the computational cost of long texts (training kernels)
-
Efficient learning algorithms:
- Model Wind Tunnel 2.0 -- efficient Predictable Scaling: introduces a scaling prediction method for downstream tasks, enabling more accurate search of model training configurations
- BitCPM -- ternary quantization: compresses model parameter bit width to 3 values, achieving 90% compression of model bit width
- Efficient training engineering optimizations: uses FP8 low-precision computation combined with a Multi-token Prediction training strategy
-
High knowledge-density training data:
- UltraClean -- cleaning and synthesis of high-quality pre-training data: builds an iterative data-cleaning strategy based on efficient verification, and open-sources the high-quality Chinese-English pre-training dataset UltraFineweb
- UltraChat v2 -- synthesis of high-quality supervised fine-tuning data: builds a large-scale, high-quality supervised fine-tuning dataset covering knowledge-intensive data, reasoning-intensive data, instruction-following data, long-text understanding data, tool-calling data and more
-
Efficient inference system:
- CPM.cu -- a lightweight, efficient CUDA inference framework: combines sparse attention, model quantization and speculative sampling to fully showcase the efficiency advantages of MiniCPM4/MiniCPM4.1 (inference kernels and framework)
- ArkInfer -- a cross-platform deployment system: supports one-click deployment across multiple backend environments, with flexible cross-platform adaptation
Model Downloads
| Version | HuggingFace | ModelScope |
|---|---|---|
| MiniCPM4.1-8B | Download | Download |
| MiniCPM4-8B | Download | Download |
| MiniCPM4-0.5B | Download | Download |
Quick Start
pip install vllm
vllm serve openbmb/MiniCPM4-8B --dtype bfloat16 --port 8000
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"openbmb/MiniCPM4-8B",
torch_dtype=torch.bfloat16,
device_map="auto"
).eval()
tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM4-8B")
messages = [{"role": "user", "content": "请介绍一下你自己。"}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=512, temperature=0.7, top_p=0.95)
print(tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True))