Text Generation
Transformers
Safetensors
English
Chinese
qwen3
minicpm
minicpm5
llama
long-context
tool-calling
on-device
edge-ai
custom_code
text-generation-inference
Instructions to use ArchiveStudio/MiniCPM5-2B-DSpark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ArchiveStudio/MiniCPM5-2B-DSpark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ArchiveStudio/MiniCPM5-2B-DSpark", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("ArchiveStudio/MiniCPM5-2B-DSpark", trust_remote_code=True) model = AutoModel.from_pretrained("ArchiveStudio/MiniCPM5-2B-DSpark", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ArchiveStudio/MiniCPM5-2B-DSpark with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ArchiveStudio/MiniCPM5-2B-DSpark" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ArchiveStudio/MiniCPM5-2B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ArchiveStudio/MiniCPM5-2B-DSpark
- SGLang
How to use ArchiveStudio/MiniCPM5-2B-DSpark 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 "ArchiveStudio/MiniCPM5-2B-DSpark" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ArchiveStudio/MiniCPM5-2B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "ArchiveStudio/MiniCPM5-2B-DSpark" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ArchiveStudio/MiniCPM5-2B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ArchiveStudio/MiniCPM5-2B-DSpark with Docker Model Runner:
docker model run hf.co/ArchiveStudio/MiniCPM5-2B-DSpark
|
Download README.md from ArchiveStudio/MiniCPM5-2B-DSpark: direct link, hf CLI and curl.
- Browser
- Download file 4.09 kB
-
https://huggingface.co/ArchiveStudio/MiniCPM5-2B-DSpark/resolve/main/README.md
- Command line
-
hf download hf://ArchiveStudio/MiniCPM5-2B-DSpark/README.md
-
curl -L -o README.md https://huggingface.co/ArchiveStudio/MiniCPM5-2B-DSpark/resolve/main/README.md
4.09 kB
| license: apache-2.0 | |
| language: | |
| - en | |
| - zh | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| tags: | |
| - minicpm | |
| - minicpm5 | |
| - llama | |
| - text-generation | |
| - long-context | |
| - tool-calling | |
| - on-device | |
| - edge-ai | |
| datasets: | |
| - openbmb/Ultra-FineWeb | |
| - openbmb/UltraX-Preview | |
| - openbmb/Ultra-FineWeb-L3 | |
| - openbmb/UltraData-Math | |
| - openbmb/UltraData-Code | |
| - openbmb/UltraData-SFT-2605 | |
| - openbmb/UltraData-SFT-Agent-2609 | |
| - openbmb/UltraData-RL-2609 | |
| <div align="center"> | |
| <img src="https://raw.githubusercontent.com/OpenBMB/MiniCPM/main/assets/minicpm_logo.png" width="500em" /> | |
| </div> | |
| <p align="center"> | |
| <a href="https://arxiv.org/pdf/2506.07900" target="_blank">MiniCPM Tech Report</a> | | |
| <a href="https://modelbest.feishu.cn/wiki/UtWxwcERfiRIpIkBOjuc3h9tn1D" target="_blank">MiniCPM Wiki(Chinese)</a> | | |
| <a href="https://github.com/OpenBMB/MiniCPM" target="_blank">GitHub Repo</a> | | |
| <a href="https://ultradata.openbmb.cn/" target="_blank">UltraData</a> | | |
| <a href="https://huggingface.co/spaces/openbmb/MiniCPM5-2B-Demo" target="_blank">Online Demo</a> | |
| </p> | |
| <p align="center"> | |
| English | | |
| <a href="https://huggingface.co/openbmb/MiniCPM5-2B/blob/main/README-cn.md" target="_blank">中文</a> | |
| </p> | |
| # MiniCPM5-2B-DSpark | |
| `MiniCPM5-2B-DSpark` is a [DSpark](https://arxiv.org/abs/2607.05147) | |
| draft checkpoint trained for exact pairing with [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) and its | |
| tokenizer. | |
| ## Model Specification | |
| | Property | Value | | |
| |---|---| | |
| | Target model | [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) | | |
| | Draft layers | 5 | | |
| | Draft parameters | 323,776,001 | | |
| | Draft tokens per forward pass | 7 | | |
| | Target hidden-state layers | `[1, 10, 20, 30, 39]` | | |
| | Checkpoint precision | BF16 | | |
| ## Training Recipe | |
| Training responses were generated by [MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) from a mixture of | |
| general-domain, mathematics, and code prompts. | |
| | Setting | Value | | |
| |---|---| | |
| | Training sequences | 1,959,525 | | |
| | Training tokens | 7,054,154,509 | | |
| | Epochs | 6 | | |
| | Maximum sequence length | 12,288 | | |
| | Optimizer | AdamW | | |
| | Objective | CE + L1 + confidence loss | | |
| ## Evaluation | |
| Acceptance length is defined as the total number of completion tokens divided | |
| by the total number of speculative verification steps. Evaluation uses natural | |
| EOS termination and `max_new_tokens=4096`. | |
| | Domain | `T=0` | `T=1.0` | | |
| |---|---:|---:| | |
| | Math | 6.0496 | 4.6050 | | |
| | Code | 6.1106 | 4.4381 | | |
| | General | 4.1585 | 3.0997 | | |
| | Aggregate | **5.5174** | **4.0514** | | |
| ## Usage with SGLang | |
| ```bash | |
| python -m sglang.launch_server \ | |
| --model-path <target-model-path> \ | |
| --trust-remote-code \ | |
| --speculative-algorithm DSPARK \ | |
| --speculative-draft-model-path <draft-model-path> \ | |
| --speculative-dspark-block-size 7 | |
| ``` | |
| ## 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. | |
| ## License | |
| This repository and MiniCPM model weights are released under the [Apache-2.0](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE) License. | |
| ## Citation | |
| Please cite our paper if you find our work valuable: | |
| ```bibtex | |
| @article{minicpm4, | |
| title={Minicpm4: Ultra-efficient llms on end devices}, | |
| author={MiniCPM, Team}, | |
| journal={arXiv preprint arXiv:2506.07900}, | |
| year={2025} | |
| } | |
| ``` | |