MiniCPM5-2B

OpenBMB

Parameters

2.5B

Architecture

LlamaForCausalLM

Released

08.09.2026

License

Apache License 2.0

Open Weights Commercial Use Multimodal BF16 MiniCPM en zh

Input Modalities

text

Output Modalities

text

Context (native)

131,072 tokens

Context (extended)

131,072 tokens

Openness Index Score 100.0/100

About

MiniCPM5-2B (openbmb/MiniCPM5-2B, released September 8, 2026 under the Apache 2.0 License) is the second model in the MiniCPM5 series - a dense 2B Transformer (2.52B parameters) built for on-device, local deployment and resource-constrained scenarios, reaching 2B-class open-source SOTA (average score 53.9 in its comparison set, exceeding even the larger models listed, highest of which scores 51.1). It stays competitive with 4B-class models overall, with advantages in coding, mathematics, long-context understanding, tool use and agentic tasks, and provides native long-context support (128K context).

Its training is a full-stack practice of UltraData Tiered Data Management (arXiv 2602.09003): base training (stable + decay phases) and mid-training build core language and target capabilities on the open Ultra-FineWeb/UltraX/UltraData-Code (L0-L3 tiered)/UltraData-Math corpora; post-training runs SFT (400B tokens of deep-thinking SFT), RL with the critic-based algorithm of JustRL II (scaling small LLMs to 128K reasoning), and On-Policy Distillation (OPD) merging 16 expert models produced by RL (including 5 agentic experts) into one release model via full-vocabulary reverse-KL advantage estimates - improving reasoning/general capabilities by an average of +10.96 points and agentic capabilities by +6.96. All datasets are released as part of the UltraData family.

Training Data UltraData family: UltraX, UltraData-Code (L0-L3 tiered), UltraData-SFT-2605, UltraData-SFT-Agent-2609, UltraData-RL-2609, Ultra-FineWeb, Ultra-FineWeb-L3, UltraData-Math. 400B tokens of deep-thinking SFT.

Benchmark Scores

Benchmark Score Date
Humanity's Last Exam
stem_reasoning
12.88%
—
MMLU-Pro
knowledge
34.84%
—
BFCL-V4
general_agent
86.67%
—
SWE-bench Verified
coding_agent
52.75%
—
SWE-bench Pro
coding_agent
18.00%
—
GPQA Diamond
stem_reasoning
54.43%
—
BrowseComp-zh
general_agent
60.36%
—
SuperGPQA
knowledge
32.88%
—
BrowseComp
general_agent
41.54%
—
AA-LCR
long_context
73.75%
—
Gaia2
general_agent
100.00%
—
LongBenchPro
long_context
72.91%
—
GDPVal-AA v2
general_agent
1.07%
—
LongBench v2
long_context
42.53%
—
TAU3-Bench
general_agent
28.95%
—
WildClawBench
coding_agent
28.53%
—
TAU2-Bench
general_agent
100.00%
—
QwenClawBench
coding_agent
78.53%
—
LiveCodeBench v6
stem_reasoning
66.71%
—
LCB-Pro 25Q2 (Easy)
stem_reasoning
100.00%
—
LCB-Pro 25Q2 (Medium)
stem_reasoning
100.00%
—
SciCode
60.06%
—
AIME 2025
stem_reasoning
90.46%
—
AIME 26
stem_reasoning
83.80%
—
HMMT Feb 26
stem_reasoning
56.09%
—
MATH-500
math
67.65%
—
IFBench
instruction_following
72.55%
—
IFEval
instruction_following
86.21%
—
Multi-IF
instruction_following
84.00%
—
OJBench
stem_reasoning
43.91%
—
MMLU-Redux
knowledge
54.20%
—
Claw-Eval Avg
coding_agent
70.89%
—
NoLiMa
long_context
100.00%
—
Terminal Bench 2.1
coding_agent
9.09%
—

Model Tree, Datasets, Spaces and Papers

Model tree for openbmb/MiniCPM5-2B

Adapters

3 models

Finetunes

22 models

Quantizations

57 models

Datasets used to train openbmb/MiniCPM5-2B

Spaces using openbmb/MiniCPM5-2B 6

Collection including openbmb/MiniCPM5-2B

