Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
13908d2
fix the logic for displaying steady-state test results (#464)
jschen069 Aug 17, 2026
2441666
delete redundent pkg (#461)
jschen069 Aug 19, 2026
2cb058b
[Feature]AISBench支持大模型响应异常检测 (#468)
Libotry Aug 19, 2026
800cd15
[DOCS] Add docs of terminal-bench 2.1 (#476)
SJTUyh Aug 19, 2026
29c363e
[Feature] Added herding_coreset_selector, a tool for compressing larg…
flame-hu Aug 20, 2026
693b16f
feat(output): add origin_top_logprobs field in vllm custom api (#458)
ivanbao9783 Aug 26, 2026
52001d2
feat(simulator): add /metrics endpoint for spec-decode exception test…
ivanbao9783 Aug 26, 2026
b1fb014
[Docs] Add recommand instruction for custom configs (#349)
SJTUyh Aug 26, 2026
662de5c
docs: remove response anomaly design document from docs tree (#486)
Libotry Aug 26, 2026
3586e4d
fix: response anomaly model_name fallback and CLI-only enable switch …
Libotry Aug 26, 2026
38d5ecc
[feature] Support api models useful cmd (#492)
SJTUyh Aug 27, 2026
d694ddc
【feature】Add corpusQA 1M dataset (#495)
Keithwwa Aug 27, 2026
caeab01
generate/analysis prefix cache (#489)
jschen069 Aug 27, 2026
52204f0
docs: remove redundant no-response-anomaly absence notes from cli args
Libotry Aug 27, 2026
755400b
docs: move response anomaly detection guide into a dedicated advanced…
Libotry Aug 27, 2026
d85cac9
docs: clarify response-anomaly switch stays off by default
Libotry Aug 27, 2026
452ad1f
docs: make response anomaly detection zero-config via two CLI switches
Libotry Aug 27, 2026
75a1a66
docs: drop internal msProbe branding from user-facing docs
Libotry Aug 28, 2026
2b775dc
docs: remind users to keep the model name in path consistent with mod…
Libotry Aug 28, 2026
a9f5355
docs: label the payload retention table with its parameter name
Libotry Aug 28, 2026
58f380d
docs: drop prediction wording from the anomaly detection flow
Libotry Aug 28, 2026
b482f1b
docs: fix conjunction in the archive finalization step
Libotry Aug 28, 2026
664f931
fix: remove the empty payload_staging shell after detection
Libotry Aug 28, 2026
878fd27
fix: drop redundant sha256 prefix in payload manifest checksum values
Libotry Aug 28, 2026
3434ef2
fix: differentiate response anomaly summary log from per-task complet…
Libotry Aug 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
52 changes: 52 additions & 0 deletions .github/workflows/run-ut-on-pr-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths:
- 'ais_bench/**'
- 'tests/**'
- 'plugins/**'
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
Expand All @@ -29,11 +30,18 @@ jobs:
pip3 install -r requirements/extra.txt -i https://repo.huaweicloud.com/repository/pypi/simple --trusted-host repo.huaweicloud.com
pip3 install -r requirements/datasets/bfcl_dependencies.txt --no-deps -i https://repo.huaweicloud.com/repository/pypi/simple --trusted-host repo.huaweicloud.com
pip3 install -r requirements/datasets/geometry3k.txt -i https://repo.huaweicloud.com/repository/pypi/simple --trusted-host repo.huaweicloud.com
# 安装 prefix_cache 插件(--no-deps:ais-bench-benchmark 已由上一步安装,
# 插件测试通过注入 FakeTokenizer 不依赖 transformers)
pip3 install -e plugins/prefix_cache --no-deps -i https://repo.huaweicloud.com/repository/pypi/simple --trusted-host repo.huaweicloud.com --use-pep517
- name: Run Test
run: |
pip3 install pytest pytest-cov pytest-xdist -i https://repo.huaweicloud.com/repository/pypi/simple --trusted-host repo.huaweicloud.com
python3 tests/run_tests.py tests/UT -p 16

- name: Run Prefix Cache Test
run: |
python3 tests/run_tests.py plugins/prefix_cache/tests --source-dirs plugins/prefix_cache/ais_bench_prefix_cache --output test_reports/prefix_cache

- name: Check Result
run: |
cur_dir=$(pwd)
Expand Down Expand Up @@ -74,6 +82,43 @@ jobs:
else
echo "[INFO] Code branch coverage is higher than 60.0%, current coverage is ${branch_coverage}%. "
fi
pc_summary_path=${cur_dir}/test_reports/prefix_cache/test_summary.txt
echo "pc_summary_path: ${pc_summary_path}"
if [ -f ${pc_summary_path} ]; then
echo "[INFO] prefix cache test_summary.txt exists. "
else
echo "[ERROR] prefix cache test_summary.txt not exists. "
exit 1
fi
grep -q "Failed: 0" ${pc_summary_path}
if [ $? -ne 0 ]; then
pc_failed_count=$(cat ${pc_summary_path} | grep "Failed:" | awk '{print $2}')
echo "[ERROR] Not all prefix cache test case passed, failed count is ${pc_failed_count}. "
exit 1
else
echo "[INFO] All prefix cache test case passed. "
fi
pc_total_coverage=$(cat ${pc_summary_path} | grep "Total coverage" | cut -d' ' -f3 | tr -d '%')
if python3 -c "exit(0 if float('$pc_total_coverage') < 80 else 1)"; then
echo "[ERROR] Prefix cache code total coverage is lower than 80.0%, current coverage is ${pc_total_coverage}%. "
exit 1
else
echo "[INFO] Prefix cache code total coverage is higher than 80.0%, current coverage is ${pc_total_coverage}%. "
fi
pc_line_coverage=$(cat ${pc_summary_path} | grep "Line coverage" | cut -d' ' -f3 | tr -d '%')
if python3 -c "exit(0 if float('$pc_line_coverage') < 80 else 1)"; then
echo "[ERROR] Prefix cache code line coverage is lower than 80.0%, current coverage is ${pc_line_coverage}%. "
exit 1
else
echo "[INFO] Prefix cache code line coverage is higher than 80.0%, current coverage is ${pc_line_coverage}%. "
fi
pc_branch_coverage=$(cat ${pc_summary_path} | grep "Branch coverage" | cut -d' ' -f3 | tr -d '%')
if python3 -c "exit(0 if float('$pc_branch_coverage') < 60 else 1)"; then
echo "[ERROR] Prefix cache code branch coverage is lower than 60.0%, current coverage is ${pc_branch_coverage}%. "
exit 1
else
echo "[INFO] Prefix cache code branch coverage is higher than 60.0%, current coverage is ${pc_branch_coverage}%. "
fi
- name: Uninstall benchmark
if: always()
run: |
Expand All @@ -84,3 +129,10 @@ jobs:
else
echo "[INFO] Uninstall benchmark success. "
fi
pip3 uninstall ais-bench-prefix-cache -y
if [ $? -ne 0 ]; then
echo "[ERROR] Uninstall prefix cache plugin failed. "
exit 1
else
echo "[INFO] Uninstall prefix cache plugin success. "
fi
1 change: 1 addition & 0 deletions .github/workflows/run_smoke_test_pr_and_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
paths:
- 'ais_bench/benchmark/**'
- 'smoke_tests/**'
- 'plugins/prefix_cache/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
116 changes: 97 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
- 性能评测场景使用[自定义数据集](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/advanced_tutorials/custom_dataset.html),支持按请求粒度指定最大输出长度!🔥🔥🔥
- **\[2025.6.19]** 支持📚[性能评测结果可视化](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/base_tutorials/results_intro/performance_visualization.html),辅助定位推理服务性能瓶颈!🔥🔥🔥
- **\[2025.6.12]** 支持[textvqa](ais_bench/benchmark/configs/datasets/textvqa/README.md)、[videobench](ais_bench/benchmark/configs/datasets/videobench/README.md)和[vocalsound](ais_bench/benchmark/configs/datasets/vocalsound/README.md)等多模态数据集的精度和性能评测!🔥🔥🔥
- **\[2025.6.6]** AISBench支持稳态性能评测,获取系统真实最佳性能,参考📚 [服务化稳定状态性能测试](doc/users_guide/stable_stage.md)进行快速上手! 🔥🔥🔥
- **\[2025.5.16]** 支持3W+高并发服务化性能评测,📚 [性能指标](doc/users_guide/performance_metric.md)对齐🔗 [vllm benchmark](https://github.com/vllm-project/vllm/tree/main/benchmarks),参考📚 [服务化性能测评指南](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/base_tutorials/scenes_intro/performance_benchmark.html)了解详情!🔥🔥🔥
- **\[2025.6.6]** AISBench支持稳态性能评测,获取系统真实最佳性能,参考📚 [服务化稳定状态性能测试](docs/source_zh_cn/advanced_tutorials/stable_stage.md)进行快速上手! 🔥🔥🔥
- **\[2025.5.16]** 支持3W+高并发服务化性能评测,📚 [性能指标](docs/source_zh_cn/base_tutorials/results_intro/performance_metric.md)对齐🔗 [vllm benchmark](https://github.com/vllm-project/vllm/tree/main/benchmarks),参考📚 [服务化性能测评指南](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/base_tutorials/scenes_intro/performance_benchmark.html)了解详情!🔥🔥🔥
- **\[2025.4.30]** 精度评测支持断点续测和失败用例重测,大幅提高精度评测鲁棒性,参考📚 [中断续测 & 失败用例重测](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/base_tutorials/scenes_intro/accuracy_benchmark.html#id10)进行快速上手! 🔥🔥🔥

## 🌏 简介
Expand Down Expand Up @@ -143,15 +143,21 @@ pip3 install -r requirements/datasets/ocrbench_v2.txt
### 📦 安装方式-一键安装(备选)

AISBench 也提供了一键安装方式,适用于基于预置配置文件的快速体验和评估场景,请确保安装环境联网。

- 基本功能的安装命令如下:

```shell
pip3 install ais_bench_benchmark
```

- 全量功能的安装命令如下:

```shell
pip3 install ais_bench_benchmark[full]
```

如需进一步配置、使用 CLI 或 Python 脚本发起评测任务,请参考[快速入门指南](#快速入门)。

## ❌ 工具卸载

如需卸载 AISBench Benchmark,可执行以下命令:
Expand All @@ -162,9 +168,85 @@ pip3 uninstall ais_bench_benchmark

## 🚀 快速入门

### 命令含义
### 运行命令前置准备

- 需要准备支持`v1/chat/completions`子服务的推理服务,可以参考🔗 [VLLM启动OpenAI 兼容服务器](https://docs.vllm.com.cn/en/latest/getting_started/quickstart.html#openai-compatible-server)启动推理服务
- 需要准备gsm8k数据集,可以从🔗 [opencompass
提供的gsm8k数据集压缩包](http://opencompass.oss-cn-shanghai.aliyuncs.com/datasets/data/gsm8k.zip)下载。将解压后的`gsm8k/`文件夹部署到AISBench评测工具根路径下的`ais_bench/datasets`文件夹下。

### 启动测评(两种方式任选其一)

| ⭐ 推荐:使用自定义配置文件 | 备选:使用命令行参数(原快速入门方式) |
| :------------------ | :------------------------------ |
| 修改一个文件,集中管理所有配置,在任意路径写配置 | 通过 `--models` `--datasets` 参数指定 |
| 一次编写,多次复用 | 每次运行需输入完整命令 |
| 支持 Python 全部语法,灵活扩展 | 仅支持笛卡尔积组合 |

**⭐ 推荐:使用自定义配置文件**

AISBench 提供了预置的自定义配置文件 [model\_api\_test\_zh\_cn.py](ais_bench/configs/model_api_test_zh_cn.py),将常见的推理服务化测试配置(模型选择、服务地址、端口、生成参数等)集中在一个文件中,无需分别查找和修改多个配置文件。该文件本质上是 Python 脚本,支持所有 Python 语法,你可以自由扩展。

打开 `ais_bench/configs/model_api_test_zh_cn.py`,根据实际情况修改以下配置(如果是`pip3 install ais_bench_benchmark`方式直接安装工具,可以在任意路径自行创建`model_api_test_zh_cn.py`,将以下配置内容写入该文件):

```python
from mmengine.config import read_base

with read_base():
# 模型任务,选择其中一个,其他模型任务参考:https://ais-bench-benchmark-rf.readthedocs.io/zh-cn/latest/base_tutorials/all_params/models.html 获取更多模型任务
# vllm_api_general 是基础模型,仅支持文本生成
from ais_bench.benchmark.configs.models.vllm_api.vllm_api_general import models as vllm_api_general
# vllm_api_general_chat 是对话模型,支持对话
from ais_bench.benchmark.configs.models.vllm_api.vllm_api_general_chat import models as vllm_api_general_chat
# vllm_api_stream_chat 是流式对话模型,支持流式对话
from ais_bench.benchmark.configs.models.vllm_api.vllm_api_stream_chat import models as vllm_api_stream_chat
# vllm_api_general_stream 是流式模型,支持流式生成
from ais_bench.benchmark.configs.models.vllm_api.vllm_api_general_stream import models as vllm_api_general_stream

# 数据集任务,参考:https://ais-bench-benchmark-rf.readthedocs.io/zh-cn/latest/get_started/datasets.html 获取更多数据集任务
from ais_bench.benchmark.configs.datasets.demo.demo_gsm8k_gen_4_shot_cot_chat_prompt import gsm8k_datasets as datasets

models = vllm_api_general_chat

models[0]["path"] = "" # 指定模型序列化词表文件的绝对路径(精度测试场景一般不需要配置)
models[0]["model"] = "" # 指定服务端加载的模型名称,根据 VLLM 推理服务实际拉取的模型名称配置(配置为空字符串则自动获取)
models[0]["request_rate"] = 0 # 请求发送频率:每 1/request_rate 秒向服务端发送 1 条请求;小于 0.001 时一次性发送所有请求
models[0]["api_key"] = "" # 自定义 API key,默认为空字符串
models[0]["host_ip"] = "localhost" # 指定推理服务的 IP
models[0]["host_port"] = 8080 # 指定推理服务的端口
models[0]["url"] = "" # 自定义访问推理服务的 URL 路径(当基础 URL 不是 http://host_ip:host_port 的组合时需要配置;配置后 host_ip 和 host_port 将被忽略)
models[0]["max_out_len"] = 512 # 推理服务输出的最大 token 数
models[0]["batch_size"] = 1 # 发送请求的最大并发数
models[0]["trust_remote_code"] = False # tokenizer 是否信任远程代码,默认为 False
models[0]["generation_kwargs"] = dict( # 模型推理参数,参考 VLLM 文档配置;AISBench 评测工具不做处理,直接附加到发送的请求中
temperature=0.01,
ignore_eos=False,
)

# datasets[0]["path"] = ais_bench/datasets/gsm8k # 指定数据集目录的绝对路径(精度测试场景需要配置)

work_dir = 'outputs/default/' # 指定任务结果和日志的保存工作目录(默认为 outputs/default/)

```
> 💡 配置文件中已预置了常用模型类型的导入(`vllm_api_general`、`vllm_api_general_chat`、`vllm_api_stream_chat`、`vllm_api_general_stream`),只需取消/修改注释即可切换。更多自定义配置文件的用法请参考 📚 [自定义配置文件运行AISBench](./docs/source_zh_cn/advanced_tutorials/run_custom_config.md)。

数据集任务的选取、准备和使用参考如下步骤:
1. 在📚 [开源数据集](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/get_started/datasets.html#id3)内选取数据集任务
2. 进入数据的 📚 [详细介绍/数据集部署](ais_bench/benchmark/configs/datasets/demo/README.md#数据集部署)准备数据集
3. 参考📚 [详细介绍/可用数据集任务](ais_bench/benchmark/configs/datasets/demo/README.md#可用数据集任务)选取可用数据集任务,并将对应的任务导入方式(例如`from ais_bench.benchmark.configs.datasets.demo.demo_gsm8k_gen_4_shot_cot_chat_prompt import gsm8k_datasets as datasets`)复制到自定义配置文件中

AISBench命令执行的单个或多个评测任务是由模型任务(单个或多个)、数据集任务(单个或多个)和结果呈现任务(单个)的组合定义的,AISBench的其他命令行则规定了评测任务的场景(精度评测场景、性能评测场景等)。以如下AISBench命令为例:
修改好配置文件后,执行如下命令启动服务化精度评测:

```bash
ais_bench ais_bench/configs/model_api_test_zh_cn.py
```

***

**备选:使用命令行参数**

如果你更习惯使用命令行参数方式,AISBench 同样支持通过 `--models`、`--datasets`、`--summarizer` 参数直接指定任务。以下是与上述自定义配置文件方式**执行效果完全相同**的命令行方式。

AISBench命令执行的单个或多个评测任务是由模型任务(单个或多个)、数据集任务(单个或多个)和结果呈现任务(单个)的组合定义的。以如下AISBench命令为例:

```shell
ais_bench --models vllm_api_general_chat --datasets demo_gsm8k_gen_4_shot_cot_chat_prompt --summarizer example
Expand All @@ -174,28 +256,18 @@ ais_bench --models vllm_api_general_chat --datasets demo_gsm8k_gen_4_shot_cot_ch

- `--models`指定了模型任务,即`vllm_api_general_chat`模型任务。
- `--datasets`指定了数据集任务,即`demo_gsm8k_gen_4_shot_cot_chat_prompt`数据集任务。
- `--summarizer`指定了结果呈现任务,即`example`结果呈现任务(不指定`--summarizer`精度评测场景默认使用`example`任务),一般使用默认,不需要在命令行中指定,后续命令不指定
- `--summarizer`指定了结果呈现任务,即`example`结果呈现任务(不指定`--summarizer`精度评测场景默认使用`example`任务),一般使用默认,不需要在命令行中指定。

多任务测评请参考:📚 精度场景的[多任务测评](./docs/source_zh_cn/base_tutorials/scenes_intro/accuracy_benchmark.md#多任务测评) 和 性能场景的[多任务测评](./docs/source_zh_cn/base_tutorials/scenes_intro/performance_benchmark.md#多任务测评)。

如需自行组合测评任务,实现更灵活的测评方式,可参考:📚 [自定义配置文件运行AISBench](./docs/source_zh_cn/advanced_tutorials/run_custom_config.md#自定义配置文件运行AISBench)。

### 任务含义查询(可选)

所选模型任务`vllm_api_general_chat`、数据集任务`demo_gsm8k_gen_4_shot_cot_chat_prompt`和结果呈现任务`example`的具体信息(简介,使用约束等)可以分别从如下链接中查询含义:

- `--models`: 📚 [服务化推理后端](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/base_tutorials/all_params/models.html#id2)
- `--datasets`: 📚 [开源数据集](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/get_started/datasets.html#id3) → 📚 [详细介绍](ais_bench/benchmark/configs/datasets/demo/README.md)
- `--summarizer`: 📚 [结果汇总任务](https://ais-bench-benchmark.readthedocs.io/zh-cn/latest/base_tutorials/all_params/summarizer.html)

### 运行命令前置准备

- `--models`: 使用`vllm_api_general_chat`模型任务,需要准备支持`v1/chat/completions`子服务的推理服务,可以参考🔗 [VLLM启动OpenAI 兼容服务器](https://docs.vllm.com.cn/en/latest/getting_started/quickstart.html#openai-compatible-server)启动推理服务
- `--datasets`: 使用`demo_gsm8k_gen_4_shot_cot_chat_prompt`数据集任务,需要准备gsm8k数据集,可以从🔗 [opencompass
提供的gsm8k数据集压缩包](http://opencompass.oss-cn-shanghai.aliyuncs.com/datasets/data/gsm8k.zip)下载。将解压后的`gsm8k/`文件夹部署到AISBench评测工具根路径下的`ais_bench/datasets`文件夹下。

### 任务对应配置文件修改

每个模型任务、数据集任务和结果呈现任务都对应一个配置文件,运行命令前需要修改这些配置文件的内容。这些配置文件路径可以通过在原有AISBench命令基础上加上`--search`来查询,例如:

```shell
Expand All @@ -221,6 +293,14 @@ ais_bench --models vllm_api_general_chat --datasets demo_gsm8k_gen_4_shot_cot_ch

模型配置文件`vllm_api_general_chat.py`中包含了模型运行相关的配置内容,是需要依据实际情况修改的。快速入门中需要修改的内容用注释标明。

> 💡 **提示**:模型配置中的部分参数(如 `host_ip`、`host_port`、`model`、`url`、`max_out_len`、`generation_kwargs` 等)无需修改配置文件,可直接通过命令行覆盖,例如:
>
> ```bash
> ais_bench --models vllm_api_general_chat --datasets demo_gsm8k_gen_4_shot_cot_chat_prompt --host-ip 127.0.0.1 --host-port 8000
> ```
>
> 命令行显式指定的参数会覆盖本次执行的所有模型配置中对应字段;仅覆盖配置中**已存在的字段**,未指定的参数保持配置文件原值。更多可覆盖参数及覆盖范围说明请参考 📚 [用户配置参数 - API 模型通用覆盖参数](./docs/source_zh_cn/base_tutorials/all_params/cli_args.md#api-模型通用覆盖参数)。

```python
from ais_bench.benchmark.models import VLLMCustomAPIChat

Expand Down Expand Up @@ -250,15 +330,13 @@ models = [
]
```

### 执行命令

修改好配置文件后,执行命令启动服务化精度评测:

```bash
ais_bench --models vllm_api_general_chat --datasets demo_gsm8k_gen_4_shot_cot_chat_prompt
```

#### 查看任务执行细节
### 查看任务执行细节

执行AISBench命令后,任务管理界面会在命令行实时刷新显示任务执行状态(键盘按"P"键可以暂停/恢复刷新,用于复制看板信息,再按"P"键可以继续刷新)。任务管理界面支持同时监控多个任务的详细执行状态,包括任务名称、进度、时间成本、状态、日志路径、扩展参数等信息,例如:

Expand Down Expand Up @@ -313,7 +391,7 @@ outputs/default/20250628_151326/logs/infer/vllm-api-general-chat/demo_gsm8k.out

> ⚠️ **注意**: 不同评测场景落盘任务执行细节内容不同,具体请参考具体评测场景的指南。

#### 输出结果
### 输出结果

因为只有8条数据,会很快跑出结果,结果显示的示例如下

Expand Down
Loading
Loading