README.md 6.2 KB
Newer Older
luopl's avatar
luopl committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Step-3.5-Flash
## 论文
[Step-3.5-Flash](https://arxiv.org/pdf/2602.10604)

## 模型简介

Step 3.5 Flash专为极致效率而生,具备前沿的推理能力和卓越的智能体(Agent)性能。该模型基于稀疏混合专家(MoE)架构,拥有 1960 亿参数,但处理每个 Token 时仅需选择性激活 110 亿参数。这种极高的“智能密度”使其推理深度足以媲美顶级闭源模型,同时兼顾了实时交互所需的敏捷响应速度。

**其核心能力包括**

1.兼具前沿智能与极速响应: 聊天机器人重在“读”,而智能体必须快在“想”。得益于三路多Token预测( MTP-3)技术,Step 3.5 Flash 在典型场景下的生成吞吐量可达 100–300 tok/s(单流代码任务峰值可达 350 tok/s)。复杂多步骤的推理链也能实现即时响应。

2.代码与智能体的稳健引擎: Step 3.5 Flash 专为智能体任务打造,集成了可扩展的强化学习(RL)框架,驱动模型持续自我进化。它在 SWE-bench Verified 分数达到74.4%,在 Terminal-Bench 2.0 测试中分数达 51.0%,证明了其在处理复杂、长程任务时坚如磐石的稳定性。

3.高效的长上下文处理: Step 3.5 Flash采用 3:1 的滑动窗口注意力(SWA)比例 (即每层全注意力层搭配三层 SWA 层),该模型支持极具成本效益的 256K 上下文窗口。这种混合机制确保了在处理海量数据或超长代码库时性能不减,同时显著降低了传统长上下文模型常见的计算开销。

4.便捷的本地部署: Step 3.5 Flash 专为易用性优化,将高性能推理带入本地环境。用户在高端消费级硬件(如 Mac Studio M4 Max, NVIDIA DGX Spark)上即可部署,在确保数据隐私的同时,性能毫不妥协。

Step 3.5 Flash 在推理、编程和智能体能力三个维度的性能表现。左侧开源模型按总参数量排序,右侧则列出了顶尖的闭源模型。为确保一致性,xbench-DeepSearch 的分数均取自官方发布数据。图中的阴影部分展示了 Step 3.5 Flash 启用“并行思考 (Parallel Thinking)”后的性能提升。

<div align=center>
    <img src="./doc/step-bar-chart.png"/>
</div>

## 环境依赖
| 软件 |                    版本                     |
| :------: |:-----------------------------------------:|
| DTK |                   26.04                   |
| python |                  3.10.12                  |
| transformers |                4.57.6                 |
| vllm |       0.15.1+das.opt1.alpha.dtk2604.20260220.g2799735a       |
| triton | 3.3.0+das.opt2.dtk2604.torch291.20260210.g1329924c |
| torch | 2.9.0+das.opt1.dtk2604.20260206.g275d08c2 |

当前仅支持以下镜像: harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220



- 挂载地址`-v` 根据实际模型情况修改
```bash
docker run -it \
    --shm-size 200g \
    --network=host \
    --name Step-3.5-Flash \
    --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/ \
    harbor.sourcefind.cn:5443/dcu/admin/base/custom:vllm0.15.1-ubuntu22.04-dtk26.04-0130-py3.10-20260220 bash
```
更多镜像可前往[光源](https://sourcefind.cn/#/service-list)下载使用。

luopl's avatar
luopl committed
59
关于本项目DCU显卡所需的特殊深度学习库可从[光合](https://developer.sourcefind.cn/tool/)开发者社区下载安装,pycountry需要单独安装,lmslim库需卸载重装:
luopl's avatar
luopl committed
60
61
```
pip install pycountry
luopl's avatar
luopl committed
62
63
pip uninstall lmslim
pip install lmslim-0.3.1+das.opt4.dtk2604-cp310-cp310-linux_x86_64.whl --no-deps
luopl's avatar
luopl committed
64
65
66
67
68
69
70
71
72
73
74
75
```

## 数据集
暂无

## 训练
暂无

## 推理
### vllm
#### 单机推理

luopl's avatar
luopl committed
76
**1. Step-3.5-Flash模型推理:**
luopl's avatar
luopl committed
77
78
79
80
```bash
## serve启动
vllm serve stepfun-ai/Step-3.5-Flash \
    --port 8001 \
luopl's avatar
luopl committed
81
    --tensor-parallel-size 4 \
luopl's avatar
luopl committed
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
    --enable-expert-parallel \
    --disable-cascade-attn \
    --reasoning-parser step3p5 \
    --enable-auto-tool-choice \
    --tool-call-parser step3p5 \
    --hf-overrides '{"num_nextn_predict_layers": 1}' \
    --speculative_config '{"method": "step3p5_mtp", "num_speculative_tokens": 1}' \
    --trust-remote-code 

## client访问
curl http://localhost:8001/v1/chat/completions   \
    -H "Content-Type: application/json"  \
    -d '{
        "model": "stepfun-ai/Step-3.5-Flash",
        "messages": [
            {
                "role": "user",
                "content": "牛顿提出了哪三大运动定律?请简要说明。"
            }
        ]
    }'
```

luopl's avatar
luopl committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
**2. Step-3.5-Flash-FP8模型推理:**
```bash
## serve启动
vllm serve stepfun-ai/Step-3.5-Flash-FP8 \
  --port 8001 \
  --tensor-parallel-size 2 \
  --enable-expert-parallel \
  --disable-cascade-attn \
  --reasoning-parser step3p5 \
  --enable-auto-tool-choice \
  --tool-call-parser step3p5 \
  --hf-overrides '{"num_nextn_predict_layers": 1}' \
  --speculative_config '{"method": "step3p5_mtp", "num_speculative_tokens": 1}' \
  --trust-remote-code \
  --quantization fp8 \
  --compilation-config '{"pass_config": {"fuse_act_quant": false}}'



## client访问
curl http://localhost:8001/v1/chat/completions   \
    -H "Content-Type: application/json"  \
    -d '{
        "model": "stepfun-ai/Step-3.5-Flash-FP8",
        "messages": [
            {
                "role": "user",
                "content": "牛顿提出了哪三大运动定律?请简要说明。"
            }
        ]
    }'
```
luopl's avatar
luopl committed
137
138
139
140
141
142
143
144
145
146
## 效果展示
<div align=center>
    <img src="./doc/result-dcu.png"/>
</div>

### 精度
DCU与GPU精度一致,推理框架:vllm。

## 预训练权重
|  模型名称  | 权重大小 | DCU型号  | 最低卡数需求 |         下载地址          |
luopl's avatar
luopl committed
147
148
149
|:------:|:----:|:------:|:------:|:---------------------:|
| Step-3.5-Flash | 199B | BW1100 |   4    | [Hugging Face](https://huggingface.co/stepfun-ai/Step-3.5-Flash) |
| Step-3.5-Flash-FP8 | 199B | BW1100 |   2    | [Hugging Face](https://huggingface.co/stepfun-ai/Step-3.5-Flash-FP8) |
luopl's avatar
luopl committed
150
151
152
153
154
155

## 源码仓库及问题反馈
- https://developer.sourcefind.cn/codes/modelzoo/step-3.5-flash_vllm

## 参考资料
- https://github.com/stepfun-ai/Step-3.5-Flash