Instructions to use eshiryae/MiniCPM4-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eshiryae/MiniCPM4-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="eshiryae/MiniCPM4-8B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("eshiryae/MiniCPM4-8B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use eshiryae/MiniCPM4-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eshiryae/MiniCPM4-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eshiryae/MiniCPM4-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/eshiryae/MiniCPM4-8B
- SGLang
How to use eshiryae/MiniCPM4-8B 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 "eshiryae/MiniCPM4-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eshiryae/MiniCPM4-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "eshiryae/MiniCPM4-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eshiryae/MiniCPM4-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use eshiryae/MiniCPM4-8B with Docker Model Runner:
docker model run hf.co/eshiryae/MiniCPM4-8B
|
Download README.md from eshiryae/MiniCPM4-8B: direct link, hf CLI and curl.
- Browser
- Download file 6.04 kB
-
https://huggingface.co/eshiryae/MiniCPM4-8B/resolve/fc30c3283e75c64a6ea44ea2f477e23820b5d445/README.md
- Command line
-
hf download hf://eshiryae/MiniCPM4-8B@fc30c3283e75c64a6ea44ea2f477e23820b5d445/README.md
-
curl -L -o README.md https://huggingface.co/eshiryae/MiniCPM4-8B/resolve/fc30c3283e75c64a6ea44ea2f477e23820b5d445/README.md
6.04 kB
| license: apache-2.0 | |
| language: | |
| - zh | |
| - en | |
| pipeline_tag: text-generation | |
| library_name: transformers | |
| <div align="center"> | |
| <img src="https://github.com/OpenBMB/MiniCPM/blob/main/assets/minicpm_logo.png?raw=true" width="500em" ></img> | |
| </div> | |
| <p align="center"> | |
| <a href="https://github.com/OpenBMB/MiniCPM/" target="_blank">GitHub Repo</a> | | |
| <a href="" target="_blank">Technical Report</a> | |
| </p> | |
| <p align="center"> | |
| π Join us on <a href="https://discord.gg/3cGQn9b3YM" target="_blank">Discord</a> and <a href="https://github.com/OpenBMB/MiniCPM/blob/main/assets/wechat.jpg" target="_blank">WeChat</a> | |
| </p> | |
| ## What's New | |
| - [2025.06.06] **MiniCPM4** series are released! This model achieves ultimate efficiency improvements while maintaining optimal performance at the same scale! It can achieve over 5x generation acceleration on typical end-side chips! You can find technical report on [arXiv]().π₯π₯π₯ | |
| ## MiniCPM4 Series | |
| - [MiniCPM4-0.5B](https://huggingface.co/openbmb/MiniCPM4-0.5B): TODO | |
| - [MiniCPM4-8B](https://huggingface.co/openbmb/MiniCPM4-8B): TODO **<-- you are here** | |
| - [MiniCPM4-8B-Eagle-FRSpec](https://huggingface.co/openbmb/MiniCPM4-8B-Eagle-FRSpec) | |
| - [MiniCPM4-8B-Eagle-FRSpec-QAT](https://huggingface.co/openbmb/MiniCPM4-8B-Eagle-FRSpec-QAT) | |
| - [BitCPM4-0.5B](https://huggingface.co/openbmb/BitCPM4-0.5B): TODO | |
| - [BitCPM4-1B](https://huggingface.co/openbmb/BitCPM4-1B): TODO | |
| - [MiniCPM4-Survey](https://huggingface.co/openbmb/MiniCPM4-Survey): TODO | |
| - [MiniCPM4-MCP](https://huggingface.co/openbmb/MiniCPM4-MCP): TODO | |
| ## Introduction | |
| MiniCPM 4 is an extremely efficient edge-side large model that has undergone efficient optimization across four dimensions: model architecture, learning algorithms, training data, and inference systems, achieving ultimate efficiency improvements. | |
| - ποΈ **Efficient Model Architecture:** | |
| - InfLLM v2 -- Trainable Sparse Attention Mechanism: Adopts a trainable sparse attention mechanism architecture where each token only needs to compute relevance with less than 5% of tokens in 128K long text processing, significantly reducing computational overhead for long texts | |
| - π§ **Efficient Learning Algorithms:** | |
| - Model Wind Tunnel 2.0 -- Efficient Predictable Scaling: Introduces scaling prediction methods for performance of downstream tasks, enabling more precise model training configuration search | |
| - BitCPM -- Ultimate Ternary Quantization: Compresses model parameter bit-width to 3 values, achieving 90% extreme model bit-width reduction | |
| - Efficient Training Engineering Optimization: Adopts FP8 low-precision computing technology combined with Multi-token Prediction training strategy | |
| - π **High-Quality Training Data:** | |
| - UltraClean -- High-quality Pre-training Data Filtering and Generation: Builds iterative data cleaning strategies based on efficient data verification, open-sourcing high-quality Chinese and English pre-training dataset [UltraFinweb](https://huggingface.co/datasets/openbmb/Ultra-FineWeb) | |
| - UltraChat v2 -- High-quality Supervised Fine-tuning Data Generation: Constructs large-scale high-quality supervised fine-tuning datasets covering multiple dimensions including knowledge-intensive data, reasoning-intensive data, instruction-following data, long text understanding data, and tool calling data | |
| - β‘ **Efficient Inference System:** | |
| - FRSpec -- Lightweight Speculative Sampling: Achieves draft model acceleration through vocabulary pruning of draft model | |
| - ArkInfer -- Cross-platform Deployment System: Supports efficient deployment across multiple backend environments, providing flexible cross-platform adaptation capabilities | |
| ## Usage | |
| ### Inference with Transformers | |
| ### Inference with [vLLM](https://github.com/vllm-project/vllm) | |
| ## Evaluation Results | |
| On two typical end-side chips, Jetson AGX Orin and RTX 4090, MiniCPM4 demonstrates significantly faster processing speed compared to similar-size models in long text processing tasks. As text length increases, MiniCPM4's efficiency advantage becomes more pronounced. On the Jetson AGX Orin platform, compared to Qwen3-8B, MiniCPM4 achieves approximately 7x decoding speed improvement. | |
|  | |
| #### Comprehensive Evaluation | |
| MiniCPM4 launches end-side versions with 8B and 0.5B parameter scales, both achieving best-in-class performance in their respective categories. | |
|  | |
| #### Long Text Evaluation | |
| MiniCPM4 is pre-trained on 32K long texts and achieves length extension through YaRN technology. In the 128K long text needle-in-a-haystack task, MiniCPM4 demonstrates outstanding performance. | |
|  | |
| ## Statement | |
| - As a language model, MiniCPM generates content by learning from a vast amount of text. | |
| - However, it does not possess the ability to comprehend or express personal opinions or value judgments. | |
| - Any content generated by MiniCPM does not represent the viewpoints or positions of the model developers. | |
| - Therefore, when using content generated by MiniCPM, users should take full responsibility for evaluating and verifying it on their own. | |
| ## LICENSE | |
| - This repository is released under the [Apache-2.0](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE) License. | |
| - The usage of MiniCPM model weights must strictly follow [MiniCPM Model License](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md). | |
| - The models and weights of MiniCPM are completely free for academic research. after filling out a [questionnaire](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g) for registration, are also available for free commercial use. | |
| ## Citation | |
| - Please cite our [paper](TODO) if you find our work valuable. | |
| ```bibtex | |
| TODO | |
| ``` | |