本仓库包含在论文Baichuan-M2: Scaling Medical Capability with Large Verifier System中提出的模型。
Baichuan-M2-32B是百川智能推出的医疗增强推理模型,是百川发布的第二款医疗模型。该模型专为实际医疗推理任务设计,基于Qwen2.5-32B构建,并创新性地引入了大型验证系统(Large Verifier System)。通过针对真实世界医疗问题的领域特定微调,在保持强大通用能力的同时,实现了突破性的医疗性能。
模型特点:
Baichuan-M2包含三项核心技术创新:首先,通过大型验证系统,结合医疗场景特点设计了全面的医疗验证框架,包括患者模拟器和多维度验证机制;其次,通过中期训练(Mid-Training)进行医疗领域适配增强,在保留通用能力的同时实现轻量级高效的医疗领域适配;最后,采用多阶段强化学习策略,将复杂的强化学习任务分解为分层训练阶段,逐步提升模型的医疗知识、推理和患者交互能力。
核心亮点:
| 模型名称 | 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 |
| 基准测试 | 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 |
注:AIME 使用 max_tokens=64k,其他使用 32k;所有测试的 temperature=0.6。
📗 技术博客:Blog - Baichuan-M2
📑 技术报告:Arxiv - Baichuan-M2
# 1. load model
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("baichuan-inc/Baichuan-M2-32B", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("baichuan-inc/Baichuan-M2-32B")
# 2. Input prompt text
prompt = "Got a big swelling after a bug bite. Need help reducing it."
# 3. Encode the input text for the model
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
thinking_mode='on' # on/off/auto
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
# 4. Generate text
generated_ids = model.generate(
**model_inputs,
max_new_tokens=4096
)
output_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
][0].tolist()
# 5. parsing thinking content
try:
# rindex finding 151668 (</think>)
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("
")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("
")
print("thinking content:", thinking_content)
print("content:", content)
在部署方面,您可以使用 sglang>=0.4.6.post1 或 vllm>=0.9.0 来创建兼容 OpenAI 的 API 端点:
python -m sglang.launch_server --model-path baichuan-inc/Baichuan-M2-32B --reasoning-parser qwen3vllm serve baichuan-inc/Baichuan-M2-32B --reasoning-parser qwen3python3 -m sglang.launch_server \
--model Baichuan-M2-32B \
--speculative-algorithm EAGLE3 \
--speculative-draft-model-path Baichuan-M2-32B/draft \
--speculative-num-steps 6 \
--speculative-eagle-topk 10 \
--speculative-num-draft-tokens 32 \
--mem-fraction 0.9 \
--cuda-graph-max-bs 2 \
--reasoning-parser qwen3 \
--dtype bfloat16基于 Apache License 2.0 许可。允许研究和商业使用。
用人工智能赋能医疗健康,让健康触手可及