> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siflow.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 示例

## Vllm

### 单机多 GPU

1. 配置 vllm 参数（例如 tp: 8）
2. 执行方式选择：单节点
3. 配置 worker 资源，每台机器最多 8 个 GPU

<img src="https://mintcdn.com/siflow/ntzNiCADsREJ4Kfh/products/siverse/media/llm/llm9.png?fit=max&auto=format&n=ntzNiCADsREJ4Kfh&q=85&s=f5d082ec115d464ee44381def6539410" alt="图片" width="2740" height="1426" data-path="products/siverse/media/llm/llm9.png" />

### 多机多 GPU

为 leader 和 worker 配置资源，最好保持资源一致（注意：leader 的数量等于副本数）

Vllm 参数：tp 8 pp 节点数

<img src="https://mintcdn.com/siflow/ntzNiCADsREJ4Kfh/products/siverse/media/llm/llm10.png?fit=max&auto=format&n=ntzNiCADsREJ4Kfh&q=85&s=5cdf54ff6591870a8f06000245a3facd" alt="图片" width="2698" height="1482" data-path="products/siverse/media/llm/llm10.png" />

### PD 分离

需要为 prefill、decode 和 server 配置资源。一般建议 server 使用 CPU，prefill 和 decode 各使用 8 个 GPU，并启用 RDMA

vLLM 参数：tp 8（prefill tp 8，decode tp 8）

<img src="https://mintcdn.com/siflow/ntzNiCADsREJ4Kfh/products/siverse/media/llm/llm11.png?fit=max&auto=format&n=ntzNiCADsREJ4Kfh&q=85&s=a9bdb0ab9fe52bc83a0e6822a44ab2e8" alt="图片" width="2712" height="1366" data-path="products/siverse/media/llm/llm11.png" />

## Dynamo

### Vllm Beckend 多机多 GPU

多节点多 GPU 推理的配置方式与 vLLM 类似

<img src="https://mintcdn.com/siflow/ntzNiCADsREJ4Kfh/products/siverse/media/llm/llm12.png?fit=max&auto=format&n=ntzNiCADsREJ4Kfh&q=85&s=03d2ab007ff9458b4368773345c01083" alt="图片" width="3022" height="1626" data-path="products/siverse/media/llm/llm12.png" />

## Sglang

<span style={{color:'red'}}>注意：默认端口为 30000</span>

### PD 分离

引擎选择：sglang，执行模式：pd-disaggregated

<img src="https://mintcdn.com/siflow/ntzNiCADsREJ4Kfh/products/siverse/media/llm/llm13.png?fit=max&auto=format&n=ntzNiCADsREJ4Kfh&q=85&s=fb99debc481536c016b58999be2b9a16" alt="图片" width="1438" height="738" data-path="products/siverse/media/llm/llm13.png" />

引擎参数为全局参数，将应用于所有 PD。如需单独设置，请在相应角色中修改其 args

Size：当 size > 1 时，表示分布式 prefill 或 decode。例如 decode size 为 2 时，每次 decode 操作涉及 2 个节点

Replicas：副本数，即 prefill 或 decode 实例的数量。例如 decode replica 为 2 且 size 为 2 时，共有 2 \* 2 = 4 个 decode 节点

健康检查及其它配置与其它框架一致

示例：DeepSeek v3.1 1p2d 分布式推理

<span style={{color:'red',fontWeight:'bold'}}>Decode 参数：</span>

```
--disaggregation-mode decode --chunked-prefill-size 20480 --page-size 64 --tp-size 16 --ep-size 16 --moe-dense-tp-size 1 --speculative-algorithm EAGLE --speculative-num-steps 1 --speculative-eagle-topk 1 --speculative-num-draft-tokens 2 --enable-dp-attention --enable-dp-lm-head --dp-size 8 --moe-a2a-backend deepep --deepep-mode low_latency --mem-fraction-static 0.85 --context-length 32768 --cuda-graph-max-bs 64 --max-running-requests 2048 --trust-remote-code --disaggregation-transfer-backend nixl --disaggregation-ib-device mlx5_0,mlx5_1,mlx5_2,mlx5_3,mlx5_4,mlx5_5,mlx5_6,mlx5_7 --watchdog-timeout 3600
```

<span style={{color:'red',fontWeight:'bold'}}>Prefill 参数：</span>

```
--disaggregation-mode prefill --chunked-prefill-size 20480 --page-size 64 --tp-size 8 --ep-size 8 --moe-dense-tp-size 1 --enable-dp-attention --enable-dp-lm-head --dp-size 2 --moe-a2a-backend deepep --deepep-mode normal --mem-fraction-static 0.85 --context-length 32768 --max-running-requests 2048 --trust-remote-code --disaggregation-transfer-backend nixl --disaggregation-ib-device mlx5_0,mlx5_1,mlx5_2,mlx5_3,mlx5_4,mlx5_5,mlx5_6,mlx5_7 --watchdog-timeout 3600
```

<img src="https://mintcdn.com/siflow/ntzNiCADsREJ4Kfh/products/siverse/media/llm/llm14.png?fit=max&auto=format&n=ntzNiCADsREJ4Kfh&q=85&s=ae235a0d8c354601fc597ce0b9b7199e" alt="图片" width="2858" height="1284" data-path="products/siverse/media/llm/llm14.png" />

## Custom

如果你想自定义角色的镜像或启动命令，请选择此引擎模式

1. 选择 custom 引擎类型

   1. 选择执行类型：

      单机：单节点多副本

      分布式：多节点多副本

      分布式模式下可用的环境变量：

   | Key                  | 说明                                 | 示例                                                                      | 适用于 |
   | -------------------- | ---------------------------------- | ----------------------------------------------------------------------- | --- |
   | LWS\_LEADER\_ADDRESS | 通过 headless service 访问 leader 的地址。 | leaderworkerset-multi-template-0.leaderworkerset-multi-template.default | Pod |
   | LWS\_GROUP\_SIZE     | 跟踪 LWS 组的大小。                       | 4                                                                       | Pod |
   | LWS\_WORKER\_INDEX   | Pod 在组内的索引或标识。                     | 2                                                                       | Pod |

   2. 填写角色镜像和启动命令

   <img src="https://mintcdn.com/siflow/ntzNiCADsREJ4Kfh/products/siverse/media/llm/llm15.png?fit=max&auto=format&n=ntzNiCADsREJ4Kfh&q=85&s=31f5a38709a99086cdd0870f8b8e859d" alt="图片" width="2112" height="1006" data-path="products/siverse/media/llm/llm15.png" />

其它配置与其它框架一致
