README.md 4.1 KB
Newer Older
shihm's avatar
shihm committed
1
# Baichuan-M3
shihm's avatar
shihm committed
2
## 论文
shihm's avatar
readme  
shihm committed
3
[Baichuan-M3: Modeling Clinical Inquiry for Reliable Medical Decision-Making](https://arxiv.org/abs/2602.06570)
shihm's avatar
shihm committed
4
5
6

## 模型简介
Baichuan-M3 是百川智能推出的全新一代医疗增强大语言模型,是继 Baichuan-M2 之后的重要里程碑。
shihm's avatar
shihm committed
7
8
9
10
11
12
与以往主要聚焦于静态问答或表面角色扮演的方法不同,Baichuan-M3 经过专门训练,能够显式建模 临床决策过程,旨在提升模型在真实医疗场景中的可用性与可靠性。该模型并非仅生成“听起来合理”的答案,或频繁给出诸如“你应尽快就医”等模糊建议,而是被训练为能够 主动获取关键临床信息、构建连贯的医学推理路径,并 系统性地约束易产生幻觉的行为。<br>
具有以下的亮点:<br>
超越 GPT-5.2:在 HealthBench、HealthBench-Hard、幻觉评估和 SCAN-bench 等多项指标上全面超越 OpenAI 最新模型,树立医疗 AI 新的 SOTA。<br>
高保真临床问诊能力:唯一在 SCAN-bench 全部三个维度(临床问诊、实验室检查、诊断)均排名第一的模型。<br>
低幻觉率,高可靠性:通过 Fact-Aware RL,在无外部工具辅助的情况下,幻觉率低于 GPT-5.2。<br>
 高效部署:W4 量化将内存占用降至原始的 26%;Gated Eagle3 推测解码实现 96% 的加速。<br>
shihm's avatar
shihm committed
13
14
15
16
17
18
19
20
21
22

## 环境依赖

|     软件     |                      版本                      |
| :----------: | :--------------------------------------------: |
|     DTK      |                    26.04.2                     |
|    python    |                    3.10.12                     |
| transformers |                     4.57.6                     |
|     vllm     | 0.11.0+das.opt1.rc2.dtk2604.20260128.g0bf89b0c | 

shihm's avatar
shihm committed
23
推荐使用镜像:harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-0130-py3.10-20260204
shihm's avatar
shihm committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

- 挂载地址`-v`根据实际模型情况修改

```bash
docker run -it \
    --shm-size 200g \
    --network=host \
    --name baichuan_m3 \
    --privileged \
    --device=/dev/kfd \
    --device=/dev/dri \
    --device=/dev/mkfd \
    --group-add video \
    --cap-add=SYS_PTRACE \
    --security-opt seccomp=unconfined \
    -u root \
    -v /opt/hyhal/:/opt/hyhal/:ro \
    -v /path/your_code_data/:/path/your_code_data/ \
shihm's avatar
shihm committed
42
    harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.11.0-ubuntu22.04-dtk26.04-0130-py3.10-20260204 bash
shihm's avatar
shihm committed
43
44
```
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。
shihm's avatar
shihm committed
45

shihm's avatar
shihm committed
46
47
48
49
50
51
52
53
54
55
56
57
58
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装。


## 数据集

`暂无`

## 训练

`暂无`

## 推理

shihm's avatar
shihm committed
59
60
61
### transformers
#### 单机推理
```bash
shihm's avatar
shihm committed
62
python inference.py
shihm's avatar
shihm committed
63
```
shihm's avatar
readme  
shihm committed
64
Transformers推理不支持Baichuan-M3-235B-GPTQ-INT4模型
shihm's avatar
shihm committed
65

shihm's avatar
shihm committed
66
67
### vllm

shihm's avatar
shihm committed
68
#### 单机推理
shihm's avatar
shihm committed
69
70
71

启动vllm server
```bash
shihm's avatar
readme  
shihm committed
72
73
74
75
76
77
vllm serve baichuan-inc/Baichuan-M3-235B \
    --reasoning-parser qwen3 \
    --tensor-parallel-size 8  \
    --trust-remote-code \
    --port 8000 \
    --gpu-memory-utilization 0.95 \
shihm's avatar
shihm committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
    --served-model-name baichuan-m3 
```
启动完成后可通过以下方式访问:
```bash
curl http://localhost:8000/v1/chat/completions   \
    -H "Content-Type: application/json"  \
    -d '{
        "model": "baichuan-m3",
        "messages": [
            {
                "role": "user",
                "content": "下午头痛怎么办?"
            }
        ]
}'
```
## 效果展示
<div align=center>
shihm's avatar
updata  
shihm committed
96
    <img src="./doc/result.png"/>
shihm's avatar
shihm committed
97
98
99
100
101
102
</div>





shihm's avatar
shihm committed
103
### 精度
shihm's avatar
shihm committed
104
`DCU与GPU精度一致,推理框架:transformers,vllm`
shihm's avatar
shihm committed
105
106
107
108

## 预训练权重
| 模型名称  | 权重大小  | DCU型号  | 最低卡数需求 |下载地址|
|:-----:|:----------:|:----------:|:---------------------:|:----------:|
shihm's avatar
shihm committed
109
| Baichuan-M3-235B | 235B | BW1000  | 8  | [Modelscope](https://modelscope.cn/models/baichuan-inc/Baichuan-M3-235B) |
shihm's avatar
shihm committed
110
| Baichuan-M3-235B-GPTQ-INT4 | 235B | BW1000  | 4  | [Modelscope](https://modelscope.cn/models/baichuan-inc/Baichuan-M3-235B-GPTQ-INT4) |
shihm's avatar
shihm committed
111

shihm's avatar
shihm committed
112
## 源码仓库及问题反馈
shihm's avatar
readme  
shihm committed
113
- https://developer.sourcefind.cn/codes/modelzoo/baichuan-m3_pytorch
shihm's avatar
shihm committed
114

shihm's avatar
shihm committed
115
116
## 参考资料
- https://www.baichuan-ai.com/blog/baichuan-M3