baichuan-inc/Baichuan-M2-32B
模型介绍文件和版本Pull Requests讨论分析
下载使用量0

Baichuan-M2-32B

本仓库包含在论文Baichuan-M2: Scaling Medical Capability with Large Verifier System中提出的模型。

许可证 Hugging Face M2 GPTQ-4bit Huawei Ascend 8bit

🌟 模型概述

Baichuan-M2-32B是百川智能推出的医疗增强推理模型,是百川发布的第二款医疗模型。该模型专为实际医疗推理任务设计,基于Qwen2.5-32B构建,并创新性地引入了大型验证系统(Large Verifier System)。通过针对真实世界医疗问题的领域特定微调,在保持强大通用能力的同时,实现了突破性的医疗性能。

模型特点:

Baichuan-M2包含三项核心技术创新:首先,通过大型验证系统,结合医疗场景特点设计了全面的医疗验证框架,包括患者模拟器和多维度验证机制;其次,通过中期训练(Mid-Training)进行医疗领域适配增强,在保留通用能力的同时实现轻量级高效的医疗领域适配;最后,采用多阶段强化学习策略,将复杂的强化学习任务分解为分层训练阶段,逐步提升模型的医疗知识、推理和患者交互能力。

核心亮点:

  • 🏆 全球领先的开源医疗模型:在HealthBench上超越所有开源模型及众多闭源模型,医疗能力最接近GPT-5
  • 🧠 医生思维对齐:基于真实临床病例和患者模拟器训练,具备临床诊断思维和稳健的患者交互能力
  • ⚡ 高效部署:支持4比特量化,可在单RTX4090上部署;MTP版本在单用户场景下的token吞吐量提升58.5%

📊 性能指标

HealthBench 得分

模型名称HealthBenchHealthBench-HardHealthBench-Consensus
Baichuan-M260.134.791.5
gpt-oss-120b57.63090
Qwen3-235B-A22B-Thinking-250755.225.990.6
Deepseek-R1-052853.622.691.5
GLM-4.547.818.785.3
Kimi-K24310.790.9
gpt-oss-20b42.510.882.6

综合性能

基准测试Baichuan-M2-32BQwen3-32B (Thinking)
AIME2483.481.4
AIME2572.972.9
Arena-Hard-v2.045.844.5
CFBench77.675.7
WritingBench8.567.90

注:AIME 使用 max_tokens=64k,其他使用 32k;所有测试的 temperature=0.6。

🔧 技术特点

📗 技术博客:Blog - Baichuan-M2

📑 技术报告:Arxiv - Baichuan-M2

大型验证系统

  • 患者模拟器:基于真实临床病例的虚拟患者系统
  • 多维度验证:涵盖医疗准确性、回答完整性、随访意识等8个维度
  • 动态评分:针对复杂临床场景实时生成自适应评估标准

医疗领域适配

  • 中期训练:在保留通用能力的同时注入医疗知识
  • 强化学习:多阶段RL策略优化
  • 通用-专业平衡:精心平衡医疗、通用及数学复合训练数据

⚙️ 快速开始

# 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 端点:

  • SGLang:
    python -m sglang.launch_server --model-path baichuan-inc/Baichuan-M2-32B --reasoning-parser qwen3
  • vLLM:
    vllm serve baichuan-inc/Baichuan-M2-32B  --reasoning-parser qwen3

使用 SGLang 进行 MTP 推理

  1. 将 sglang 安装目录下的 qwen2.py 文件替换为 draft/qwen2.py。
  2. 启动 sglang:
python3 -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

⚠️ 使用须知

  1. 医疗免责声明:仅供研究和参考使用,不能替代专业的医疗诊断或治疗
  2. 预期使用场景:医学教育、健康咨询、临床决策支持
  3. 安全使用:建议在医疗专业人员的指导下使用

📄 许可证

基于 Apache License 2.0 许可。允许研究和商业使用。

🤝 致谢

  • 基础模型:Qwen2.5-32B
  • 训练框架: verl
  • 推理引擎:vLLM、SGLang
  • 量化:AutoRound、GPTQ 感谢开源社区。我们致力于持续贡献并推动医疗健康人工智能的发展。

📞 联系我们

  • 资源:百川智能官网
  • 技术支持:GitHub

用人工智能赋能医疗健康,让健康触手可及