Sglang profile analyse

From HYGON-AI/sglang-das · View interactive version

Sglang profile analyse is an AI agent skill from the GitHub repository HYGON-AI/sglang-das. Analyze SGLang model serving performance from startup logs, benchmark commands, and torch profiler traces or screenshots. Use when diagnosing SGLang prefill/decode/profile bottlenecks, GPU utilization, CUDA kernels, KV cache, attention, sampling, memory, or throughput/latency regressions.

How to use this skill

Skill file

SGLang Profile Analyse

Purpose

Guide performance analysis for models served by the SGLang framework. Always start from the SGLang startup log and the exact benchmark/evaluation command, then use torch profiler artifacts or screenshots to identify decode or profile-stage bottlenecks and recommend targeted next steps.

Required First Step

Before analyzing profiler data, ask the user to provide:

  1. The SGLang startup log file or full pasted startup log.
  2. The exact benchmark/evaluation command they ran.
  3. The model name/path and served model configuration if not visible in the log.
  4. The torch profiler file, trace, exported table, Chrome trace, TensorBoard trace, or screenshot.
  5. Whether the target stage is decode, prefill, profile, or unknown.

If the user only provides a torch profiler screenshot or file, do not jump directly to conclusions. First request the missing startup log and benchmark command, because SGLang startup configuration often determines the bottleneck.

Suggested prompt to the user:

请先上传 SGLang 启动日志文件,以及你用于评测的完整命令。随后请上传 torch profiler 文件、trace、导出的表格,或 profiler 截图。请同时说明你希望分析 decode、prefill 还是 profile 阶段;如果不确定,我会先根据日志和 profiler 特征判断。

Analysis Workflow

1. Parse SGLang startup log

Extract and summarize:

Flag anything missing or suspicious before reading profiler details.

2. Parse benchmark/evaluation command

Extract:

Check for command/log mismatches, such as model mismatch, wrong endpoint, unexpected max tokens, low concurrency, or CPU-side benchmark overhead.

3. Determine the stage

Use the log and workload shape to classify the profiler data:

If the stage cannot be determined, ask for trace time range, profiler labels, or benchmark parameters.

4. Analyze torch profiler artifacts

Accept any of these inputs:

When a file is available, inspect it directly when possible. For screenshots, ask the user to include the operator table and CUDA kernel table if the bottleneck is not visible.

Focus on:

5. Diagnose common SGLang bottlenecks

Decode bottlenecks

Look for:

Recommended checks/actions:

Prefill bottlenecks

Look for:

Recommended checks/actions:

Profile-stage bottlenecks

Look for:

Recommended checks/actions:

Output Format

Respond in Chinese unless the user asks otherwise. Use this structure:

## 结论摘要
- 主要瓶颈:...
- 影响阶段:decode / prefill / profile / mixed
- 置信度:高 / 中 / 低

## 依据
### 启动日志关键信息
| 项目 | 值 | 影响 |
|---|---|---|

### 评测命令关键信息
| 项目 | 值 | 影响 |
|---|---|---|

### Profiler 证据
| 现象 | 证据 | 推断 |
|---|---|---|

## 可能原因排序
1. ...
2. ...
3. ...

## 建议的验证实验
1. ...
2. ...
3. ...

## 优化建议
- 短期:...
- 中期:...
- 需要补充信息:...

Guardrails

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.