[

MiniCPM5

Collection

SOTA on-device LLMs, small yet powerful. • 24 items • Updated 2 days ago • 55

](https://huggingface.co/collections/openbmb/minicpm5)

Papers for openbmb/MiniCPM5-2B

[

Data Science and Technology Towards AGI Part I: Tiered Data Management

Paper • 2602.09003 • Published Feb 9 • 10

](https://huggingface.co/papers/2602.09003)

[

MiniCPM4: Ultra-Efficient LLMs on End Devices

Paper • 2506.07900 • Published Jun 9, 2025 • 103

](https://huggingface.co/papers/2506.07900)

Citation

Citation

Please cite our paper if you find our work valuable:

@article{minicpm4,
  title={Minicpm4: Ultra-efficient llms on end devices},
  author={MiniCPM, Team},
  journal={arXiv preprint arXiv:2506.07900},
  year={2025}
}

Safetensors

Model size

3B params

Tensor type

BF16

·

License

License

This repository and MiniCPM model weights are released under the Apache-2.0 License.

Limitations and Disclaimer

Limitations and Disclaimer

This model has no autonomous intent or legal personhood; its outputs are text generated from statistical patterns and may be inaccurate, biased, or offensive, and may be manipulated by carefully crafted prompts ("jailbreaks") into producing unintended content. Its responses on sensitive topics such as politics, health, finance, and law are not reviewed by experts and should not be treated as professional advice.

This model is provided "AS IS", without warranty of any kind, express or implied, and the developers are not liable for any damages arising from its use. Users must employ the model only for lawful, compliant, and ethical purposes, configure their own safeguards, and label AI-generated content where required; deliberate jailbreaking, injection attacks, or inducing harmful output is prohibited, and any such testing is at the user's own risk.

Other Supported Frameworks

Other Supported Frameworks

In addition to the deployment and fine-tuning frameworks listed above, MiniCPM5-2B is also supported by FlagOS for multi-chip deployment.

FlagOS Overview

To enable large-scale deployment across different AI chips, Beijing Zhiyuan Research Institute, together with numerous research institutions, chip manufacturers, system vendors, and algorithm and software organizations both domestically and internationally, jointly initiated and established the FlagOS Open Source Community.

The FlagOS community is dedicated to building a unified, open-source system software stack for various AI chips, encompassing core open-source projects such as a large-scale operator library, a unified AI compiler, parallel training and inference frameworks, and a unified communication library. It aims to create an open technology ecosystem connecting the “model-system-chip” layers. By enabling “develop once, deploy across chips”, FlagOS unlocks the computational potential of hardware, breaks down the ecosystem silos between different chip software stacks, and effectively reduces migration costs for developers.The FlagOS community fosters an AI hardware and software ecosystem, overcomes single-vendor closed-source monopolies, promotes widespread deployment of AI hardware technologies, and is committed to rooted in China while embracing global collaboration.

Official website express: https://flagos.io

FlagOS multi-chip support and usage

FlagOS: Supporting Multiple AI Chips

Thanks to FlagOS’s unified multi-chip AI system software stack, MiniCPM5-2B was adapted to 9 different AI chips in an extremely short time. Currently, the multi-chip version of MiniCPM5-2B has been released on FlagRelease, FlagOS’s platform for automatic migration, adaptation, and deployment of large models across multi-architecture AI chips. Details are as follows:

VendorModelScopeHuggingface
NvidiaMiniCPM5-2B-nvidia-FlagOSMiniCPM5-2B-nvidia-FlagOS
HygonMiniCPM5-2B-hygon-FlagOSMiniCPM5-2B-hygon-FlagOS
MetaxMiniCPM5-2B-metax-FlagOSMiniCPM5-2B-metax-FlagOS
Iluvat

(section continues in the model card)

Deployment and Fine-tuning

Deployment

Backend Model format / use case Cookbook Agent Skill
Transformers BF16 / FP16 local Python inference, GPU + CPU transformers.md minicpm5-deploy-transformers
vLLM BF16 / FP16 OpenAI server vllm.md minicpm5-deploy-vllm
SGLang BF16 / FP16 OpenAI server, recommended for tool calling sglang.md minicpm5-deploy-sglang
llama.cpp GGUF local inference, CPU/GPU llama_cpp.md minicpm5-deploy-llama-cpp
Ollama GGUF local on-device runtime ollama.md minicpm5-deploy-ollama
LM Studio GGUF Mac desktop app and OpenAI server lmstudio.md minicpm5-deploy-lmstudio
MLX MLX / 4bit local inference on Apple Silicon mlx.md minicpm5-deploy-mlx
ArcLight GGUF local on-device, CPU, Desktop & Server arclight.md minicpm5-deploy-arclight
vLLM Ascend BF16 / FP16 OpenAI server vllm_ascend.md minicpm5-deploy-vllm-ascend
LiteRT-LM .litertlm on-device runtime: Android / iOS / desktop / IoT, CPU + GPU litert.md minicpm5-deploy-litert

Fine-tuning

Framework Use case Cookbook Agent Skill
TRL + PEFT LoRA / SFT fine-tuning trl.md minicpm5-finetune-trl
LLaMA-Factory Fine-tuning llamafactory.md minicpm5-finetune-llamafactory
ms-swift Fine-tuning ms_swift.md minicpm5-finetune-ms-swift
unsloth Fine-tuning unsloth.md minicpm5-finetune-unsloth

Tool Calling, Cookbooks and Agent Skills

Tool Calling

For tool / function calling, SGLang is the recommended backend. MiniCPM5-2B emits XML-style tool calls and SGLang's built-in minicpm5 parser converts them to OpenAI-compatible tool_calls natively:

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

GitHub Cookbooks and Agent Skills

MiniCPM5-2B uses the standard LlamaForCausalLM architecture, so mainstream inference engines can load it directly: no custom kernels, no model-code fork. For step-by-step deployment and fine-tuning instructions, use the GitHub cookbooks below. Agent Skills are linked as GitHub resources for users working with Cursor / Claude Code style coding agents.

Quickstart (vLLM, SGLang, Transformers)

Quickstart

vLLM

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

curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openbmb/MiniCPM5-2B",
    "messages": [{"role": "user", "content": "Who are you? Please briefly introduce yourself."}],
    "max_tokens": 128,
    "temperature": 1.0
  }'

SGLang

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

curl http://localhost:30000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openbmb/MiniCPM5-2B",
    "messages": [{"role": "user", "content": "Who are you? Please briefly introduce yourself."}],
    "max_tokens": 128,
    "temperature": 1.0
  }'

Speculative decoding (DSpark): we also release MiniCPM5-2B-DSpark, a DSpark draft model trained for MiniCPM5-2B. Enable it in SGLang to accelerate decoding while keeping the target model's outputs unchanged:

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

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

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": "Who are you? Please briefly introduce yourself."}]
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 params: temperature=1.0, top_p=0.95

Training Recipe (base, mid-training, SFT, RL, OPD)

Training Recipe

The training of MiniCPM5-2B is a full-stack practice of UltraData Tiered Data Management, covering three stages: base training, mid-training, and post-training.

During base training, the model goes through stable training and decay training to build core language capability and training stability. It then enters mid-training to further strengthen target capabilities and adapt to the target data distribution. The training corpus is released alongside the model as Ultra-FineWeb, Ultra-FineWeb-L3, UltraX, UltraData-Code and UltraData-Math.

During post-training, we proceed in three steps: SFT, RL, and OPD. We first use 400B tokens of deep-thinking SFT to establish deep-thinking and general chat abilities; the SFT data is released as UltraData-SFT-2605 and the Agent SFT data is released as UltraData-SFT-Agent-2609. We then train specialized RL teachers for math, code, agentic tasks, writing, and related domains (with the corresponding data also open-sourced as UltraData-RL-2609), and use On-Policy Distillation (OPD) to distill these teachers back into one release model.

MiniCPM5-2B Training Recipe

What does RL + OPD bring?

RL + OPD is a key part of MiniCPM5-2B post-training. During the RL stage, we adopted the critic-based algorithm described in JustRL II, substantially improving training stability and achieving significant gains across multiple domains. On the benchmarks listed below, RL + OPD improves reasoning and general capabilities by an average of ↑10.96 points, and agentic capabilities by ↑6.96 points.

OPD merges the capabilities of 16 expert models produced by RL training, including 5 agentic expert models. At each response position, we compute the full-vocabulary reverse KL divergence between student and teacher logits as the advantage estimate, replacing the original verification-based advantage. OPD directly reuses the prompts used to train each RL teacher as distillation data, so no additional corpus construction is required.

MiniCPM5-2B RL + OPD Gains

Introduction and Evaluation Results

Model Information

MiniCPM5-2B has the following features:

  • Type: Causal Language Model
  • Architecture: Standard LlamaForCausalLM
  • Number of Parameters: 2,516,756,480
  • Number of Non-Embedding Parameters: 1,981,982,720
  • Number of Layers: 42
  • Number of Attention Heads (GQA): 16 for Q and 2 for KV
  • Context Length: 131,072

Introduction

MiniCPM5-2B is the second model in the MiniCPM5 series. It is designed for local assistants, coding agents, tool-use workflows, and reasoning scenarios where a compact model is preferred. The model keeps a small deployment footprint while providing native long-context support.

Evaluation Results

We compare MiniCPM5-2B with strong open-source models in the same size class, including LFM2.5-2.6B, Qwen3.5-2B, and Gemma-4-E2B-it, while also listing larger models such as Qwen3.5-4B, granite-4.2-3B, Nemotron-3-Nano-4B, Gemma-4-E4B-it, and LFM2.5-8B-A1B for reference.

Within this comparison set, MiniCPM5-2B reaches 2B-class open-source SOTA with an average score of 53.9, and also exceeds all of the larger models included here (the highest is 51.1). Its advantages are most visible in code reasoning, math reasoning, long-context understanding, tool use, and multiple agentic tasks.

Model List (MiniCPM5 series)

Model List

Use this directory to choose the model format that matches your runtime:

MiniCPM5-2B

MiniCPM5-1B

(section continues in the model card)

Highlights (2B-class SOTA, open data)

Highlights

We are releasing MiniCPM5-2B, the second model in the MiniCPM5 series, following MiniCPM5-1B. It is a dense 2B Transformer that scales up the same training recipe, built for on-device, local deployment, and resource-constrained scenarios, reaching 2B-class open-source SOTA.

🏆 2B-class open-source SOTA: compared with strong open-source models of similar size, MiniCPM5-2B achieves SOTA performance within this comparison set. It remains competitive with 4B-class models overall, while showing its advantages over models of comparable size in coding, mathematics, long-context understanding, tool use, and agentic tasks.

📂 Open High-Quality Data: Alongside the model, we are releasing the high-quality training datasets behind it as part of the UltraData family: UltraX, a high-quality web pre-training dataset; UltraData-Code, featuring L0–L3 tiered code data management to drive a significant leap in coding capabilities; UltraData-SFT-Agent-2609, comprising 500K agent training samples to enhance comprehensive on-device agent capabilities; and UltraData-RL-2609, with 80K+ high-quality RL training samples covering mathematics, code, general knowledge, and long-context reasoning.

Architecture

Decoder Block input Embedding vocab 131K · d 2048 Full Attention GQA 16:2 · dₕ 128 ×42 Dense FFN silu · d 6144 Final Norm LM Head vocab 131K output
Attention
Grouped Query Attention (16:2)
Layers
42
Hidden size
2048
Context
131K tokens
RoPE θ
5M
Parameters
2516.8M

Source: Hugging Face config.json · LlamaForCausalLM · model repo

Type: LlamaForCausalLM
Attention: GQA
Decoder: standard
Layers 42
Context length 131K
Extended context 131K
Experts 1
Experts per token 1
Attention heads 16
KV heads 2
Hidden size 0
Expert FFN dim 0
Vision No
MTP No
RoPE dim 0

Training Pipeline

  1. 1
    pretraining

    Base Training (Stable + Decay)

    Base training with stable training and decay training phases to build core language capability and training stability. Uses Ultra-FineWeb, Ultra-FineWeb-L3, UltraX, UltraData-Code, and UltraData-Math corpora.

  2. 2
    sft

    Supervised Fine-Tuning (Deep-Thinking SFT)

    400B tokens of deep-thinking SFT to establish deep-thinking and general chat abilities. Uses UltraData-SFT-2605 and UltraData-SFT-Agent-2609 (500K agent samples).

  3. 3
    rl

    RL + On-Policy Distillation (OPD)

    RL training using critic-based algorithm (JustRL II) for improved stability. Specialized RL teachers for math, code, agentic tasks, writing. OPD merges 16 expert models (5 agentic) using full-vocabulary reverse KL divergence. Uses UltraData-RL-2609 (80K+ samples). RL + OPD improves reasoning by avg +10.96 points and agentic capabilities by +6.96 points.

Training & Evaluation Datasets

NameRoleSizeModalitiesCollection
UltraX-Preview pretraining — text —
UltraData-Code pretraining — text, code —
UltraData-SFT-2605 finetune 400B tokens text —
UltraData-SFT-Agent-2609 finetune 500K samples text —
UltraData-RL-2609 rl 80K+ samples text —
Ultra-FineWeb pretraining — text —

Related Models