File size: 11,155 Bytes
4daada3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d430e1
4daada3
 
 
 
 
 
5d430e1
4daada3
 
 
 
 
 
 
 
5d430e1
 
4daada3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d430e1
4daada3
 
 
 
 
 
 
 
 
 
5d430e1
4daada3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7b17aed
 
 
 
 
 
 
 
 
4daada3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
---
license: cc-by-nc-nd-4.0
configs:
  - config_name: general
    data_files:
      - split: train
        path: CPI_general_benchmark/CPI_general_benchmark-*.parquet
  - config_name: practical
    data_files:
      - split: train
        path: CPI_practical_benchmark/CPI_practical_benchmark-*.parquet
  - config_name: intelligent
    data_files:
      - split: train
        path: CPI_intelligent_benchmark/CPI_intelligent_benchmark-*.parquet
---


# CPI-Bench

[![Hugging Face Dataset](https://img.shields.io/badge/🤗-Dataset-yellow)](https://huggingface.co/datasets/TaobaoTmall-AlgorithmProducts/CPI-benchmark)
[![License](https://img.shields.io/badge/License-CC%20BY--NC--ND%204.0-lightgrey)](#license)

## Introduction

CPI-Bench is a comprehensive suite of benchmarks designed to evaluate whether an image
generation/editing model is truly capable of handling diverse, real-world, and
knowledge-intensive tasks. It consists of three complementary subsets:

| Benchmark | Description | Data Files |
|---|---|---|
| **CPI-General-Benchmark** | General-purpose image editing tasks covering a wide range of task types | `CPI_general_benchmark/CPI_general_benchmark-*.parquet` |
| **CPI-Practical-Benchmark** | Image editing tasks grounded in everyday, real-life scenarios | `CPI_practical_benchmark/CPI_practical_benchmark-*.parquet` |
| **CPI-Intelligent-Benchmark** | Image editing tasks that require domain knowledge and multi-step reasoning, with reference input image(s) | `CPI_intelligent_benchmark-*.parquet` |


Each sample provides an editing/generation instruction (and, for image-editing tasks,
one or more reference images). Models are expected to produce an output image
accordingly, which is then scored by a VLM-as-Judge (e.g., Gemini) across multiple
quality dimensions.

## ✨ Key Features

- **Three Complementary Subsets**: covers general-purpose editing, life-scenario
  editing, and knowledge-intensive reasoning for image-editing (i2i) settings.
- **Multi-Image Input Support**: `source` fields may contain one or multiple
  reference images, supporting complex multi-image editing scenarios.
- **Bilingual Instructions**: Chinese and English instructions are provided for
  every subset, enabling cross-lingual evaluation.
- **Reasoning-Aware Annotations**: the reasoning subsets additionally provide a
  `rationale` field — a reference reasoning trace from instruction to expected
  result, used as *guidance material* (not a hard ground truth) during scoring.
- **VLM-Driven Automatic Evaluation**: each subset ships with a ready-to-use,
  multi-dimension VLM-as-Judge evaluation toolkit (see below).

## ✨ Key Attributes

**CPI-General-Benchmark / CPI-Practical-Benchmark fields:**

| Field | Description |
|---|---|
| `id` | Unique sample ID |
| `task` | Task category, used to select the corresponding scoring prompt template |
| `a_to_b_instructions` | Editing instruction in Chinese |
| `a_to_b_instructions_eng` | Editing instruction in English |
| `target_resolution` | Target output resolution |
| `source` | `List[PIL.Image]` — one or more reference input images |

**CPI-Intelligent-Benchmark fields:**

| Field | Description |
|---|---|
| `id` | Unique sample ID |
| `expert_domain` | Domain category, formatted as `"<domain>-<subtask>"` |
| `a_to_b_instructions` | Editing instruction in Chinese |
| `a_to_b_instructions_eng` | Editing instruction in English |
| `rationale` | Reference reasoning trace (guidance material for scoring; may be empty) |
| `target_resolution` | Target output resolution |
| `source` | `List[PIL.Image]` — one or more reference input images |


## Loading

```python
from datasets import load_dataset

# Load a specific subset directly from the Hub (recommended)
dataset = load_dataset("TaobaoTmall-AlgorithmProducts/CPI-benchmark", "general", split="train")
print(dataset)
print(dataset[0])

# Other available configs: "practical", "intelligent"
dataset = load_dataset("TaobaoTmall-AlgorithmProducts/CPI-benchmark", "intelligent", split="train")

# Alternatively, download the repo manually and load from local parquet files
dataset = load_dataset(
    "parquet",
    data_files="/path/to/local/CPI_general_benchmark/CPI_general_benchmark-*.parquet",
    split="train",
)
```

---

# CPI-Bench - Evaluation Toolkit

An automated evaluation toolkit for image generation/editing models, powered by
VLM-as-Judge (e.g., Gemini). Given a set of model outputs, the toolkit scores each
sample across multiple quality dimensions and produces an aggregated report.

The toolkit is located under [`bench_eval_code/`](bench_eval_code) and provides one
evaluation script per subset:

| Subset | Script | Prompt Config |
|---|---|---|
| CPI-General-Benchmark | `bench_eval_code/eval_general_practical.py --benchmark general` | `bench_eval_code/prompts/general_prompts.json` |
| CPI-Practical-Benchmark | `bench_eval_code/eval_general_practical.py --benchmark practical` | `bench_eval_code/prompts/practical_prompts.json` |
| CPI-Intelligent-Benchmark | `bench_eval_code/eval_intelligent.py` | `bench_eval_code/prompts/intelligent_prompts.json` |

## Scoring Dimensions

**CPI-General-Benchmark / CPI-Practical-Benchmark**

Each `task` type is mapped to a task-specific scoring prompt template (defined in
`general_prompts.json` / `practical_prompts.json`). The judge VLM outputs a score for each
dimension in the format `DimensionName: score`, and the sample's final score is the
arithmetic mean across all dimensions returned for that task.

**CPI-Intelligent-Benchmark** — 3 dimensions, each scored 1.0–5.0:

| Dimension | Weight | What it measures |
|---|---|---|
| Knowledge Reasoning | 45% | Factual/domain-knowledge correctness, fused with `rationale` as reference guidance |
| Visual Quality | 30% | Overall visual/aesthetic quality of the generated result |
| Input Consistency | 25% | Consistency between the result and the reference input image(s) |

The final score is a weighted sum of the three dimensions above. If the Knowledge
Reasoning score is ≤ 2, the final score is additionally multiplied by 0.6 as a
penalty for factual/knowledge errors.


## How It Works

- **General / Practical**: a single VLM call per sample — sends
  `[reference image(s)..., result, scoring prompt]` and parses per-dimension scores
  from the response.
- **Intelligent**: a split-call strategy — one VLM call per dimension
  (Knowledge Reasoning, Visual Quality, and for i2i, Input Consistency), so the judge
  can focus on one aspect at a time for more reliable scoring.

## Input Format

First, generate your model's outputs for each sample. If you are not sure which row
corresponds to which image(s)/instruction, use the export helper first — it
auto-detects the dataset schema and works for all three subsets:

```bash
python bench_eval_code/export_samples.py \
    --dataset_path "/path/to/CPI_general_benchmark/CPI_general_benchmark-*.parquet" \
    --output_dir ./exported_general \
    --lang eng \
    --workers 16
```

This produces:
- `source_images/` — reference input images per sample
- `samples.jsonl` — per-sample metadata: `sample_index`, `id`, `task`, `instruction`, `rationale` (if present)
- `result_template.jsonl` — a template result file; fill in the `result` field with your model's output path after inference

Then prepare a JSONL file mapping each benchmark sample index to your model's
generated result image:

```jsonl
{"sample_index": 0, "result": "/path/to/result_0.png"}
{"sample_index": 1, "result": "/path/to/result_1.png"}
{"sample_index": 2, "result": "/path/to/result_2.png"}
```

- `sample_index`: the 0-based row index into the loaded HF dataset
- `result`: path to your model's generated image for that sample

## Usage

**CPI-General-Benchmark / CPI-Practical-Benchmark:**

```bash
python bench_eval_code/eval_general_practical.py \
    --benchmark general \
    --dataset_path "/path/to/CPI_general_benchmark/CPI_general_benchmark-*.parquet" \
    --result_jsonl "/path/to/my_results.jsonl" \
    --prompts_json bench_eval_code/prompts/general_prompts.json \
    --output_dir eval_output/my_model_general \
    --api_key "YOUR_API_KEY" \
    --lang eng \
    --workers 8
```

Use `--benchmark practical` and `bench_eval_code/prompts/practical_prompts.json` to evaluate
the Practical benchmark instead.

**CPI-Intelligent-Benchmark:**

```bash
python bench_eval_code/eval_intelligent.py \
    --dataset_path "/path/to/CPI_intelligent_benchmark/CPI_intelligent_benchmark-*.parquet" \
    --result_jsonl "/path/to/my_results_i2i.jsonl" \
    --prompts_json bench_eval_code/prompts/intelligent_prompts.json \
    --output_dir eval_output/my_model_intelligent \
    --api_key "YOUR_API_KEY" \
    --lang eng \
    --workers 8
```


## Output

Each script produces two files in `--output_dir`:

- **`cases.jsonl`** — per-sample scoring details (per-dimension scores + raw VLM responses)
- **`summary.json`** — aggregated scores, broken down by task type / domain / dimension


## Features

- **Resume support**: if evaluation is interrupted, re-running the same command
  will skip already-scored samples (found in `cases.jsonl`) and continue from
  where it left off. Use `--no_resume` to force a full re-run.
- **Multi-key rotation**: pass multiple API keys (comma-separated via `--api_key`)
  to distribute requests across keys and avoid rate limits.
- **Concurrent scoring**: use `--workers` to control parallelism for faster evaluation.
- **Custom VLM endpoint**: any OpenAI-compatible API can be used via `--base_url`
  and `--model`.

## File Structure

```
bench_eval_code/
├── bench_utils.py          # Shared utilities: API key pool, image helpers, retry-wrapped VLM caller
├── eval_general_practical.py    # Evaluation script for General / Practical benchmarks
├── eval_intelligent.py   # Evaluation script for Intelligent benchmark
├── export_samples.py       # Dataset export helper (auto-detects schema, multi-threaded)
└── prompts/
    ├── general_prompts.json
    ├── practical_prompts.json
    └── intelligent_prompts.json
```

## License

CPI-Bench is released under the Creative Commons Attribution–NonCommercial–NoDerivatives
(CC BY-NC-ND 4.0) license.

- ✅ Free for academic research purposes only
- ❌ Commercial use is prohibited

By using this dataset, you agree to comply with the applicable license terms.

## 🖊️ Citation

If you find CPI-Bench useful for your research, please consider citing:

```bibtex
@misc{zhou2026cpibenchcomprehensivepracticalintelligent,
      title={CPI-Bench: A Comprehensive, Practical and Intelligent Benchmark for Real-World Image Editing}, 
      author={Qinye Zhou and Jun Zheng and Yongchao Du and Yuan Wang and Zhengrui Chen and Zuan Gao and Taihang Hu and Chao Lin and Yefeng Shen and Xingjian Wang and Zhao Wang and Zhengtao Wu and Xiaoli Xu and Zhengze Xu and Hao Yan and Denghui Yang and Yuhang Yu and Huayu Zhang and Mingzhou Zhang and Mengting Chen},
      year={2026},
      eprint={2608.14546},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2608.14546}, 
}
```