Instructions to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF", dtype="auto") - llama-cpp-python
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF", filename="baichuan-m2-32b-q4_k_m.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
Use Docker
docker model run hf.co/baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
- SGLang
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF 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 "baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF" \ --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": "baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF", "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 "baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF" \ --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": "baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with Ollama:
ollama run hf.co/baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
- Unsloth Studio
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF to start chatting
- Pi
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
Run Hermes
hermes
- Docker Model Runner
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with Docker Model Runner:
docker model run hf.co/baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
- Lemonade
How to use baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Baichuan-M2-32B-Q4_K_M-GGUF-Q4_K_M
List all available models
lemonade list
llm.create_chat_completion(
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
)Baichuan-M2-32B-Q4_K_M-GGUF
This repository contains the model presented in Baichuan-M2: Scaling Medical Capability with Large Verifier System.
🌟 Model Overview
Baichuan-M2-32B is Baichuan AI's medical-enhanced reasoning model, the second medical model released by Baichuan. Designed for real-world medical reasoning tasks, this model builds upon Qwen2.5-32B with an innovative Large Verifier System. Through domain-specific fine-tuning on real-world medical questions, it achieves breakthrough medical performance while maintaining strong general capabilities.
Model Features:
Baichuan-M2 incorporates three core technical innovations: First, through the Large Verifier System, it combines medical scenario characteristics to design a comprehensive medical verification framework, including patient simulators and multi-dimensional verification mechanisms; second, through medical domain adaptation enhancement via Mid-Training, it achieves lightweight and efficient medical domain adaptation while preserving general capabilities; finally, it employs a multi-stage reinforcement learning strategy, decomposing complex RL tasks into hierarchical training stages to progressively enhance the model's medical knowledge, reasoning, and patient interaction capabilities.
Core Highlights:
- 🏆 World's Leading Open-Source Medical Model: Outperforms all open-source models and many proprietary models on HealthBench, achieving medical capabilities closest to GPT-5
- 🧠 Doctor-Thinking Alignment: Trained on real clinical cases and patient simulators, with clinical diagnostic thinking and robust patient interaction capabilities
- ⚡ Efficient Deployment: Supports 4-bit quantization for single-RTX4090 deployment, with 58.5% higher token throughput in MTP version for single-user scenarios
📊 Performance Metrics
HealthBench Scores
| Model Name | HealthBench | HealthBench-Hard | HealthBench-Consensus |
|---|---|---|---|
| Baichuan-M2 | 60.1 | 34.7 | 91.5 |
| gpt-oss-120b | 57.6 | 30 | 90 |
| Qwen3-235B-A22B-Thinking-2507 | 55.2 | 25.9 | 90.6 |
| Deepseek-R1-0528 | 53.6 | 22.6 | 91.5 |
| GLM-4.5 | 47.8 | 18.7 | 85.3 |
| Kimi-K2 | 43 | 10.7 | 90.9 |
| gpt-oss-20b | 42.5 | 10.8 | 82.6 |
General Performance
| Benchmark | Baichuan-M2-32B | Qwen3-32B (Thinking) |
|---|---|---|
| AIME24 | 83.4 | 81.4 |
| AIME25 | 72.9 | 72.9 |
| Arena-Hard-v2.0 | 45.8 | 44.5 |
| CFBench | 77.6 | 75.7 |
| WritingBench | 8.56 | 7.90 |
Note: AIME uses max_tokens=64k, others use 32k; temperature=0.6 for all tests.
🔧 Technical Features
📗 Technical Blog: Blog - Baichuan-M2
📑 Technical Report: Arxiv - Baichuan-M2
Large Verifier System
- Patient Simulator: Virtual patient system based on real clinical cases
- Multi-Dimensional Verification: 8 dimensions including medical accuracy, response completeness, and follow-up awareness
- Dynamic Scoring: Real-time generation of adaptive evaluation criteria for complex clinical scenarios
Medical Domain Adaptation
- Mid-Training: Medical knowledge injection while preserving general capabilities
- Reinforcement Learning: Multi-stage RL strategy optimization
- General-Specialized Balance: Carefully balanced medical, general, and mathematical composite training data
⚙️ Quick Start
For deploying the Q4_K_M quantized model, you can use llama.cpp or ollama, please visit their website to get the specific operational steps for deploying the model. Taking ollama as an example.
- Ensure that Ollama is already installed
- Download the model: baichuan-m2-32b-q4_k_m.gguf
- Create and edit the Modelfile
FROM /path/to/baichuan-m2-32b-q4_k_m.gguf
TEMPLATE """{{- if .System -}}<<|im_start|>>system
{{ .System }}<<|im_end|>>
{{- end -}}
{{- range .Messages -}}
<<|im_start|>>{{ .Role }}
{{ .Content }}<<|im_end|>>
{{- end -}}
<<|im_start|>>assistant
"""
PARAMETER stop "<<|im_end|>>"
PARAMETER stop "<<|im_start|>>"
PARAMETER temperature 0.6
PARAMETER top_p 0.9
- Create the model in Ollama
ollama create baichuan-m2-q4km -f Modelfile
- Launch the model, and you can begin chatting with it
ollama run baichuan-m2-q4km
⚠️ Usage Notices
- Medical Disclaimer: For research and reference only; cannot replace professional medical diagnosis or treatment
- Intended Use Cases: Medical education, health consultation, clinical decision support
- Safe Use: Recommended under guidance of medical professionals
📄 License
Licensed under the Apache License 2.0. Research and commercial use permitted.
🤝 Acknowledgements
- Base Model: Qwen2.5-32B
- Training Framework: verl
- Inference Engines: vLLM, SGLang
- Quantization: AutoRound, GPTQ Thank you to the open-source community. We commit to continuous contribution and advancement of healthcare AI.
📞 Contact Us
- Resources: Baichuan AI Website
- Technical Support: GitHub
Empowering Healthcare with AI, Making Health Accessible to All
- Downloads last month
- 92
4-bit
Model tree for baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF
Base model
Qwen/Qwen2.5-32B
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="baichuan-inc/Baichuan-M2-32B-Q4_K_M-GGUF", filename="baichuan-m2-32b-q4_k_m.gguf", )