yy-fighting 19d336de08 feat: add max context length exploration experiment
- New experiments/dsv4_h200_max_context_length/
- start_sglang.sh / start_vllm.sh accept target length as argument
- run_bench.sh tests a ladder of input lengths (default 64k -> 1M)
  with --random-range-ratio 1.0 for exact length
- extract_metrics.py + parse_results.py produce results.json + report.md
- README.md documents usage and control variables
- Root README updated with entry and quick command
2026-07-08 08:35:56 +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 H200 最大上下文长度探索实验
在 8x NVIDIA H200 上,逐步增大输入长度,测试 **SGLang****vLLM** serving DeepSeek-V4-Flash 时各自能稳定处理的最长上下文。
## 目的
- 找到 SGLang / vLLM 在 H200 TP=8 配置下,单请求最多能支持多长的输入 token。
- 每个长度只跑 1 个请求、输出 1 个 token尽量减少 decode 阶段显存干扰。
- 每次测试单独启动 server并把 `max-model-len` / `context-length` 刚好设为 `target_len + 1024`,避免预分配过大。
## 默认候选长度
```text
65536, 131072, 262144, 393216, 524288, 655360, 786432, 917504, 1048576
```
可以通过环境变量覆盖:
```bash
CANDIDATE_LENS=(65536 131072 262144 524288) bash run_bench.sh
```
## 控制变量
| 维度 | SGLang | vLLM |
|---|---|---|
| 硬件 | 8x H200TP=8 | 同上 |
| 输入长度 | `--random-input-len $target_len --random-range-ratio 1.0` | 同上 |
| 输出长度 | 1 | 1 |
| 并发 / 请求数 | 1 / 1 | 1 / 1 |
| 压测客户端 | `sglang.bench_serving --backend vllm` | 同上 |
> `--random-range-ratio 1.0` 确保输入长度固定为 `target_len`,而不是默认的 `[1, target_len]` 均匀分布。
## 快速运行
```bash
bash experiments/dsv4_h200_max_context_length/run_bench.sh
```
结果保存在 `experiments/dsv4_h200_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`:汇总表格,以及每个 backend 最终支持的最大输入长度。
## 环境
- SGLM server: `/data/user1/yy/envs/sglang`
- vLLM server: `/data/user1/yy/envs/vllm`
- Benchmark client: `/data/user1/yy/envs/sglang`