Release VisSlideBench (data, images, evaluation code)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- README.md +127 -0
- data/edit.jsonl +0 -0
- data/multi_image.jsonl +0 -0
- data/t2i.jsonl +0 -0
- data/template.jsonl +0 -0
- eval/README.md +52 -0
- eval/aggregate.py +57 -0
- eval/common.py +120 -0
- eval/prompts/aesthetic_quality.txt +198 -0
- eval/prompts/content_faithfulness.txt +202 -0
- eval/prompts/edit_evaluation_quality.txt +24 -0
- eval/prompts/edit_evaluation_source_control.txt +26 -0
- eval/prompts/style_instruction_following_json.txt +138 -0
- eval/prompts/style_instruction_following_text.txt +138 -0
- eval/requirements.txt +4 -0
- eval/run_ocr.py +95 -0
- eval/score_edit.py +74 -0
- eval/score_generation.py +207 -0
- images/edit/add_block__add_000299_source.png +3 -0
- images/edit/add_block__add_000299_target.png +3 -0
- images/edit/add_block__add_003407_source.png +3 -0
- images/edit/add_block__add_003407_target.png +3 -0
- images/edit/add_block__add_003770_source.png +3 -0
- images/edit/add_block__add_003770_target.png +3 -0
- images/edit/add_block__add_010211_source.png +3 -0
- images/edit/add_block__add_010211_target.png +3 -0
- images/edit/add_block__add_011028_source.png +3 -0
- images/edit/add_block__add_011028_target.png +3 -0
- images/edit/add_block__add_013112_source.png +3 -0
- images/edit/add_block__add_013112_target.png +3 -0
- images/edit/add_block__add_015622_source.png +3 -0
- images/edit/add_block__add_015622_target.png +3 -0
- images/edit/add_block__add_016829_source.png +3 -0
- images/edit/add_block__add_016829_target.png +3 -0
- images/edit/add_block__add_024025_source.png +3 -0
- images/edit/add_block__add_024025_target.png +3 -0
- images/edit/add_block__add_033568_source.png +3 -0
- images/edit/add_block__add_033568_target.png +3 -0
- images/edit/add_block__add_034701_source.png +3 -0
- images/edit/add_block__add_034701_target.png +3 -0
- images/edit/add_block__add_036466_source.png +3 -0
- images/edit/add_block__add_036466_target.png +3 -0
- images/edit/add_block__add_037149_source.png +3 -0
- images/edit/add_block__add_037149_target.png +3 -0
- images/edit/add_block__add_041313_source.png +3 -0
- images/edit/add_block__add_041313_target.png +3 -0
- images/edit/add_block__add_045580_source.png +3 -0
- images/edit/add_block__add_045580_target.png +3 -0
- images/edit/add_block__add_049123_source.png +3 -0
- images/edit/add_block__add_049123_target.png +3 -0
README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: VisSlideBench
|
| 3 |
+
license: cc-by-nc-4.0
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
task_categories:
|
| 7 |
+
- text-to-image
|
| 8 |
+
- image-to-image
|
| 9 |
+
tags:
|
| 10 |
+
- slides
|
| 11 |
+
- presentation
|
| 12 |
+
- text-rendering
|
| 13 |
+
- image-editing
|
| 14 |
+
- benchmark
|
| 15 |
+
size_categories:
|
| 16 |
+
- 1K<n<10K
|
| 17 |
+
configs:
|
| 18 |
+
- config_name: t2i
|
| 19 |
+
data_files:
|
| 20 |
+
- split: test
|
| 21 |
+
path: data/t2i.jsonl
|
| 22 |
+
- config_name: template
|
| 23 |
+
data_files:
|
| 24 |
+
- split: test
|
| 25 |
+
path: data/template.jsonl
|
| 26 |
+
- config_name: multi_image
|
| 27 |
+
data_files:
|
| 28 |
+
- split: test
|
| 29 |
+
path: data/multi_image.jsonl
|
| 30 |
+
- config_name: edit
|
| 31 |
+
data_files:
|
| 32 |
+
- split: test
|
| 33 |
+
path: data/edit.jsonl
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
# VisSlideBench
|
| 37 |
+
|
| 38 |
+
VisSlideBench evaluates single-slide image generation and editing. It has 1,527
|
| 39 |
+
manually screened cases in four tracks that share one text-and-image interface.
|
| 40 |
+
|
| 41 |
+
| Track | Config | Visual input | Real | Synthetic | Total |
|
| 42 |
+
|---|---|---|---:|---:|---:|
|
| 43 |
+
| Text-to-slide | `t2i` | none | 167 | 150 | 317 |
|
| 44 |
+
| Template-conditioned | `template` | one reference slide | 147 | 150 | 297 |
|
| 45 |
+
| Multi-image grounded | `multi_image` | one to four assets | 179 | 150 | 329 |
|
| 46 |
+
| Slide editing | `edit` | source slide | – | – | 584 |
|
| 47 |
+
|
| 48 |
+
Real cases come from presentation decks. Synthetic cases were built with
|
| 49 |
+
Nano-Banana-2. Every generation track mixes three prompt forms: short requests,
|
| 50 |
+
detailed descriptions, and structured `style_json` specifications.
|
| 51 |
+
|
| 52 |
+
| Prompt form | t2i | template | multi_image |
|
| 53 |
+
|---|---:|---:|---:|
|
| 54 |
+
| short | 115 | 111 | 103 |
|
| 55 |
+
| long | 109 | 114 | 110 |
|
| 56 |
+
| style_json | 93 | 72 | 116 |
|
| 57 |
+
|
| 58 |
+
The edit track covers nine operations: text modification (50), block addition
|
| 59 |
+
(74), block removal (49), background update (52), color change (49), font change
|
| 60 |
+
(49), typography change (73), image replacement (103), and theme switching (85).
|
| 61 |
+
|
| 62 |
+
## Files
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
data/t2i.jsonl data/template.jsonl data/multi_image.jsonl data/edit.jsonl
|
| 66 |
+
images/<track>/<id>_input_<k>.<ext> # visual inputs (template, multi_image)
|
| 67 |
+
images/<track>/<id>_target.<ext> # reference target slide, when available
|
| 68 |
+
images/edit/<id>_source.png # slide to edit
|
| 69 |
+
images/edit/<id>_target.png # reference edited slide
|
| 70 |
+
eval/ # scoring code and judge prompts
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
All image paths in the jsonl files are relative to the dataset root.
|
| 74 |
+
|
| 75 |
+
Generation record:
|
| 76 |
+
|
| 77 |
+
```json
|
| 78 |
+
{"index": 0, "id": "46f1aa2e-...", "task": "t2i", "source": "real", "prompt_type": "short",
|
| 79 |
+
"instruction": "The slide is titled ...", "input_images": [],
|
| 80 |
+
"target_image": "images/t2i/46f1aa2e-..._target.jpg", "width": 2589, "height": 1455}
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
`width` and `height` are the size of the reference slide. Our runs generate
|
| 84 |
+
t2i cases at 1280x720 and template and multi-image cases at `width` x
|
| 85 |
+
`height`. `target_image` is a reference only and is `null` for some synthetic
|
| 86 |
+
template and multi-image cases; no metric compares against it.
|
| 87 |
+
|
| 88 |
+
Edit record:
|
| 89 |
+
|
| 90 |
+
```json
|
| 91 |
+
{"index": 0, "id": "add_block__add_000299", "task": "edit", "operation": "add_block",
|
| 92 |
+
"instruction": "Insert the subtitle ...", "source_image": "images/edit/..._source.png",
|
| 93 |
+
"target_image": "images/edit/..._target.png", "width": 1280, "height": 720}
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
## Evaluation
|
| 97 |
+
|
| 98 |
+
Save one PNG per case as `<pred_dir>/<track>/<id>.png`, then run the scripts in
|
| 99 |
+
`eval/` (see `eval/README.md`).
|
| 100 |
+
|
| 101 |
+
| Track | Metrics |
|
| 102 |
+
|---|---|
|
| 103 |
+
| t2i, template | Content Faithfulness (CF), Instruction Following (IF), Aesthetic Quality (AQ) |
|
| 104 |
+
| multi_image | CF (text and input-image preservation, averaged), IF, AQ |
|
| 105 |
+
| edit | Semantic Consistency (SC = min of edit success and edit consistency), Presentation Quality (PQ) |
|
| 106 |
+
|
| 107 |
+
CF text fidelity uses OCR and a normalized edit distance against the text the
|
| 108 |
+
instruction requires. IF, AQ, image preservation, SC, and PQ use GPT-4.1 as the
|
| 109 |
+
judge; IF and AQ are the unweighted means of their sub-dimension scores. The
|
| 110 |
+
overall score averages the eleven metrics.
|
| 111 |
+
|
| 112 |
+
## License
|
| 113 |
+
|
| 114 |
+
VisSlideBench is released under CC BY-NC 4.0 for non-commercial research use.
|
| 115 |
+
Real cases come from publicly shared presentation decks, whose content remains
|
| 116 |
+
the property of its authors; synthetic cases were generated with Nano-Banana-2.
|
| 117 |
+
If you own content in this dataset and want it removed, please open a
|
| 118 |
+
discussion on this repository.
|
| 119 |
+
|
| 120 |
+
## Citation
|
| 121 |
+
|
| 122 |
+
```bibtex
|
| 123 |
+
@misc{visslidebench,
|
| 124 |
+
title = {InfoVis: Unified Slide Image Generation and Editing},
|
| 125 |
+
year = {2026}
|
| 126 |
+
}
|
| 127 |
+
```
|
data/edit.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/multi_image.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/t2i.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/template.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
eval/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VisSlideBench evaluation
|
| 2 |
+
|
| 3 |
+
## Setup
|
| 4 |
+
|
| 5 |
+
```bash
|
| 6 |
+
pip install -r eval/requirements.txt # judge + text matching
|
| 7 |
+
pip install paddlepaddle-gpu paddleocr==3.3.2 # OCR, only for run_ocr.py
|
| 8 |
+
export OPENAI_API_KEY=... # any OpenAI-compatible endpoint
|
| 9 |
+
export OPENAI_BASE_URL=... # optional
|
| 10 |
+
export VISSLIDEBENCH_JUDGE=gpt-4.1 # optional, default gpt-4.1
|
| 11 |
+
```
|
| 12 |
+
|
| 13 |
+
## Predictions
|
| 14 |
+
|
| 15 |
+
Generate one image per case and save it as `<pred_dir>/<track>/<id>.png`,
|
| 16 |
+
where `<track>` is `t2i`, `template`, `multi_image`, or `edit` and `<id>` is the
|
| 17 |
+
`id` field. Our runs generate t2i cases at 1280x720 and template, multi_image
|
| 18 |
+
and edit cases at the record's `width` and `height`, with seed `2233 + index`
|
| 19 |
+
for case `index`.
|
| 20 |
+
|
| 21 |
+
## Scoring
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
cd VisSlideBench
|
| 25 |
+
for t in t2i template multi_image; do
|
| 26 |
+
python eval/run_ocr.py --task $t --pred_dir $PRED --device gpu:0
|
| 27 |
+
python eval/score_generation.py --task $t --pred_dir $PRED --workers 16
|
| 28 |
+
done
|
| 29 |
+
python eval/score_edit.py --pred_dir $PRED --workers 16
|
| 30 |
+
python eval/aggregate.py --pred_dir $PRED # Table 1 layout
|
| 31 |
+
python eval/aggregate.py --pred_dir $PRED --by source # real vs synthetic
|
| 32 |
+
python eval/aggregate.py --pred_dir $PRED --by prompt_type # short / long / style_json
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
Per-case scores go to `<pred_dir>/scores/<track>.jsonl`. A case that fails a
|
| 36 |
+
metric (missing image, no OCR text, no required text in the instruction, or a
|
| 37 |
+
judge error after three retries) has no value for that metric and is left out
|
| 38 |
+
of that metric's average.
|
| 39 |
+
|
| 40 |
+
## Judge settings
|
| 41 |
+
|
| 42 |
+
| Call | Prompt | Temperature | Max tokens |
|
| 43 |
+
|---|---|---:|---:|
|
| 44 |
+
| Required-text extraction (CF) | in `score_generation.py` | 0.2 | 800 |
|
| 45 |
+
| Input-image preservation (multi_image CF) | `prompts/content_faithfulness.txt` | 0.2 | 1200 |
|
| 46 |
+
| Instruction Following | `prompts/style_instruction_following_{text,json}.txt` | 0.2 | 2000 |
|
| 47 |
+
| Aesthetic Quality | `prompts/aesthetic_quality.txt` | 0.2 | 2000 |
|
| 48 |
+
| Edit success + consistency | `prompts/edit_evaluation_source_control.txt` | 0.7 | 512 |
|
| 49 |
+
| Edit presentation quality | `prompts/edit_evaluation_quality.txt` | 0.7 | 512 |
|
| 50 |
+
|
| 51 |
+
Images sent to the judge are JPEG-encoded with the long side capped at 1,600
|
| 52 |
+
pixels and `detail: high`.
|
eval/aggregate.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Combine per-task score files into the VisSlideBench summary (Table 1 layout).
|
| 2 |
+
|
| 3 |
+
python eval/aggregate.py --pred_dir outputs/my_model
|
| 4 |
+
|
| 5 |
+
Each metric is averaged over the cases with a valid score for that metric.
|
| 6 |
+
Overall is the mean of the eleven metrics (CF/IF/AQ for three generation
|
| 7 |
+
tasks, SC/PQ for editing) and is reported only when all four tasks exist.
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import argparse
|
| 11 |
+
import json
|
| 12 |
+
import os
|
| 13 |
+
|
| 14 |
+
from common import load_jsonl, mean
|
| 15 |
+
|
| 16 |
+
GEN_TASKS = ("t2i", "template", "multi_image")
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main():
|
| 20 |
+
ap = argparse.ArgumentParser()
|
| 21 |
+
ap.add_argument("--pred_dir", required=True)
|
| 22 |
+
ap.add_argument("--by", choices=["none", "source", "prompt_type"], default="none",
|
| 23 |
+
help="Optionally split generation scores by real/synthetic source or prompt type.")
|
| 24 |
+
args = ap.parse_args()
|
| 25 |
+
score_dir = os.path.join(args.pred_dir, "scores")
|
| 26 |
+
|
| 27 |
+
table, metrics = {}, []
|
| 28 |
+
for task in GEN_TASKS:
|
| 29 |
+
path = os.path.join(score_dir, f"{task}.jsonl")
|
| 30 |
+
if not os.path.exists(path):
|
| 31 |
+
continue
|
| 32 |
+
rows = load_jsonl(path)
|
| 33 |
+
groups = {"all": rows} if args.by == "none" else {}
|
| 34 |
+
if args.by != "none":
|
| 35 |
+
for r in rows:
|
| 36 |
+
groups.setdefault(r.get(args.by), []).append(r)
|
| 37 |
+
for g, rs in groups.items():
|
| 38 |
+
entry = {m: mean(r[m] for r in rs if r.get(m) is not None) for m in ("cf", "if", "aq")}
|
| 39 |
+
entry["n"] = len(rs)
|
| 40 |
+
table[task if g == "all" else f"{task}/{g}"] = entry
|
| 41 |
+
if args.by == "none":
|
| 42 |
+
metrics += [table[task][m] for m in ("cf", "if", "aq")]
|
| 43 |
+
|
| 44 |
+
edit_path = os.path.join(score_dir, "edit.jsonl")
|
| 45 |
+
if os.path.exists(edit_path):
|
| 46 |
+
ok = [r for r in load_jsonl(edit_path) if "sc" in r]
|
| 47 |
+
sc, pq = mean(r["sc"] for r in ok), mean(r["pq"] for r in ok)
|
| 48 |
+
table["edit"] = {"sc": sc, "pq": pq, "n": len(ok)}
|
| 49 |
+
metrics += [sc, pq]
|
| 50 |
+
|
| 51 |
+
if args.by == "none" and len(metrics) == 11 and None not in metrics:
|
| 52 |
+
table["overall"] = mean(metrics)
|
| 53 |
+
print(json.dumps(table, indent=1))
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
if __name__ == "__main__":
|
| 57 |
+
main()
|
eval/common.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Shared helpers for VisSlideBench evaluation.
|
| 2 |
+
|
| 3 |
+
The judge is any OpenAI-compatible chat endpoint. Configure it with
|
| 4 |
+
environment variables; nothing is hard-coded:
|
| 5 |
+
|
| 6 |
+
export OPENAI_API_KEY=...
|
| 7 |
+
export OPENAI_BASE_URL=... # optional, defaults to the official endpoint
|
| 8 |
+
export VISSLIDEBENCH_JUDGE=gpt-4.1 # optional
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import base64
|
| 12 |
+
import json
|
| 13 |
+
import os
|
| 14 |
+
import re
|
| 15 |
+
import time
|
| 16 |
+
from io import BytesIO
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
from PIL import Image
|
| 20 |
+
|
| 21 |
+
BENCH_ROOT = Path(__file__).resolve().parents[1]
|
| 22 |
+
PROMPT_DIR = Path(__file__).resolve().parent / "prompts"
|
| 23 |
+
JUDGE_MODEL = os.environ.get("VISSLIDEBENCH_JUDGE", "gpt-4.1")
|
| 24 |
+
MAX_RETRIES = 3
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def load_jsonl(path):
|
| 28 |
+
with open(path, "r", encoding="utf-8") as f:
|
| 29 |
+
return [json.loads(line) for line in f if line.strip()]
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def write_jsonl(path, rows):
|
| 33 |
+
Path(path).parent.mkdir(parents=True, exist_ok=True)
|
| 34 |
+
with open(path, "w", encoding="utf-8") as f:
|
| 35 |
+
for row in rows:
|
| 36 |
+
f.write(json.dumps(row, ensure_ascii=False) + "\n")
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def load_prompt(name):
|
| 40 |
+
return (PROMPT_DIR / name).read_text(encoding="utf-8")
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def bench_path(rel):
|
| 44 |
+
return str(BENCH_ROOT / rel)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def get_client():
|
| 48 |
+
from openai import OpenAI
|
| 49 |
+
|
| 50 |
+
return OpenAI() # credentials and endpoint come from OPENAI_API_KEY / OPENAI_BASE_URL
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def image_to_data_uri(path, max_size=1600):
|
| 54 |
+
"""JPEG-encode an image with its long side capped at `max_size` pixels."""
|
| 55 |
+
img = Image.open(path).convert("RGB")
|
| 56 |
+
w, h = img.size
|
| 57 |
+
if max(w, h) > max_size:
|
| 58 |
+
r = max_size / max(w, h)
|
| 59 |
+
img = img.resize((int(w * r), int(h * r)), Image.LANCZOS)
|
| 60 |
+
buf = BytesIO()
|
| 61 |
+
img.save(buf, format="JPEG", quality=85)
|
| 62 |
+
return "data:image/jpeg;base64," + base64.b64encode(buf.getvalue()).decode("utf-8")
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def image_part(path):
|
| 66 |
+
return {"type": "image_url", "image_url": {"url": image_to_data_uri(path), "detail": "high"}}
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def text_part(text):
|
| 70 |
+
return {"type": "text", "text": text}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def parse_json_block(text):
|
| 74 |
+
"""Return the first JSON object or array found in a model reply."""
|
| 75 |
+
text = text.strip()
|
| 76 |
+
m = re.search(r"```(?:json)?\s*\n(.*?)```", text, re.DOTALL)
|
| 77 |
+
if m:
|
| 78 |
+
text = m.group(1).strip()
|
| 79 |
+
else:
|
| 80 |
+
starts = [i for i in (text.find("{"), text.find("[")) if i >= 0]
|
| 81 |
+
if starts:
|
| 82 |
+
s = min(starts)
|
| 83 |
+
e = max(text.rfind("}"), text.rfind("]"))
|
| 84 |
+
if e > s:
|
| 85 |
+
text = text[s : e + 1]
|
| 86 |
+
return json.loads(text)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def chat(client, system, user_content, temperature, max_tokens):
|
| 90 |
+
"""Call the judge with retries; returns the parsed JSON reply."""
|
| 91 |
+
err = None
|
| 92 |
+
for attempt in range(1, MAX_RETRIES + 1):
|
| 93 |
+
try:
|
| 94 |
+
resp = client.chat.completions.create(
|
| 95 |
+
model=JUDGE_MODEL,
|
| 96 |
+
messages=([{"role": "system", "content": system}] if system else [])
|
| 97 |
+
+ [{"role": "user", "content": user_content}],
|
| 98 |
+
temperature=temperature,
|
| 99 |
+
max_tokens=max_tokens,
|
| 100 |
+
)
|
| 101 |
+
return parse_json_block(resp.choices[0].message.content)
|
| 102 |
+
except Exception as e: # network errors, rate limits, unparsable replies
|
| 103 |
+
err = e
|
| 104 |
+
if attempt < MAX_RETRIES:
|
| 105 |
+
time.sleep(2 ** attempt)
|
| 106 |
+
raise RuntimeError(f"judge call failed after {MAX_RETRIES} attempts: {err}")
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def mean(xs):
|
| 110 |
+
xs = list(xs)
|
| 111 |
+
return sum(xs) / len(xs) if xs else None
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def subdimension_mean(result):
|
| 115 |
+
"""Unweighted mean of the per-dimension `score` fields of a judge reply.
|
| 116 |
+
|
| 117 |
+
The judge also returns an `overall_score`; it is not used.
|
| 118 |
+
"""
|
| 119 |
+
scores = [v["score"] for v in result.values() if isinstance(v, dict) and "score" in v]
|
| 120 |
+
return mean(float(s) for s in scores)
|
eval/prompts/aesthetic_quality.txt
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an expert evaluator for AI-generated presentation slides. Your task is to assess the Aesthetic Quality of a generated slide image.
|
| 2 |
+
|
| 3 |
+
Your default stance is skeptical and conservative. Start from the assumption that the slide is NOT professional unless clear visual evidence proves otherwise. Do not reward creativity, attractiveness, or stylistic ambition unless execution quality is objectively strong.
|
| 4 |
+
|
| 5 |
+
## Evaluation Dimension: Aesthetic Quality
|
| 6 |
+
|
| 7 |
+
This dimension evaluates whether the generated slide looks like a professional, readable, structurally coherent, and realistically usable PPT page. The focus is on visual communication effectiveness, layout discipline, readability, consistency, and production-level polish.
|
| 8 |
+
|
| 9 |
+
Aesthetic appeal alone MUST NOT increase the score.
|
| 10 |
+
|
| 11 |
+
## Inputs
|
| 12 |
+
|
| 13 |
+
1. **Generated Slide Image**: The AI-generated slide image to be evaluated.
|
| 14 |
+
|
| 15 |
+
## Mandatory Evaluation Procedure
|
| 16 |
+
|
| 17 |
+
Follow this exact order:
|
| 18 |
+
|
| 19 |
+
1. Inspect the entire slide globally before scoring.
|
| 20 |
+
2. Extract all observable visual qualities and defects related to readability, spacing, alignment, consistency, hierarchy, and presentation polish.
|
| 21 |
+
3. For each sub-dimension, explicitly identify:
|
| 22 |
+
- strengths
|
| 23 |
+
- weaknesses
|
| 24 |
+
- visible defects
|
| 25 |
+
4. Count all visible issues. Any noticeable issue counts as a mismatch.
|
| 26 |
+
5. Apply hard score caps before assigning scores.
|
| 27 |
+
6. Compute the overall score as the mean of the sub-dimension scores.
|
| 28 |
+
|
| 29 |
+
Never score first and justify later.
|
| 30 |
+
|
| 31 |
+
If a feature is ambiguous, partially visible, blurry, cropped, distorted, or difficult to verify, treat it as a defect rather than assuming correctness.
|
| 32 |
+
|
| 33 |
+
## Evaluation Criteria
|
| 34 |
+
|
| 35 |
+
Evaluate the following sub-dimensions carefully:
|
| 36 |
+
|
| 37 |
+
### 1. Clarity
|
| 38 |
+
Evaluate readability and information communication quality.
|
| 39 |
+
|
| 40 |
+
Check:
|
| 41 |
+
- Are all text elements clearly legible?
|
| 42 |
+
- Is font size sufficient for presentation viewing?
|
| 43 |
+
- Is contrast between text and background adequate?
|
| 44 |
+
- Is the hierarchy between title, subtitle, body text, captions, and highlights visually obvious?
|
| 45 |
+
- Is reading order natural and effortless?
|
| 46 |
+
- Are charts, icons, diagrams, and images recognizable and not blurry?
|
| 47 |
+
- Is information density appropriate?
|
| 48 |
+
|
| 49 |
+
Penalize:
|
| 50 |
+
- Small or crowded text
|
| 51 |
+
- Low contrast
|
| 52 |
+
- Visual noise
|
| 53 |
+
- Overlapping elements
|
| 54 |
+
- Ambiguous hierarchy
|
| 55 |
+
- Cluttered composition
|
| 56 |
+
- Illegible charts/tables
|
| 57 |
+
- Excessive decoration that harms readability
|
| 58 |
+
|
| 59 |
+
### 2. Layout
|
| 60 |
+
Evaluate structural organization and spatial discipline.
|
| 61 |
+
|
| 62 |
+
Check:
|
| 63 |
+
- Are elements aligned consistently?
|
| 64 |
+
- Is spacing between blocks visually even and intentional?
|
| 65 |
+
- Is whitespace used effectively?
|
| 66 |
+
- Is the composition balanced?
|
| 67 |
+
- Are margins clean and professional?
|
| 68 |
+
- Is the slide visually stable rather than chaotic?
|
| 69 |
+
- Are elements properly grouped?
|
| 70 |
+
|
| 71 |
+
Penalize:
|
| 72 |
+
- Misalignment
|
| 73 |
+
- Uneven spacing
|
| 74 |
+
- Cramped layout
|
| 75 |
+
- Excessive empty space
|
| 76 |
+
- Floating or disconnected elements
|
| 77 |
+
- Poor balance
|
| 78 |
+
- Edge crowding
|
| 79 |
+
- Inconsistent sizing
|
| 80 |
+
- Random placement
|
| 81 |
+
|
| 82 |
+
### 3. Style Coherence
|
| 83 |
+
Evaluate visual consistency and design system coherence.
|
| 84 |
+
|
| 85 |
+
Check:
|
| 86 |
+
- Are colors used consistently?
|
| 87 |
+
- Are typography choices coherent?
|
| 88 |
+
- Do containers/cards/shapes follow a unified style?
|
| 89 |
+
- Are illustration styles consistent?
|
| 90 |
+
- Are icon styles visually compatible?
|
| 91 |
+
- Is decoration applied consistently across blocks?
|
| 92 |
+
- Does the slide feel like one unified design system?
|
| 93 |
+
|
| 94 |
+
Penalize:
|
| 95 |
+
- Mixed visual styles
|
| 96 |
+
- Inconsistent fonts
|
| 97 |
+
- Random accent colors
|
| 98 |
+
- Incompatible iconography
|
| 99 |
+
- Uneven border/shadow usage
|
| 100 |
+
- Inconsistent image treatment
|
| 101 |
+
- Decorative elements that conflict stylistically
|
| 102 |
+
- Abrupt style changes between blocks
|
| 103 |
+
|
| 104 |
+
### 4. Presentation Professionalism
|
| 105 |
+
Evaluate whether the slide resembles a realistic, production-quality professional PPT.
|
| 106 |
+
|
| 107 |
+
Check:
|
| 108 |
+
- Does the slide look polished and presentation-ready?
|
| 109 |
+
- Would the slide be acceptable in a business, academic, investor, consulting, or conference setting?
|
| 110 |
+
- Is the visual quality comparable to professionally designed slides?
|
| 111 |
+
- Does the slide avoid common AI-generation artifacts?
|
| 112 |
+
- Does the slide appear intentional rather than auto-generated?
|
| 113 |
+
|
| 114 |
+
Penalize:
|
| 115 |
+
- Obvious AI artifacts
|
| 116 |
+
- Distorted text or shapes
|
| 117 |
+
- Unrealistic layout behavior
|
| 118 |
+
- Amateur styling
|
| 119 |
+
- Excessive gimmicks
|
| 120 |
+
- Poor typography discipline
|
| 121 |
+
- Inconsistent rendering quality
|
| 122 |
+
- Visually cheap or template-like appearance
|
| 123 |
+
- Lack of refinement
|
| 124 |
+
|
| 125 |
+
## Strict Scoring Rules
|
| 126 |
+
|
| 127 |
+
You MUST apply these hard constraints strictly.
|
| 128 |
+
|
| 129 |
+
### General Rules
|
| 130 |
+
- Every visible issue counts as a mismatch.
|
| 131 |
+
- Small defects still require deduction.
|
| 132 |
+
- Do NOT assume missing details are correct.
|
| 133 |
+
- If uncertain between two scores, choose the lower one.
|
| 134 |
+
- Aesthetic attractiveness MUST NOT compensate for structural or readability flaws.
|
| 135 |
+
|
| 136 |
+
### Sub-dimension Caps
|
| 137 |
+
- Score 9-10 ONLY if there are essentially no noticeable flaws.
|
| 138 |
+
- Score 8 is allowed only for very minor defects.
|
| 139 |
+
- Any clearly noticeable defect caps the sub-dimension at 7.
|
| 140 |
+
- Two or more noticeable defects cap the sub-dimension at 6.
|
| 141 |
+
- Any major readability/layout/professionalism issue caps the sub-dimension at 5.
|
| 142 |
+
- Multiple major issues cap the sub-dimension at 4 or below.
|
| 143 |
+
- Severe readability failure MUST score 3 or below.
|
| 144 |
+
|
| 145 |
+
### Automatic Major Defects
|
| 146 |
+
The following are considered major defects:
|
| 147 |
+
- Illegible or blurry text
|
| 148 |
+
- Overlapping content
|
| 149 |
+
- Broken hierarchy
|
| 150 |
+
- Chaotic layout
|
| 151 |
+
- Severe alignment inconsistency
|
| 152 |
+
- Strong visual clutter
|
| 153 |
+
- Distorted charts/icons
|
| 154 |
+
- Mixed incompatible styles
|
| 155 |
+
- Obvious AI rendering artifacts
|
| 156 |
+
- Unprofessional appearance
|
| 157 |
+
|
| 158 |
+
## Scoring Rubric
|
| 159 |
+
|
| 160 |
+
- **9-10 (Excellent)**: Extremely polished, highly readable, visually disciplined, and indistinguishable from a professionally designed presentation slide. No meaningful flaws.
|
| 161 |
+
- **7-8 (Good)**: Strong overall quality, but includes noticeable issues in spacing, hierarchy, consistency, or polish.
|
| 162 |
+
- **5-6 (Fair)**: Moderately effective but contains multiple visible weaknesses that reduce professionalism or readability.
|
| 163 |
+
- **3-4 (Poor)**: Significant design and communication problems. Slide appears unrefined or structurally weak.
|
| 164 |
+
- **1-2 (Very Poor)**: Severely unreadable, chaotic, inconsistent, or obviously broken. Does not resemble a usable professional PPT slide.
|
| 165 |
+
|
| 166 |
+
## Scoring Bias Control
|
| 167 |
+
|
| 168 |
+
- Do not use 8 as a default “safe” score.
|
| 169 |
+
- Prefer 5-7 unless evidence strongly supports higher quality.
|
| 170 |
+
- Do not reward effort, complexity, or decoration.
|
| 171 |
+
- Professional simplicity should score higher than decorative clutter.
|
| 172 |
+
- Conservative scoring is preferred.
|
| 173 |
+
|
| 174 |
+
## Output Format
|
| 175 |
+
|
| 176 |
+
You MUST respond in the following JSON format ONLY. Do not include any other text:
|
| 177 |
+
|
| 178 |
+
```json
|
| 179 |
+
{
|
| 180 |
+
"clarity": {
|
| 181 |
+
"score": <1-10>,
|
| 182 |
+
"reasoning": "<brief explanation with concrete evidence>"
|
| 183 |
+
},
|
| 184 |
+
"layout": {
|
| 185 |
+
"score": <1-10>,
|
| 186 |
+
"reasoning": "<brief explanation with concrete evidence>"
|
| 187 |
+
},
|
| 188 |
+
"style_coherence": {
|
| 189 |
+
"score": <1-10>,
|
| 190 |
+
"reasoning": "<brief explanation with concrete evidence>"
|
| 191 |
+
},
|
| 192 |
+
"presentation_professionalism": {
|
| 193 |
+
"score": <1-10>,
|
| 194 |
+
"reasoning": "<brief explanation with concrete evidence>"
|
| 195 |
+
},
|
| 196 |
+
"overall_score": <1-10 mean of the sub-dimension scores>,
|
| 197 |
+
"overall_reasoning": "<2-3 sentence summary grounded in visible strengths and defects>"
|
| 198 |
+
}
|
eval/prompts/content_faithfulness.txt
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an expert evaluator for AI-generated presentation slides.
|
| 2 |
+
|
| 3 |
+
Your task is to assess **Content Faithfulness** by rigorously verifying whether all required sub-images in a provided sub-image list are correctly represented in the generated PPT.
|
| 4 |
+
|
| 5 |
+
Your default stance is skeptical and conservative. Do NOT assume a sub-image is correctly matched unless there is strong visual evidence. Partial similarity is NOT sufficient for full credit.
|
| 6 |
+
|
| 7 |
+
The focus is strict faithfulness to required content, NOT aesthetic quality.
|
| 8 |
+
|
| 9 |
+
## Evaluation Target
|
| 10 |
+
|
| 11 |
+
Evaluate whether every required sub-image (content block) from the sub-image list appears in the generated PPT with:
|
| 12 |
+
|
| 13 |
+
- correct semantic content
|
| 14 |
+
- correct visual identity
|
| 15 |
+
- correct structural composition
|
| 16 |
+
- reasonable positional/layout consistency
|
| 17 |
+
|
| 18 |
+
Each sub-image may represent:
|
| 19 |
+
- charts
|
| 20 |
+
- tables
|
| 21 |
+
- figures
|
| 22 |
+
- diagrams
|
| 23 |
+
- screenshots
|
| 24 |
+
- icon groups
|
| 25 |
+
- text blocks
|
| 26 |
+
- mixed visual compositions
|
| 27 |
+
|
| 28 |
+
You MUST verify each required sub-image individually before assigning scores.
|
| 29 |
+
|
| 30 |
+
## Inputs
|
| 31 |
+
|
| 32 |
+
1. **Generated PPT**: The AI-generated presentation file to be evaluated.
|
| 33 |
+
2. **Sub-Image List**: A list of required sub-images that must appear in the generated PPT.
|
| 34 |
+
|
| 35 |
+
## Mandatory Evaluation Procedure
|
| 36 |
+
|
| 37 |
+
Follow this exact order:
|
| 38 |
+
|
| 39 |
+
1. Enumerate all required sub-images from the sub-image list.
|
| 40 |
+
2. For EACH required sub-image:
|
| 41 |
+
- search for the best matching region/page in the generated PPT
|
| 42 |
+
- determine whether it is:
|
| 43 |
+
- EXACT_MATCH
|
| 44 |
+
- PARTIAL_MATCH
|
| 45 |
+
- FAIL
|
| 46 |
+
- NOT_FOUND
|
| 47 |
+
3. Explicitly verify:
|
| 48 |
+
- semantic content
|
| 49 |
+
- major text
|
| 50 |
+
- chart/table meaning
|
| 51 |
+
- visual composition
|
| 52 |
+
- structural arrangement
|
| 53 |
+
4. Count mismatches:
|
| 54 |
+
- PARTIAL_MATCH counts as a mismatch
|
| 55 |
+
- FAIL counts as a mismatch
|
| 56 |
+
- NOT_FOUND counts as a major mismatch
|
| 57 |
+
5. Apply hard score caps before assigning the final score.
|
| 58 |
+
6. Compute final score conservatively.
|
| 59 |
+
|
| 60 |
+
Never score first and justify later.
|
| 61 |
+
|
| 62 |
+
If content is blurry, ambiguous, cropped, occluded, distorted, or difficult to verify, treat it as NOT fully matched.
|
| 63 |
+
|
| 64 |
+
## Evaluation Criteria
|
| 65 |
+
|
| 66 |
+
### 1. Coverage Completeness
|
| 67 |
+
Check whether ALL required sub-images are present.
|
| 68 |
+
|
| 69 |
+
Requirements:
|
| 70 |
+
- Every required sub-image must appear somewhere in the PPT.
|
| 71 |
+
- Presence alone is NOT enough; the matched region must clearly correspond to the intended content block.
|
| 72 |
+
- Missing required sub-images are major failures.
|
| 73 |
+
|
| 74 |
+
Penalize:
|
| 75 |
+
- Missing blocks
|
| 76 |
+
- Replaced blocks
|
| 77 |
+
- Hallucinated substitute content
|
| 78 |
+
- Severe cropping
|
| 79 |
+
- Wrong slide/page placement if it breaks intended correspondence
|
| 80 |
+
|
| 81 |
+
### 2. Content Correctness
|
| 82 |
+
Check whether matched sub-images preserve the intended semantic content.
|
| 83 |
+
|
| 84 |
+
Verify:
|
| 85 |
+
- Main text content
|
| 86 |
+
- Key labels
|
| 87 |
+
- Chart type and meaning
|
| 88 |
+
- Table structure and values (when visible)
|
| 89 |
+
- Diagram semantics
|
| 90 |
+
- Important icons/symbols
|
| 91 |
+
- Core visual identity
|
| 92 |
+
|
| 93 |
+
Penalize:
|
| 94 |
+
- Wrong chart type
|
| 95 |
+
- Incorrect labels
|
| 96 |
+
- Missing important elements
|
| 97 |
+
- Hallucinated text
|
| 98 |
+
- Semantic mismatch
|
| 99 |
+
- Incorrect data relationships
|
| 100 |
+
- Wrong figure identity
|
| 101 |
+
- Fake or placeholder content
|
| 102 |
+
|
| 103 |
+
Superficial resemblance is NOT sufficient.
|
| 104 |
+
|
| 105 |
+
### 3. Visual / Structural Consistency
|
| 106 |
+
Check whether the matched content block is structurally consistent with the required sub-image.
|
| 107 |
+
|
| 108 |
+
Verify:
|
| 109 |
+
- Overall composition
|
| 110 |
+
- Relative arrangement of elements
|
| 111 |
+
- Element grouping
|
| 112 |
+
- Layout pattern
|
| 113 |
+
- Visual hierarchy
|
| 114 |
+
- Spatial organization
|
| 115 |
+
|
| 116 |
+
Minor stylistic differences are acceptable ONLY if the semantic and structural identity remain clearly faithful.
|
| 117 |
+
|
| 118 |
+
Penalize:
|
| 119 |
+
- Major layout restructuring
|
| 120 |
+
- Missing key visual regions
|
| 121 |
+
- Incorrect element arrangement
|
| 122 |
+
- Collapsed or merged structures
|
| 123 |
+
- Broken hierarchy
|
| 124 |
+
- Distorted composition
|
| 125 |
+
|
| 126 |
+
## Strict Scoring Rules
|
| 127 |
+
|
| 128 |
+
You MUST apply these hard constraints strictly.
|
| 129 |
+
|
| 130 |
+
### General Principles
|
| 131 |
+
- Any missing required sub-image is a major error.
|
| 132 |
+
- Any ambiguous match should be downgraded.
|
| 133 |
+
- Similar-looking but semantically incorrect content is a FAIL.
|
| 134 |
+
- Do NOT infer correctness from approximate appearance alone.
|
| 135 |
+
- If uncertain between two scores, choose the lower score.
|
| 136 |
+
|
| 137 |
+
### Match-Level Interpretation
|
| 138 |
+
- EXACT_MATCH:
|
| 139 |
+
- Correct semantic content
|
| 140 |
+
- Correct structural composition
|
| 141 |
+
- No meaningful missing elements
|
| 142 |
+
- PARTIAL_MATCH:
|
| 143 |
+
- Some recognizable correspondence exists
|
| 144 |
+
- But important content/structure differs or is missing
|
| 145 |
+
- FAIL:
|
| 146 |
+
- Wrong semantic content
|
| 147 |
+
- Wrong structure
|
| 148 |
+
- Hallucinated replacement
|
| 149 |
+
- Severe distortion
|
| 150 |
+
- NOT_FOUND:
|
| 151 |
+
- Required sub-image cannot be reliably identified anywhere in the PPT
|
| 152 |
+
|
| 153 |
+
### Hard Score Caps
|
| 154 |
+
- Any NOT_FOUND item caps overall_score at 6.
|
| 155 |
+
- Two or more NOT_FOUND items cap overall_score at 4.
|
| 156 |
+
- Any major semantic mismatch caps overall_score at 5.
|
| 157 |
+
- Multiple FAIL items cap overall_score at 4.
|
| 158 |
+
- If more than 30% of sub-images are PARTIAL_MATCH or worse, overall_score MUST NOT exceed 6.
|
| 159 |
+
- If more than 50% are PARTIAL_MATCH or worse, overall_score MUST NOT exceed 4.
|
| 160 |
+
- Perfect scores (9-10) are ONLY allowed when ALL required sub-images are present with near-perfect semantic and structural fidelity.
|
| 161 |
+
|
| 162 |
+
### Severity Guidelines
|
| 163 |
+
Major errors include:
|
| 164 |
+
- Missing required block
|
| 165 |
+
- Wrong chart/table/diagram identity
|
| 166 |
+
- Incorrect semantic meaning
|
| 167 |
+
- Hallucinated replacement content
|
| 168 |
+
- Major structural mismatch
|
| 169 |
+
- Severe cropping or truncation
|
| 170 |
+
|
| 171 |
+
Minor errors include:
|
| 172 |
+
- Small local visual deviations
|
| 173 |
+
- Slight spacing/layout changes
|
| 174 |
+
- Minor style differences
|
| 175 |
+
- Small non-critical omissions
|
| 176 |
+
|
| 177 |
+
## Scoring Rubric (1-10)
|
| 178 |
+
|
| 179 |
+
- **9-10 (Excellent)**: All required sub-images are present with highly accurate semantic and structural fidelity. No meaningful mismatches.
|
| 180 |
+
- **7-8 (Good)**: Most required sub-images are correct, but some minor omissions or structural inconsistencies exist.
|
| 181 |
+
- **5-6 (Fair)**: Noticeable missing, partial, or incorrect sub-images reduce overall faithfulness.
|
| 182 |
+
- **3-4 (Poor)**: Many required sub-images are missing, structurally wrong, or semantically incorrect.
|
| 183 |
+
- **1-2 (Very Poor)**: Most required content is absent, hallucinated, or fundamentally mismatched.
|
| 184 |
+
|
| 185 |
+
## Scoring Bias Control
|
| 186 |
+
|
| 187 |
+
- Do NOT use score 8 as a default safe score.
|
| 188 |
+
- Prefer conservative scoring.
|
| 189 |
+
- Similar appearance alone MUST NOT receive high scores.
|
| 190 |
+
- Semantic correctness is more important than visual attractiveness.
|
| 191 |
+
- Presence alone is insufficient without content fidelity.
|
| 192 |
+
- If evidence is weak or unclear, lower the score.
|
| 193 |
+
|
| 194 |
+
## Output Format
|
| 195 |
+
|
| 196 |
+
You MUST respond in the following JSON format ONLY. Do not include any other text:
|
| 197 |
+
|
| 198 |
+
```json
|
| 199 |
+
{
|
| 200 |
+
"overall_score": <1-10>,
|
| 201 |
+
"overall_reasoning": "<2-4 sentence summary explicitly discussing missing sub-images, semantic mismatches, structural inconsistencies, and overall faithfulness quality>"
|
| 202 |
+
}
|
eval/prompts/edit_evaluation_quality.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an expert evaluator for instruction-guided slide image editing.
|
| 2 |
+
All images are AI-generated slide pages. Focus on the editing result itself.
|
| 3 |
+
|
| 4 |
+
IMPORTANT: Return exactly one JSON object in this format:
|
| 5 |
+
{
|
| 6 |
+
"reasoning": "...",
|
| 7 |
+
"score": [...]
|
| 8 |
+
}
|
| 9 |
+
Keep the reasoning concise.
|
| 10 |
+
|
| 11 |
+
RULES:
|
| 12 |
+
|
| 13 |
+
One edited slide image will be provided.
|
| 14 |
+
Evaluate the presentation quality of the edited slide page itself using a 0 to 10 scale for each dimension:
|
| 15 |
+
1. Clarity: text/chart readability, hierarchy, and reading order.
|
| 16 |
+
2. Layout: alignment, spacing, composition balance, and use of whitespace.
|
| 17 |
+
3. Style Coherence: consistency of colors, fonts, decoration, and image style.
|
| 18 |
+
4. Presentation Professionalism: whether the page looks polished and like a real professional slide.
|
| 19 |
+
|
| 20 |
+
Return:
|
| 21 |
+
{
|
| 22 |
+
"reasoning": "...",
|
| 23 |
+
"score": [clarity, layout, style_coherence, presentation_professionalism]
|
| 24 |
+
}
|
eval/prompts/edit_evaluation_source_control.txt
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an expert evaluator for instruction-guided slide image editing.
|
| 2 |
+
All images are AI-generated slide pages. Focus on the editing result itself.
|
| 3 |
+
|
| 4 |
+
IMPORTANT: Return exactly one JSON object in this format:
|
| 5 |
+
{
|
| 6 |
+
"reasoning": "...",
|
| 7 |
+
"score": [...]
|
| 8 |
+
}
|
| 9 |
+
Keep the reasoning concise.
|
| 10 |
+
|
| 11 |
+
RULES:
|
| 12 |
+
|
| 13 |
+
Two images will be provided: the first is the source slide and the second is the edited slide.
|
| 14 |
+
Evaluate whether the edit instruction is correctly applied while preserving all content that should remain unchanged.
|
| 15 |
+
|
| 16 |
+
Use a 0 to 10 scale for both scores:
|
| 17 |
+
1. Editing Success: 0 means the instruction is not followed at all, 10 means the requested slide edit is executed perfectly.
|
| 18 |
+
2. Overediting: 0 means the slide is unnecessarily changed or damaged, 10 means only the intended parts are changed and the rest is preserved well.
|
| 19 |
+
|
| 20 |
+
Return:
|
| 21 |
+
{
|
| 22 |
+
"reasoning": "...",
|
| 23 |
+
"score": [editing_success, overediting]
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
Instruction: <instruction>
|
eval/prompts/style_instruction_following_json.txt
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an expert evaluator for AI-generated presentation slides. Your task is to assess how well a generated slide image follows the style instructions defined in a structured Style JSON specification.
|
| 2 |
+
|
| 3 |
+
Your default stance is skeptical and conservative. Start from strict compliance assumptions and deduct for every mismatch. Do not reward visual attractiveness.
|
| 4 |
+
|
| 5 |
+
## Evaluation Dimension: Style Instruction Following
|
| 6 |
+
|
| 7 |
+
This dimension evaluates whether the generated slide image faithfully follows the given style specification. The focus is NOT on whether the result looks beautiful, but on whether it was made according to the requirements. The evaluation MUST be based on strict comparison with the Style JSON. Visual appeal or subjective quality MUST NOT influence the score. Even small deviations from the specification should be penalized.
|
| 8 |
+
|
| 9 |
+
## Inputs
|
| 10 |
+
|
| 11 |
+
1. **Style JSON**: A structured JSON specification that defines the visual style requirements for the slide, including:
|
| 12 |
+
- `global_style`: Theme name, background (color, gradient, texture, pattern), font palette, color palette, and special instructions
|
| 13 |
+
- `visual_hierarchy`: Mood/tone and composition style
|
| 14 |
+
- `styled_slides[].blocks`: Individual content blocks with their style attributes (color, font, position, container, text effects, etc.)
|
| 15 |
+
|
| 16 |
+
2. **Generated Slide Image**: The AI-generated slide image that should conform to the Style JSON specification.
|
| 17 |
+
|
| 18 |
+
3. **Reference Slide Image(s) [optional]**: One slide from the same presentation, generated earlier in the same deck. Use these only to infer the visual style of the presentation, such as palette, typography, background treatment, decorative motifs, and overall aesthetic language. Do NOT use them to infer or judge the target slide's layout, block positions, or content placement unless those details are explicitly present in the Style JSON.
|
| 19 |
+
|
| 20 |
+
You MUST explicitly check each requirement in the Style JSON and verify whether it is present in the generated slide. Do NOT assume correctness without visual evidence.
|
| 21 |
+
|
| 22 |
+
You MUST perform requirement-by-requirement verification before scoring. If an item cannot be clearly verified from the image, treat it as not satisfied.
|
| 23 |
+
|
| 24 |
+
## Mandatory Evaluation Procedure
|
| 25 |
+
|
| 26 |
+
Follow this exact order:
|
| 27 |
+
|
| 28 |
+
1. Extract all checkable requirements from Style JSON (global + hierarchy + block-level).
|
| 29 |
+
2. For each requirement, assign one status: PASS / PARTIAL / FAIL / NOT_VERIFIABLE.
|
| 30 |
+
3. Count mismatches. Any PARTIAL, FAIL, or NOT_VERIFIABLE counts as a mismatch.
|
| 31 |
+
4. Apply hard score caps first (see Strict Scoring Rules), then assign sub-dimension scores.
|
| 32 |
+
5. Compute the overall score as the mean of the sub-dimension scores.
|
| 33 |
+
|
| 34 |
+
Never skip steps. Never score first and justify later.
|
| 35 |
+
|
| 36 |
+
## Evaluation Criteria
|
| 37 |
+
|
| 38 |
+
Evaluate the following sub-dimensions carefully:
|
| 39 |
+
|
| 40 |
+
### 1. Background Compliance
|
| 41 |
+
- Does the background color match the specified hex code?
|
| 42 |
+
- If a gradient is specified, does the background show the correct gradient direction and colors?
|
| 43 |
+
- Are specified textures (paper, noise, grid, dots) or patterns present?
|
| 44 |
+
|
| 45 |
+
### 2. Color Palette Adherence
|
| 46 |
+
- Does the slide use the specified primary, secondary, text, and accent colors?
|
| 47 |
+
- Are the color relationships (primary vs secondary vs accent) maintained?
|
| 48 |
+
- Do text elements use the specified text color?
|
| 49 |
+
|
| 50 |
+
### 3. Typography Compliance
|
| 51 |
+
- Does the font style match the specified font families (serif vs sans-serif, bold vs regular)?
|
| 52 |
+
- Is the font weight (bold/normal/light) correctly applied?
|
| 53 |
+
- Are text effects (shadow, outline, glow) applied as specified?
|
| 54 |
+
|
| 55 |
+
### 4. Layout & Position Accuracy
|
| 56 |
+
- Are elements positioned as specified (e.g., "top-left", "center", "bottom-right")?
|
| 57 |
+
- Does the composition style match (e.g., centered, two-column, asymmetric, grid-based)?
|
| 58 |
+
- Is the visual hierarchy maintained (dominant elements are larger/more prominent)?
|
| 59 |
+
|
| 60 |
+
### 5. Mood & Atmosphere Match
|
| 61 |
+
- Does the overall mood match the specified mood_tone (e.g., Professional, Technical, Playful)?
|
| 62 |
+
- Are special instructions in the global_style followed?
|
| 63 |
+
- Do decorative elements and visual embellishments match the description?
|
| 64 |
+
|
| 65 |
+
### 6. Block-Level Style Fidelity
|
| 66 |
+
- For each block, are the specified style attributes (container, opacity, special_instructions) followed?
|
| 67 |
+
- Are illustration blocks rendered according to their natural language descriptions?
|
| 68 |
+
- Do image containers have the specified effects (border, shadow, frame)?
|
| 69 |
+
|
| 70 |
+
## Strict Scoring Rules
|
| 71 |
+
|
| 72 |
+
- Any clear mismatch with the Style JSON (e.g., wrong color, incorrect layout, missing effect) MUST result in a score of 6 or below for that sub-dimension.
|
| 73 |
+
- Multiple mismatches in one dimension MUST result in a score of 4 or below.
|
| 74 |
+
- If a key requirement (e.g., background type, layout structure, primary color) is missing or incorrect, the score for that dimension MUST NOT exceed 5.
|
| 75 |
+
- Perfect or near-perfect scores (9-10) are ONLY allowed when there are NO noticeable deviations.
|
| 76 |
+
- If uncertain, always choose the lower score.
|
| 77 |
+
|
| 78 |
+
Additional hard constraints (must enforce):
|
| 79 |
+
|
| 80 |
+
- A sub-dimension can be 9-10 only if ALL its checkable requirements are PASS and zero mismatches exist.
|
| 81 |
+
- A sub-dimension can be at most 8 if there is any PARTIAL.
|
| 82 |
+
- A sub-dimension can be at most 6 if there is any FAIL.
|
| 83 |
+
- A sub-dimension can be at most 5 if any key requirement in that dimension is FAIL or NOT_VERIFIABLE.
|
| 84 |
+
- A sub-dimension can be at most 4 if mismatch count in that dimension is 2 or more.
|
| 85 |
+
- A sub-dimension can be at most 3 if mismatch count in that dimension is 3 or more.
|
| 86 |
+
- Do not give score 7-10 when evidence is weak, ambiguous, occluded, or not visible.
|
| 87 |
+
|
| 88 |
+
## Scoring Rubric
|
| 89 |
+
|
| 90 |
+
- **9-10 (Excellent)**: Nearly perfect match. NO visible mismatches in color, layout, typography, or mood.
|
| 91 |
+
- **7-8 (Good)**: Mostly correct, but includes noticeable deviations that affect fidelity.
|
| 92 |
+
- **5-6 (Fair)**: Multiple deviations or one major mismatch in key style elements.
|
| 93 |
+
- **3-4 (Poor)**: Significant mismatches in several dimensions; style is only partially recognizable.
|
| 94 |
+
- **1-2 (Very Poor)**: Style instructions are largely ignored or contradicted.
|
| 95 |
+
|
| 96 |
+
Scoring bias control:
|
| 97 |
+
|
| 98 |
+
- Do not use score 8 as a default "safe" score.
|
| 99 |
+
- Prefer 5-7 unless there is strong evidence for higher.
|
| 100 |
+
- Aesthetic quality, creativity, readability, and beauty must not raise the score if fidelity is weak.
|
| 101 |
+
- If two score options seem plausible, choose the lower one.
|
| 102 |
+
|
| 103 |
+
## Output Format
|
| 104 |
+
|
| 105 |
+
You MUST respond in the following JSON format ONLY. Do not include any other text:
|
| 106 |
+
|
| 107 |
+
```json
|
| 108 |
+
{
|
| 109 |
+
"background_compliance": {
|
| 110 |
+
"score": <1-10>,
|
| 111 |
+
"reasoning": "<brief explanation>"
|
| 112 |
+
},
|
| 113 |
+
"color_palette_adherence": {
|
| 114 |
+
"score": <1-10>,
|
| 115 |
+
"reasoning": "<brief explanation>"
|
| 116 |
+
},
|
| 117 |
+
"typography_compliance": {
|
| 118 |
+
"score": <1-10>,
|
| 119 |
+
"reasoning": "<brief explanation>"
|
| 120 |
+
},
|
| 121 |
+
"layout_position_accuracy": {
|
| 122 |
+
"score": <1-10>,
|
| 123 |
+
"reasoning": "<brief explanation>"
|
| 124 |
+
},
|
| 125 |
+
"mood_atmosphere_match": {
|
| 126 |
+
"score": <1-10>,
|
| 127 |
+
"reasoning": "<brief explanation>"
|
| 128 |
+
},
|
| 129 |
+
"block_level_style_fidelity": {
|
| 130 |
+
"score": <1-10>,
|
| 131 |
+
"reasoning": "<brief explanation>"
|
| 132 |
+
},
|
| 133 |
+
"overall_score": <1-10 mean of the sub-dimension scores>,
|
| 134 |
+
"overall_reasoning": "<2-3 sentence summary of the overall style instruction following quality>"
|
| 135 |
+
}
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
Reasoning must be evidence-grounded and mention concrete mismatches (for example: wrong hex family, missing texture, incorrect block position, missing effect, wrong hierarchy emphasis).
|
eval/prompts/style_instruction_following_text.txt
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
You are an expert evaluator for AI-generated presentation slides. Your task is to assess how well a generated slide image follows the style instructions defined in a descriptive style specification text.
|
| 2 |
+
|
| 3 |
+
Your default stance is skeptical and conservative. Start from strict compliance assumptions and deduct for every mismatch. Do not reward visual attractiveness.
|
| 4 |
+
|
| 5 |
+
## Evaluation Dimension: Style Instruction Following
|
| 6 |
+
|
| 7 |
+
This dimension evaluates whether the generated slide image faithfully follows the given style specification. The focus is NOT on whether the result looks beautiful, but on whether it was made according to the requirements. The evaluation MUST be based on strict comparison with the style description text. Visual appeal or subjective quality MUST NOT influence the score. Even small deviations from the specification should be penalized.
|
| 8 |
+
|
| 9 |
+
## Inputs
|
| 10 |
+
|
| 11 |
+
1. **Style Description Text**: A descriptive text specification that defines the visual style requirements for the slide, potentially including:
|
| 12 |
+
- Theme name, background style (color, gradient, texture, pattern), font palette, color palette, and special instructions
|
| 13 |
+
- Mood/tone and composition style
|
| 14 |
+
- Block-level style requirements (color, font, position, container, text effects, etc.)
|
| 15 |
+
|
| 16 |
+
2. **Generated Slide Image**: The AI-generated slide image that should conform to the style description text.
|
| 17 |
+
|
| 18 |
+
3. **Reference Slide Image(s) [optional]**: One slide from the same presentation, generated earlier in the same deck. Use these only to infer the visual style of the presentation, such as palette, typography, background treatment, decorative motifs, and overall aesthetic language. Do NOT use them to infer or judge the target slide's layout, block positions, or content placement unless those details are explicitly present in the style description text.
|
| 19 |
+
|
| 20 |
+
You MUST explicitly check each requirement in the style description text and verify whether it is present in the generated slide. Do NOT assume correctness without visual evidence.
|
| 21 |
+
|
| 22 |
+
You MUST perform requirement-by-requirement verification before scoring. If an item cannot be clearly verified from the image, treat it as not satisfied.
|
| 23 |
+
|
| 24 |
+
## Mandatory Evaluation Procedure
|
| 25 |
+
|
| 26 |
+
Follow this exact order:
|
| 27 |
+
|
| 28 |
+
1. Extract all checkable requirements from the style description text (global + hierarchy + block-level).
|
| 29 |
+
2. For each requirement, assign one status: PASS / PARTIAL / FAIL / NOT_VERIFIABLE.
|
| 30 |
+
3. Count mismatches. Any PARTIAL, FAIL, or NOT_VERIFIABLE counts as a mismatch.
|
| 31 |
+
4. Apply hard score caps first (see Strict Scoring Rules), then assign sub-dimension scores.
|
| 32 |
+
5. Compute the overall score as the mean of the sub-dimension scores.
|
| 33 |
+
|
| 34 |
+
Never skip steps. Never score first and justify later.
|
| 35 |
+
|
| 36 |
+
## Evaluation Criteria
|
| 37 |
+
|
| 38 |
+
Evaluate the following sub-dimensions carefully:
|
| 39 |
+
|
| 40 |
+
### 1. Background Compliance
|
| 41 |
+
- Does the background color match the specified hex code?
|
| 42 |
+
- If a gradient is specified, does the background show the correct gradient direction and colors?
|
| 43 |
+
- Are specified textures (paper, noise, grid, dots) or patterns present?
|
| 44 |
+
|
| 45 |
+
### 2. Color Palette Adherence
|
| 46 |
+
- Does the slide use the specified primary, secondary, text, and accent colors?
|
| 47 |
+
- Are the color relationships (primary vs secondary vs accent) maintained?
|
| 48 |
+
- Do text elements use the specified text color?
|
| 49 |
+
|
| 50 |
+
### 3. Typography Compliance
|
| 51 |
+
- Does the font style match the specified font families (serif vs sans-serif, bold vs regular)?
|
| 52 |
+
- Is the font weight (bold/normal/light) correctly applied?
|
| 53 |
+
- Are text effects (shadow, outline, glow) applied as specified?
|
| 54 |
+
|
| 55 |
+
### 4. Layout & Position Accuracy
|
| 56 |
+
- Are elements positioned as specified (e.g., "top-left", "center", "bottom-right")?
|
| 57 |
+
- Does the composition style match (e.g., centered, two-column, asymmetric, grid-based)?
|
| 58 |
+
- Is the visual hierarchy maintained (dominant elements are larger/more prominent)?
|
| 59 |
+
|
| 60 |
+
### 5. Mood & Atmosphere Match
|
| 61 |
+
- Does the overall mood match the specified mood_tone (e.g., Professional, Technical, Playful)?
|
| 62 |
+
- Are global style instructions in the style description text followed?
|
| 63 |
+
- Do decorative elements and visual embellishments match the description?
|
| 64 |
+
|
| 65 |
+
### 6. Block-Level Style Fidelity
|
| 66 |
+
- For each block, are the specified style attributes (container, opacity, and any block-level special instructions) followed?
|
| 67 |
+
- Are illustration blocks rendered according to their natural language descriptions?
|
| 68 |
+
- Do image containers have the specified effects (border, shadow, frame)?
|
| 69 |
+
|
| 70 |
+
## Strict Scoring Rules
|
| 71 |
+
|
| 72 |
+
- Any clear mismatch with the style description text (e.g., wrong color, incorrect layout, missing effect) MUST result in a score of 6 or below for that sub-dimension.
|
| 73 |
+
- Multiple mismatches in one dimension MUST result in a score of 4 or below.
|
| 74 |
+
- If a key requirement (e.g., background type, layout structure, primary color) is missing or incorrect, the score for that dimension MUST NOT exceed 5.
|
| 75 |
+
- Perfect or near-perfect scores (9-10) are ONLY allowed when there are NO noticeable deviations.
|
| 76 |
+
- If uncertain, always choose the lower score.
|
| 77 |
+
|
| 78 |
+
Additional hard constraints (must enforce):
|
| 79 |
+
|
| 80 |
+
- A sub-dimension can be 9-10 only if ALL its checkable requirements are PASS and zero mismatches exist.
|
| 81 |
+
- A sub-dimension can be at most 8 if there is any PARTIAL.
|
| 82 |
+
- A sub-dimension can be at most 6 if there is any FAIL.
|
| 83 |
+
- A sub-dimension can be at most 5 if any key requirement in that dimension is FAIL or NOT_VERIFIABLE.
|
| 84 |
+
- A sub-dimension can be at most 4 if mismatch count in that dimension is 2 or more.
|
| 85 |
+
- A sub-dimension can be at most 3 if mismatch count in that dimension is 3 or more.
|
| 86 |
+
- Do not give score 7-10 when evidence is weak, ambiguous, occluded, or not visible.
|
| 87 |
+
|
| 88 |
+
## Scoring Rubric
|
| 89 |
+
|
| 90 |
+
- **9-10 (Excellent)**: Nearly perfect match. NO visible mismatches in color, layout, typography, or mood.
|
| 91 |
+
- **7-8 (Good)**: Mostly correct, but includes noticeable deviations that affect fidelity.
|
| 92 |
+
- **5-6 (Fair)**: Multiple deviations or one major mismatch in key style elements.
|
| 93 |
+
- **3-4 (Poor)**: Significant mismatches in several dimensions; style is only partially recognizable.
|
| 94 |
+
- **1-2 (Very Poor)**: Style instructions are largely ignored or contradicted.
|
| 95 |
+
|
| 96 |
+
Scoring bias control:
|
| 97 |
+
|
| 98 |
+
- Do not use score 8 as a default "safe" score.
|
| 99 |
+
- Prefer 5-7 unless there is strong evidence for higher.
|
| 100 |
+
- Aesthetic quality, creativity, readability, and beauty must not raise the score if fidelity is weak.
|
| 101 |
+
- If two score options seem plausible, choose the lower one.
|
| 102 |
+
|
| 103 |
+
## Output Format
|
| 104 |
+
|
| 105 |
+
You MUST respond in the following JSON format ONLY. Do not include any other text:
|
| 106 |
+
|
| 107 |
+
```json
|
| 108 |
+
{
|
| 109 |
+
"background_compliance": {
|
| 110 |
+
"score": <1-10>,
|
| 111 |
+
"reasoning": "<brief explanation>"
|
| 112 |
+
},
|
| 113 |
+
"color_palette_adherence": {
|
| 114 |
+
"score": <1-10>,
|
| 115 |
+
"reasoning": "<brief explanation>"
|
| 116 |
+
},
|
| 117 |
+
"typography_compliance": {
|
| 118 |
+
"score": <1-10>,
|
| 119 |
+
"reasoning": "<brief explanation>"
|
| 120 |
+
},
|
| 121 |
+
"layout_position_accuracy": {
|
| 122 |
+
"score": <1-10>,
|
| 123 |
+
"reasoning": "<brief explanation>"
|
| 124 |
+
},
|
| 125 |
+
"mood_atmosphere_match": {
|
| 126 |
+
"score": <1-10>,
|
| 127 |
+
"reasoning": "<brief explanation>"
|
| 128 |
+
},
|
| 129 |
+
"block_level_style_fidelity": {
|
| 130 |
+
"score": <1-10>,
|
| 131 |
+
"reasoning": "<brief explanation>"
|
| 132 |
+
},
|
| 133 |
+
"overall_score": <1-10 mean of the sub-dimension scores>,
|
| 134 |
+
"overall_reasoning": "<2-3 sentence summary of the overall style instruction following quality>"
|
| 135 |
+
}
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
Reasoning must be evidence-grounded and mention concrete mismatches (for example: wrong hex family, missing texture, incorrect block position, missing effect, wrong hierarchy emphasis).
|
eval/requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
openai>=1.40
|
| 2 |
+
rapidfuzz>=3.0
|
| 3 |
+
pillow>=10.0
|
| 4 |
+
numpy
|
eval/run_ocr.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Step 1 of Content Faithfulness: OCR every generated slide.
|
| 2 |
+
|
| 3 |
+
Uses PaddleOCR 3.x (paddleocr==3.3.2 in our runs) and merges detected boxes
|
| 4 |
+
into text lines. Output: one text file per case, one recognized line per row.
|
| 5 |
+
|
| 6 |
+
python eval/run_ocr.py --task t2i --pred_dir outputs/my_model --device gpu:0
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import argparse
|
| 10 |
+
import os
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
import numpy as np
|
| 14 |
+
|
| 15 |
+
from common import bench_path, load_jsonl
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def merge_ocr_lines(texts, polys, y_thresh_ratio=0.5, x_gap_ratio=1.2):
|
| 19 |
+
"""Group OCR boxes into lines (top to bottom), then join neighbours left to right.
|
| 20 |
+
|
| 21 |
+
A box joins the first line whose running vertical center is within
|
| 22 |
+
0.5 x the mean box height of that line. Inside a line, two neighbours are
|
| 23 |
+
joined when the horizontal gap is at most 1.2 x their mean height; a space
|
| 24 |
+
is inserted only between two ASCII characters.
|
| 25 |
+
"""
|
| 26 |
+
items = []
|
| 27 |
+
for text, poly in zip(texts, polys):
|
| 28 |
+
text = text.strip()
|
| 29 |
+
if not text:
|
| 30 |
+
continue
|
| 31 |
+
poly = np.asarray(poly)
|
| 32 |
+
left, right = poly[:, 0].min(), poly[:, 0].max()
|
| 33 |
+
top, bottom = poly[:, 1].min(), poly[:, 1].max()
|
| 34 |
+
items.append({"text": text, "left": left, "right": right, "height": bottom - top, "cy": (top + bottom) / 2})
|
| 35 |
+
items.sort(key=lambda x: x["cy"])
|
| 36 |
+
|
| 37 |
+
lines = []
|
| 38 |
+
for it in items:
|
| 39 |
+
for line in lines:
|
| 40 |
+
if abs(line["cy"] - it["cy"]) <= np.mean([i["height"] for i in line["items"]]) * y_thresh_ratio:
|
| 41 |
+
line["items"].append(it)
|
| 42 |
+
line["cy"] = np.mean([i["cy"] for i in line["items"]])
|
| 43 |
+
break
|
| 44 |
+
else:
|
| 45 |
+
lines.append({"cy": it["cy"], "items": [it]})
|
| 46 |
+
|
| 47 |
+
merged = []
|
| 48 |
+
for line in lines:
|
| 49 |
+
row = sorted(line["items"], key=lambda x: x["left"])
|
| 50 |
+
cur, prev = row[0]["text"], row[0]
|
| 51 |
+
for it in row[1:]:
|
| 52 |
+
if it["left"] - prev["right"] <= (prev["height"] + it["height"]) / 2 * x_gap_ratio:
|
| 53 |
+
cur += (" " if cur[-1].isascii() and it["text"][0].isascii() else "") + it["text"]
|
| 54 |
+
else:
|
| 55 |
+
merged.append(cur)
|
| 56 |
+
cur = it["text"]
|
| 57 |
+
prev = it
|
| 58 |
+
merged.append(cur)
|
| 59 |
+
return merged
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def main():
|
| 63 |
+
ap = argparse.ArgumentParser()
|
| 64 |
+
ap.add_argument("--task", required=True, choices=["t2i", "template", "multi_image"])
|
| 65 |
+
ap.add_argument("--pred_dir", required=True, help="Folder with <task>/<id>.png predictions.")
|
| 66 |
+
ap.add_argument("--out_dir", default=None, help="Defaults to <pred_dir>/ocr.")
|
| 67 |
+
ap.add_argument("--device", default="gpu:0", help="PaddleOCR device, e.g. gpu:0 or cpu.")
|
| 68 |
+
args = ap.parse_args()
|
| 69 |
+
|
| 70 |
+
from paddleocr import PaddleOCR
|
| 71 |
+
|
| 72 |
+
ocr = PaddleOCR(
|
| 73 |
+
device=args.device,
|
| 74 |
+
use_doc_orientation_classify=True,
|
| 75 |
+
use_doc_unwarping=False,
|
| 76 |
+
use_textline_orientation=True,
|
| 77 |
+
)
|
| 78 |
+
out_dir = Path(args.out_dir or os.path.join(args.pred_dir, "ocr")) / args.task
|
| 79 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 80 |
+
|
| 81 |
+
cases = load_jsonl(bench_path(f"data/{args.task}.jsonl"))
|
| 82 |
+
for case in cases:
|
| 83 |
+
img = Path(args.pred_dir) / args.task / f"{case['id']}.png"
|
| 84 |
+
dst = out_dir / f"{case['id']}.txt"
|
| 85 |
+
if not img.exists() or dst.exists():
|
| 86 |
+
continue
|
| 87 |
+
lines = []
|
| 88 |
+
for res in ocr.predict(input=str(img)):
|
| 89 |
+
lines += merge_ocr_lines(res.get("rec_texts") or [], res.get("rec_polys") or [])
|
| 90 |
+
dst.write_text("\n".join(l for l in lines if l) + "\n", encoding="utf-8")
|
| 91 |
+
print(f"OCR written to {out_dir}")
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
if __name__ == "__main__":
|
| 95 |
+
main()
|
eval/score_edit.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Score the edit track: Semantic Consistency (SC) and Presentation Quality (PQ).
|
| 2 |
+
|
| 3 |
+
Predictions are read from <pred_dir>/edit/<id>.png.
|
| 4 |
+
|
| 5 |
+
python eval/score_edit.py --pred_dir outputs/my_model --workers 16
|
| 6 |
+
|
| 7 |
+
SC = min(editing_success, overediting), judged from (source, edited) slides.
|
| 8 |
+
PQ = unweighted mean of clarity, layout, style coherence, professionalism,
|
| 9 |
+
judged from the edited slide alone.
|
| 10 |
+
Edit score = sqrt(SC * PQ). One call per prompt, temperature 0.7, 512 tokens.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
import argparse
|
| 14 |
+
import json
|
| 15 |
+
import math
|
| 16 |
+
import os
|
| 17 |
+
import re
|
| 18 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
|
| 21 |
+
from common import bench_path, chat, get_client, image_part, load_jsonl, load_prompt, mean, write_jsonl
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def _numbers(values, n):
|
| 25 |
+
nums = []
|
| 26 |
+
for v in values if isinstance(values, list) else []:
|
| 27 |
+
if isinstance(v, (int, float)):
|
| 28 |
+
nums.append(float(v))
|
| 29 |
+
elif isinstance(v, str) and re.search(r"-?\d+(?:\.\d+)?", v):
|
| 30 |
+
nums.append(float(re.search(r"-?\d+(?:\.\d+)?", v).group()))
|
| 31 |
+
return (nums + [5.0] * n)[:n] # missing values fall back to the scale midpoint
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def score_case(client, case, img):
|
| 35 |
+
sc_prompt = load_prompt("edit_evaluation_source_control.txt").replace("<instruction>", case["instruction"])
|
| 36 |
+
sc_res = chat(client, "", [image_part(bench_path(case["source_image"])), image_part(img), {"type": "text", "text": sc_prompt}], 0.7, 512)
|
| 37 |
+
pq_res = chat(client, "", [image_part(img), {"type": "text", "text": load_prompt("edit_evaluation_quality.txt")}], 0.7, 512)
|
| 38 |
+
success, preserve = _numbers(sc_res.get("score"), 2)
|
| 39 |
+
pq = mean(_numbers(pq_res.get("score"), 4))
|
| 40 |
+
sc = min(success, preserve)
|
| 41 |
+
return {"id": case["id"], "operation": case["operation"], "editing_success": success, "edit_consistency": preserve,
|
| 42 |
+
"sc": sc, "pq": pq, "edit_score": math.sqrt(max(sc, 0) * max(pq, 0))}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def main():
|
| 46 |
+
ap = argparse.ArgumentParser()
|
| 47 |
+
ap.add_argument("--pred_dir", required=True)
|
| 48 |
+
ap.add_argument("--out", default=None, help="Defaults to <pred_dir>/scores/edit.jsonl.")
|
| 49 |
+
ap.add_argument("--workers", type=int, default=8)
|
| 50 |
+
args = ap.parse_args()
|
| 51 |
+
|
| 52 |
+
client = get_client()
|
| 53 |
+
cases = load_jsonl(bench_path("data/edit.jsonl"))
|
| 54 |
+
|
| 55 |
+
def run(case):
|
| 56 |
+
img = Path(args.pred_dir) / "edit" / f"{case['id']}.png"
|
| 57 |
+
if not img.exists():
|
| 58 |
+
return {"id": case["id"], "error": "missing prediction"}
|
| 59 |
+
try:
|
| 60 |
+
return score_case(client, case, str(img))
|
| 61 |
+
except Exception as e:
|
| 62 |
+
return {"id": case["id"], "error": repr(e)}
|
| 63 |
+
|
| 64 |
+
with ThreadPoolExecutor(args.workers) as ex:
|
| 65 |
+
rows = list(ex.map(run, cases))
|
| 66 |
+
out = args.out or os.path.join(args.pred_dir, "scores", "edit.jsonl")
|
| 67 |
+
write_jsonl(out, rows)
|
| 68 |
+
ok = [r for r in rows if "sc" in r]
|
| 69 |
+
sc, pq = mean(r["sc"] for r in ok), mean(r["pq"] for r in ok)
|
| 70 |
+
print(json.dumps({"task": "edit", "sc": sc, "pq": pq, "edit": math.sqrt(sc * pq) if ok else None, "n_scored": len(ok)}, indent=1))
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
if __name__ == "__main__":
|
| 74 |
+
main()
|
eval/score_generation.py
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Score one generation task: Content Faithfulness (CF), Instruction Following (IF), Aesthetic Quality (AQ).
|
| 2 |
+
|
| 3 |
+
Run `run_ocr.py` first. Predictions are read from <pred_dir>/<task>/<id>.png.
|
| 4 |
+
|
| 5 |
+
python eval/score_generation.py --task multi_image --pred_dir outputs/my_model --workers 16
|
| 6 |
+
|
| 7 |
+
CF text: GPT-4.1 extracts the slide text the instruction requires; OCR lines
|
| 8 |
+
are re-joined against those strings; each required string is matched
|
| 9 |
+
to its closest OCR line by Levenshtein distance;
|
| 10 |
+
S_text = max(10 - 9 * sum(dist) / sum(len), 1).
|
| 11 |
+
multi_image adds an input-image preservation score (judge `overall_score`)
|
| 12 |
+
and CF = (S_text + S_image) / 2.
|
| 13 |
+
IF unweighted mean of six sub-dimensions (text or style_json prompt;
|
| 14 |
+
template cases also show the reference slide).
|
| 15 |
+
AQ unweighted mean of four sub-dimensions, judged from the output image only.
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
import argparse
|
| 19 |
+
import json
|
| 20 |
+
import os
|
| 21 |
+
import re
|
| 22 |
+
from concurrent.futures import ThreadPoolExecutor
|
| 23 |
+
from itertools import combinations
|
| 24 |
+
from pathlib import Path
|
| 25 |
+
|
| 26 |
+
from rapidfuzz import fuzz
|
| 27 |
+
|
| 28 |
+
from common import (bench_path, chat, get_client, image_part, load_jsonl, load_prompt, mean,
|
| 29 |
+
subdimension_mean, text_part, write_jsonl)
|
| 30 |
+
|
| 31 |
+
EXTRACT_PROMPT = (
|
| 32 |
+
"From the following PPT instruction, extract ALL text strings that are explicitly written out and are required "
|
| 33 |
+
"to appear on the PPT page. This includes any quoted text, statements, captions, labels, or any other text that "
|
| 34 |
+
"is directly specified in the instruction as content to be displayed on the slide. DO NOT infer or generate new "
|
| 35 |
+
"text. Only extract what is explicitly present in the instruction and is required to be shown on the PPT. "
|
| 36 |
+
"Return ONLY a JSON array (Python list) of strings, each string is a text to be displayed. Do not output "
|
| 37 |
+
"anything except the JSON array."
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
# ----------------------------------------------------------------- CF (text)
|
| 42 |
+
def levenshtein(a, b):
|
| 43 |
+
if a == b:
|
| 44 |
+
return 0
|
| 45 |
+
if not a or not b:
|
| 46 |
+
return len(a) or len(b)
|
| 47 |
+
prev = list(range(len(b) + 1))
|
| 48 |
+
for i, ca in enumerate(a, 1):
|
| 49 |
+
cur = [i]
|
| 50 |
+
for j, cb in enumerate(b, 1):
|
| 51 |
+
cur.append(min(cur[j - 1] + 1, prev[j] + 1, prev[j - 1] + (ca != cb)))
|
| 52 |
+
prev = cur
|
| 53 |
+
return prev[-1]
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def _norm(s):
|
| 57 |
+
return "".join(s.lower().split())
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def rejoin_lines(lines, targets, max_extra=3):
|
| 61 |
+
"""Join OCR lines that together spell a required string (RapidFuzz ratio > 90)."""
|
| 62 |
+
target_norms = [_norm(t) for t in targets]
|
| 63 |
+
out, used = [], set()
|
| 64 |
+
for i, line in enumerate(lines):
|
| 65 |
+
if i in used:
|
| 66 |
+
continue
|
| 67 |
+
cur = _norm(line)
|
| 68 |
+
if cur in target_norms:
|
| 69 |
+
out.append(line)
|
| 70 |
+
used.add(i)
|
| 71 |
+
continue
|
| 72 |
+
joined = None
|
| 73 |
+
for tn in target_norms:
|
| 74 |
+
if fuzz.ratio(cur, tn[: len(cur)]) <= 90:
|
| 75 |
+
continue
|
| 76 |
+
for r in range(1, max_extra + 1):
|
| 77 |
+
for combo in combinations(range(i + 1, len(lines)), r):
|
| 78 |
+
cand = " ".join(lines[k] for k in (i,) + combo)
|
| 79 |
+
if fuzz.ratio(_norm(cand), tn) > 90:
|
| 80 |
+
joined = (cand, (i,) + combo)
|
| 81 |
+
break
|
| 82 |
+
if joined:
|
| 83 |
+
break
|
| 84 |
+
if joined:
|
| 85 |
+
break
|
| 86 |
+
if joined:
|
| 87 |
+
out.append(joined[0])
|
| 88 |
+
used.update(joined[1])
|
| 89 |
+
else:
|
| 90 |
+
out.append(line)
|
| 91 |
+
used.add(i)
|
| 92 |
+
return out
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def text_score(targets, ocr_lines):
|
| 96 |
+
dist = sum(min(levenshtein(t, g) for g in ocr_lines) for t in targets)
|
| 97 |
+
total = sum(len(t) for t in targets)
|
| 98 |
+
return round(max(10 - 9 * dist / total, 1), 2)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def extract_style_json(instruction):
|
| 102 |
+
"""Return the JSON block of a style_json instruction (text after '### SLIDE JSON:')."""
|
| 103 |
+
idx = instruction.find("### SLIDE JSON:")
|
| 104 |
+
if idx < 0:
|
| 105 |
+
idx = instruction.find("```json")
|
| 106 |
+
if idx < 0:
|
| 107 |
+
return instruction
|
| 108 |
+
rest = instruction[idx:]
|
| 109 |
+
m = re.search(r"```json\s*\n(.*?)```", rest, re.DOTALL)
|
| 110 |
+
if m:
|
| 111 |
+
return m.group(1).strip()
|
| 112 |
+
s, e = rest.find("{"), rest.rfind("}")
|
| 113 |
+
return rest[s : e + 1] if 0 <= s < e else rest
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
# ------------------------------------------------------------------- scoring
|
| 117 |
+
def score_cf(client, task, case, img, ocr_file):
|
| 118 |
+
targets = chat(client, EXTRACT_PROMPT, case["instruction"], temperature=0.2, max_tokens=800)
|
| 119 |
+
targets = [str(t).strip() for t in targets if str(t).strip()] if isinstance(targets, list) else []
|
| 120 |
+
lines = [l.strip() for l in open(ocr_file, encoding="utf-8")] if os.path.exists(ocr_file) else []
|
| 121 |
+
lines = [l for l in lines if l]
|
| 122 |
+
if not targets or not lines:
|
| 123 |
+
return {"cf_error": "no required text extracted" if not targets else "no OCR text"}
|
| 124 |
+
out = {"cf_text": text_score(targets, rejoin_lines(lines, targets))}
|
| 125 |
+
out["cf"] = out["cf_text"]
|
| 126 |
+
if task == "multi_image":
|
| 127 |
+
content = [text_part("Generated PPT:"), image_part(img), text_part("Sub-Image List (required sub-images):")]
|
| 128 |
+
for k, p in enumerate(case["input_images"], 1):
|
| 129 |
+
content += [text_part(f"Sub-Image {k}:"), image_part(bench_path(p))]
|
| 130 |
+
res = chat(client, load_prompt("content_faithfulness.txt"), content, temperature=0.2, max_tokens=1200)
|
| 131 |
+
out["cf_image"] = float(res["overall_score"])
|
| 132 |
+
out["cf"] = round((out["cf_text"] + out["cf_image"]) / 2, 2)
|
| 133 |
+
return out
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def score_if(client, task, case, img):
|
| 137 |
+
is_json = "JSON" in case["instruction"]
|
| 138 |
+
if is_json:
|
| 139 |
+
content = [text_part(f"## Style JSON Specification\n\n```json\n{extract_style_json(case['instruction'])}\n```\n\n")]
|
| 140 |
+
else:
|
| 141 |
+
content = [text_part(f"## Style Description\n\n{case['instruction']}\n\n")]
|
| 142 |
+
if task == "template":
|
| 143 |
+
content += [
|
| 144 |
+
text_part(
|
| 145 |
+
"## Reference Slide Image (for style only)\n\nThe following image is a reference slide from the same "
|
| 146 |
+
"presentation. Use it only to infer the visual style (palette, typography, background, decorative "
|
| 147 |
+
"motifs, etc.), not for layout or content placement.\n"
|
| 148 |
+
),
|
| 149 |
+
image_part(bench_path(case["input_images"][0])),
|
| 150 |
+
]
|
| 151 |
+
content += [
|
| 152 |
+
text_part("## Generated Slide Image\n\nThe image below is the AI-generated slide. Evaluate how well it follows the style instructions above."),
|
| 153 |
+
image_part(img),
|
| 154 |
+
]
|
| 155 |
+
prompt = "style_instruction_following_json.txt" if is_json else "style_instruction_following_text.txt"
|
| 156 |
+
return {"if": subdimension_mean(chat(client, load_prompt(prompt), content, temperature=0.2, max_tokens=2000))}
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def score_aq(client, img):
|
| 160 |
+
content = [text_part("## Generated Slide Image\n\nThe image below is the AI-generated slide. Evaluate its aesthetic quality."), image_part(img)]
|
| 161 |
+
return {"aq": subdimension_mean(chat(client, load_prompt("aesthetic_quality.txt"), content, temperature=0.2, max_tokens=2000))}
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def score_case(client, task, case, img, ocr_file):
|
| 165 |
+
"""Each metric is scored independently; a failure leaves only that metric empty."""
|
| 166 |
+
out = {"id": case["id"], "source": case["source"], "prompt_type": case["prompt_type"]}
|
| 167 |
+
for name, fn in (("cf", lambda: score_cf(client, task, case, img, ocr_file)),
|
| 168 |
+
("if", lambda: score_if(client, task, case, img)),
|
| 169 |
+
("aq", lambda: score_aq(client, img))):
|
| 170 |
+
try:
|
| 171 |
+
out.update(fn())
|
| 172 |
+
except Exception as e:
|
| 173 |
+
out[f"{name}_error"] = repr(e)
|
| 174 |
+
return out
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def main():
|
| 178 |
+
ap = argparse.ArgumentParser()
|
| 179 |
+
ap.add_argument("--task", required=True, choices=["t2i", "template", "multi_image"])
|
| 180 |
+
ap.add_argument("--pred_dir", required=True)
|
| 181 |
+
ap.add_argument("--ocr_dir", default=None, help="Defaults to <pred_dir>/ocr.")
|
| 182 |
+
ap.add_argument("--out", default=None, help="Defaults to <pred_dir>/scores/<task>.jsonl.")
|
| 183 |
+
ap.add_argument("--workers", type=int, default=8)
|
| 184 |
+
args = ap.parse_args()
|
| 185 |
+
|
| 186 |
+
client = get_client()
|
| 187 |
+
ocr_dir = Path(args.ocr_dir or os.path.join(args.pred_dir, "ocr")) / args.task
|
| 188 |
+
cases = load_jsonl(bench_path(f"data/{args.task}.jsonl"))
|
| 189 |
+
|
| 190 |
+
def run(case):
|
| 191 |
+
img = Path(args.pred_dir) / args.task / f"{case['id']}.png"
|
| 192 |
+
if not img.exists():
|
| 193 |
+
return {"id": case["id"], "error": "missing prediction"}
|
| 194 |
+
return score_case(client, args.task, case, str(img), str(ocr_dir / f"{case['id']}.txt"))
|
| 195 |
+
|
| 196 |
+
with ThreadPoolExecutor(args.workers) as ex:
|
| 197 |
+
rows = list(ex.map(run, cases))
|
| 198 |
+
|
| 199 |
+
out = args.out or os.path.join(args.pred_dir, "scores", f"{args.task}.jsonl")
|
| 200 |
+
write_jsonl(out, rows)
|
| 201 |
+
summary = {m: mean(r[m] for r in rows if r.get(m) is not None) for m in ("cf", "if", "aq")}
|
| 202 |
+
summary["n_scored"] = {m: sum(r.get(m) is not None for r in rows) for m in ("cf", "if", "aq")}
|
| 203 |
+
print(json.dumps({"task": args.task, **summary}, indent=1))
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
if __name__ == "__main__":
|
| 207 |
+
main()
|
images/edit/add_block__add_000299_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_000299_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_003407_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_003407_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_003770_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_003770_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_010211_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_010211_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_011028_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_011028_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_013112_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_013112_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_015622_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_015622_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_016829_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_016829_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_024025_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_024025_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_033568_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_033568_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_034701_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_034701_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_036466_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_036466_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_037149_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_037149_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_041313_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_041313_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_045580_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_045580_target.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_049123_source.png
ADDED
|
Git LFS Details
|
images/edit/add_block__add_049123_target.png
ADDED
|
Git LFS Details
|