Quantong Qiu 3694614dd9 feat(p800): add max context length exploration experiment
Add experiments/dsv4_p800_max_context_length/ to find the longest input
context that P800 SGLang INT8 can serve for DeepSeek-V4-Flash-INT8.

- Docker-based server start with dynamic --context-length.
- Single-request, single-output-token probes for each candidate length.
- Records success/failure, server args, and metrics per length.
- Generates results.json and report.md summarizing the max supported length.
- Smoke-tested at 4096 tokens successfully.
2026-07-09 03:30:09 +00:00

60 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# DSV4 P800 最大上下文长度探索实验
在 8x Kunlun P800 XPU 上,逐步增大输入长度,测试 SGLang serving `DeepSeek-V4-Flash-INT8` 时能稳定处理的最长上下文。
## 目的
- 找到 P800 + SGLang INT8 在 TP=8 配置下,单请求最多能支持多长的输入 token。
- 每个长度只跑 1 个请求、输出 1 个 token尽量减少 decode 阶段显存干扰。
- 每次测试单独启动 server并把 `context-length` 刚好设为 `target_len + CONTEXT_PAD`,避免预分配过大。
## 默认候选长度
```text
4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288
```
可以通过环境变量覆盖:
```bash
CANDIDATE_LENS=(4096 8192 16384) bash run_bench.sh
```
## 控制变量
| 维度 | 配置 |
|---|---|
| 硬件 | 8x Kunlun P800 XPUTP=8 |
| 模型 | `DeepSeek-V4-Flash-INT8``w8a8_int8` |
| 输入长度 | `--random-input-len $target_len --random-range-ratio 1.0` |
| 输出长度 | 1 |
| 并发 / 请求数 | 1 / 1 |
| 压测客户端 | 容器内 `sglang.bench_serving --backend sglang` |
> `--random-range-ratio 1.0` 确保输入长度固定为 `target_len`,而不是默认的 `[1, target_len]` 均匀分布。
## 快速运行
```bash
bash experiments/dsv4_p800_max_context_length/run_bench.sh
```
结果保存在 `experiments/dsv4_p800_max_context_length/results/<RUN_ID>/`
```
results/<RUN_ID>/
├── results.json
├── report.md
└── raw_outputs/ # gitignored
```
## 产物说明
- `results.json`:每个候选长度的尝试记录,包括 `success`、TTFT/TPOT/E2E 指标、`server_args`
- `report.md`:汇总表格,以及 SGLang INT8 最终支持的最大输入长度。
## 环境
- Docker image: `iregistry.baidu-int.com/xpu/sglang-p800-pd-disagg-0510:20260511_4202`
- Container Python: `/root/miniconda/envs/python310_torch25_cuda/bin/python`