diffeval: A Framework for Diffusion Model Evaluation
A fixed prompt and seed suite, scored the same way on every model.
Website: diffeval.vercel.app
Website · Quickstart · Metrics · Backends · Suites · Extending · Design
diffeval is an evaluation harness for image and video diffusion models, in the same role lm-evaluation-harness has for language models. You name a backend and a suite. The suite fixes the prompts, the seeds, and the resolution. For each seed the backend writes one image per prompt, every metric scores that seed, and the runner aggregates a mean and a sample standard deviation. The run writes a console table, results.json, report.md, and report.html.
Video scoring is later. This version scores images. The video extra installs no packages, and there is no vbench metric.
- Pluggable. Suites, metrics, and backends register by name.
diffeval listanddiffeval runlook names up inTASKS,METRICS, andBACKENDS. - Light by default. The base install is PyYAML, Pillow, and NumPy. Torch, Diffusers, and clean-fid stay in optional extras.
- Honest scores. A missing library or a missing reference is status
skipped, with the reason stored on the row. The images stay on disk. - Traceable.
results.jsonusesschema_version1. It stores the suite,describe(), package versions, the GPU when torch reports one, andmetric_protocols.
Results
diffeval's cmmd reproduces the cmmd-pytorch sample check of 7.696 exactly. The table runs known models on the first N of the cmmd-pytorch COCO-30k captions, with seed 2024, and compares CMMD with the value cmmd-pytorch published on all 30,000.
| Model | Steps | Guidance | Size | Hardware | Captions | clip_score |
cmmd |
Published CMMD (30k) |
|---|---|---|---|---|---|---|---|---|
stable-diffusion-v1-5/stable-diffusion-v1-5 |
50 | default (7.5) | 512 | NVIDIA T4, float16 | 1,000 | 0.774 | 0.615 | 0.582 |
stabilityai/sd-turbo |
1 | 0 | 512 | CPU, float32 | 500 | 0.785 | 0.683 | not published |
SD 1.5 lands 0.033 above the published value. The run used 1,000 captions instead of 30,000, and the SD 1.5 safety checker replaces flagged images with black ones; both push CMMD up slightly. fid and kid are not in these rows because they need the 30,000 COCO reference images. clip_score has no published value under this protocol.
Benchmarks lists the commands to reproduce each row and the models still to run.
Installation
diffeval requires Python 3.10 or newer.
pip install diffeval
Add extras in brackets, for example pip install "diffeval[diffusers,metrics]". To work on the code, clone the repository and run pip install -e ".[dev]".
That installs the CLI, the YAML loader, Pillow, and NumPy.
| Extra | Installs | Used for |
|---|---|---|
diffusers |
torch, diffusers, transformers, accelerate, safetensors | the diffusers backend |
metrics |
torch, transformers, clean-fid, scipy<1.18 | clip_score, cmmd, fid, kid |
benchmarks |
pyarrow, huggingface_hub | diffeval-coco30k-images |
dev |
pytest | the tests |
geneval2 |
torch, transformers>=4.57, accelerate | geneval2 (Qwen3-VL-8B judge) |
geneval |
nothing | keeps the GenEval detector off the default install |
video |
nothing | keeps VBench off the default install |
pip install -e ".[diffusers,metrics]"
pip install -e ".[dev]"
The geneval metric returns skipped. The video extra does not install VBench.
Quickstart
Start with a CPU smoke run. The dummy backend draws deterministic RGB images, so the command downloads nothing.
diffeval run --backend dummy --suite core
If you omit both --backend and --pipeline, the backend is dummy. --pipeline without --backend selects diffusers.
Then a Diffusers model. Install the diffusers extra first. The command downloads weights. CI does not run it. The Results table was produced with this backend on CPU and on a CUDA GPU. Without the extra, the process prints install the diffusers extra: pip install 'diffeval[diffusers]' and exits 2.
One smaller model has been run on a CPU. stabilityai/sd-turbo with --steps 1 --guidance 0 --device cpu generated all eight core images and scored clip_score, cmmd, fid, and kid, at about five seconds per image. That run says the backend and metrics work end to end. Its scores against the four core drawings are not quality numbers.
diffeval run --pipeline stabilityai/sd-turbo --suite core --steps 1 --guidance 0 --device cpu
diffeval run --pipeline black-forest-labs/FLUX.1-schnell --suite core
When --steps and --guidance are omitted, black-forest-labs/FLUX.1-schnell uses 4 steps and guidance 0. Any other model id leaves the pipeline defaults in place. A value passed on the CLI wins.
Each run writes a directory. The default is outputs/<UTC timestamp>-<suite>-<backend>. The timestamp looks like 20261025T153000Z. Spaces and slashes in that label become underscores. The model id stays in describe(). The folder name ends with the backend, dummy or diffusers.
outputs/20261025T153000Z-core-dummy/
├── images/
│ ├── seed_0/red_cube.png
│ └── seed_1/red_cube.png
├── results.json
├── report.md
└── report.html
core has four prompts, so each seed directory holds four PNGs. Paths inside results.json are relative to the output directory, for example images/seed_0/red_cube.png.
The console table and report.md have one row per metric. Columns are metric, status, mean, std, per-seed, and direction. With only the base install, the metrics are skipped:
metric status mean std per-seed direction
clip_score skipped n/a n/a n/a,n/a higher
cmmd skipped n/a n/a n/a,n/a lower
fid skipped n/a n/a n/a,n/a lower
kid skipped n/a n/a n/a,n/a lower
Mean is the arithmetic mean of seeds whose status is ok. Standard deviation is the sample standard deviation, ddof=1. It is null when fewer than two seeds succeeded, and the console prints that null as n/a. The row stores std_ddof as 1. core uses two seeds so a real metric can show a standard deviation.
report.html repeats the table and shows an image grid grouped by prompt, one figure per seed. Prompts are escaped. The page says to check scores against the published reference implementation and dataset, and it calls core a smoke suite.
Exit code 0 means the report was written. Exit code 2 means the suite, backend, or metric name was unknown, generation failed, the chosen backend's extra is missing, or --strict found a metric that is not ok. --strict is off by default. The runner writes the report first, then exits 2. A smoke run with the metrics extra missing still exits 0.
diffeval list tasks
diffeval list metrics
diffeval list backends
diffeval run --backend dummy --suite core --seeds 0 --output outputs/smoke
diffeval run --backend dummy --suite core --metrics geneval --strict
The last command writes the report and exits 2. geneval is skipped, and --strict requires every aggregate status to be ok.
Command reference
diffeval list tasks
diffeval list metrics
diffeval list backends
diffeval run --suite NAME_OR_PATH [options]
| Option | Description |
|---|---|
--suite |
A registered suite name, or a path ending in .yaml or .yml. Required. A bare name is looked up in TASKS. |
--backend |
dummy or diffusers. Defaults to diffusers when --pipeline is set, otherwise dummy. |
--pipeline |
Hugging Face model id. Required for the diffusers backend. |
--steps, --guidance |
Sampler steps and guidance scale. FLUX.1-schnell presets to 4 steps and guidance 0. Other models use the pipeline defaults. CLI values win. |
--dtype |
Requested dtype. On CPU, float16 and bfloat16 load as float32. describe() stores the dtype actually used in dtype and the flag in requested_dtype. |
--device |
Device for the pipeline and for metrics. With no flag, metrics use CUDA when torch reports it, otherwise MPS, otherwise CPU. Without torch, metrics use CPU. |
--attention |
sdpa, xformers, or eager. With no flag, the pipeline default stays. |
--variant |
Diffusers pipeline variant. |
--batch-size |
Positive integer. Default 1. |
--seeds |
Comma-separated integers, overriding the suite. Example: --seeds 0,1,2. |
--metrics |
Comma-separated metric names, overriding the suite. |
--width, --height |
Image size in pixels, overriding the suite. |
--output |
Output directory. |
--strict |
Exit 2 unless every aggregate status is ok. The report is still written. |
describe() also records steps_source and guidance_source as cli, preset, or pipeline-default.
Metrics
| Metric | Better | Implementation | Needs references |
|---|---|---|---|
clip_score |
higher | Hessel et al. 2021, CLIP ViT-B/32. Mean of 2.5 * max(cosine, 0) on the raw prompt, truncated to 77 tokens. |
no |
cmmd |
lower | Jayasumana et al. 2024, CLIP ViT-L/14 at 336, center square crop, L2-normalized vision embeddings. Minimum-variance RBF MMD, diagonal included, sigma 10, scaled by 1000. Matches the cmmd-pytorch sample check of 7.696. | yes |
fid |
lower | clean-fid compute_fid, mode="clean", Inception-v3. clean-fid resizes each RGB image to 299×299. diffeval does not resize the PNG first. |
yes |
kid |
lower | clean-fid compute_kid on the same features. Degree-3 polynomial, 100 subsets, subset size at most 1000. |
yes |
geneval2 |
higher | GenEval 2 Soft-TIFA, following facebookresearch/GenEval2 evaluation.py. Qwen3-VL-8B answers each prompt's questions in one word; a question scores the first-token probability of the accepted answers. The value is 100 × the mean over prompts of the geometric mean of those scores. details adds the arithmetic-mean score, per-skill and per-atom-count scores, and every question score. Needs prompts built by diffeval-geneval2 and a GPU with about 24 GB. |
no |
geneval |
higher | Stub. Returns skipped. details.by_tag maps single_object, two_object, counting, colors, position, and color_attr to null. Mask2Former is not imported. |
no |
The registered metrics are clip_score, cmmd, fid, kid, geneval2, and geneval.
clip_score, cmmd, fid, and kid return skipped when their library is missing. fid, kid, and cmmd also skip when the suite has no reference. A reference is an image folder, precomputed clean_fid_stats for fid and kid, or a .npy CLIP embedding for cmmd. fid and kid also skip when the generated folder or the reference folder has fewer than two images. Both calls seed NumPy with the evaluation seed and restore the previous state. FID, KID, and CMMD set details.warning when the image count is below the published COCO setup of 30000. The metrics extra pins SciPy below 1.18: clean-fid 0.1.35 calls scipy.linalg.sqrtm with disp=False, which SciPy 1.18 removed, so fid and kid would error.
diffeval-check-cmmd downloads the six cmmd-pytorch sample images and checks that cmmd returns 7.696, the value that implementation documents. Earlier versions skipped the L2 normalization and the center crop, so their cmmd values are not comparable with published ones.
Benchmarks compares diffeval with published CMMD values and lists the commands to reproduce them.
Each metric's protocol dict is copied into metric_protocols in results.json.
How scores are aggregated
| Status | Meaning |
|---|---|
ok |
every seed succeeded |
partial |
some seeds succeeded |
skipped |
every seed was skipped |
error |
at least one seed failed and none succeeded |
The mean uses successful seeds only. The standard deviation is null below two successful seeds, which the console prints as n/a.
Backends
| Backend | Description |
|---|---|
dummy |
Deterministic RGB images. CI and the smoke command use it. describe() sets device to cpu and attention_backend to none. |
diffusers |
AutoPipelineForText2Image. Each request gets its own CPU torch.Generator, seeded from that request. |
fal and Replicate are not registered. v1 ships dummy and diffusers only.
Suites
A suite is a YAML file. A file that omits width or height gets 512 for each. A file that omits metrics gets clip_score, cmmd, fid, and kid. Prompt ids match [A-Za-z0-9_-]+, because they become file names.
name: shapes
description: Two prompts for a local check.
seeds: [0, 1]
width: 512
height: 512
metrics: [clip_score]
prompts:
- {id: red_cube, prompt: a red cube}
- {id: blue_sphere, prompt: a blue sphere}
diffeval run --backend dummy --suite path/to/shapes.yaml
A prompt can also have a meta mapping, such as {id: red_cube, prompt: a red cube, meta: {color: red}}. diffeval doesn't read it. It is passed to each metric as sample.meta, for metrics that need extra data per prompt.
The bundled core suite has four synthetic prompts (red_cube, blue_sphere, green_triangle, yellow_star), seeds [0, 1], 512×512 images, and small reference drawings under reference_dir. Those drawings are not COCO. A core score is a smoke check.
Extending diffeval
Importing diffeval loads the plugins. Each task, metric, and backend registers into TASKS, METRICS, or BACKENDS. Add a module, import it from the matching package __init__.py, and the name shows up in diffeval list.
Add a metric
The runner constructs the class with no arguments and calls compute(samples, context) once per seed. Return a MetricResult. Status ok carries a finite float. Status skipped or error carries a null value and an error string. protocol is copied into metric_protocols.
from diffeval.metrics.ok import ok
from diffeval.metrics.skipped import skipped
from diffeval.registry.register import register
from diffeval.registry.tables import METRICS
@register(METRICS, "example")
class Example:
name = "example"
description = "What the number means."
higher_is_better = True
requires_references = False
protocol = {"formula": "state the formula here"}
def compute(self, samples, context):
try:
import some_library
except ImportError:
return skipped(self.name, "install some_library", self.higher_is_better, self.protocol)
value = ... # a finite float for this seed
return ok(self.name, value, self.higher_is_better, self.protocol)
A missing optional library returns skipped, with the reason in the error string.
Add a backend
The runner calls from_config(config) on the class, then prepare(), generate(requests), and describe().
generate returns one diffeval.types.sample.Sample per request, in request order. Sample.image is a PIL RGB image seeded from that request's seed. The runner writes it to a path like images/seed_0/red_cube.png.
describe() returns name, pipeline, dtype, requested_dtype, steps, guidance, steps_source, guidance_source, batch_size, device, attention_backend, and variant.
src/diffeval/backends/dummy/backend.py is the short example.
Register a named suite
To make a suite available by name, register an object with description and load(). The runner calls load() on that object. It does not construct the class. Follow src/diffeval/tasks/core.py, which registers an instance.
from diffeval.registry.register import register
from diffeval.registry.tables import TASKS
from diffeval.tasks.load_path import load_path
class Shapes:
description = "Two prompts for a local check."
def load(self):
return load_path("path/to/shapes.yaml")
register(TASKS, "shapes")(Shapes())
To ship a suite with the package, put its YAML in src/diffeval/tasks/suites/ and import the module from src/diffeval/tasks/__init__.py.
Project layout
src/diffeval/
├── cli/ argument parsing and the list / run commands
├── tasks/ suite loading and the bundled suites
├── backends/ dummy and diffusers
├── metrics/ clip_score, cmmd, fid, kid, geneval2, geneval
├── runner/ per-seed generation and scoring
├── aggregate/ mean, sample std, and status across seeds
├── report/ console, Markdown, and HTML
├── registry/ TASKS, METRICS, and BACKENDS
├── system/ package versions, GPU, and attention flags
└── types/ shared records
Every .py file in src/ and tests/ has at most 20 lines of code. Blank lines, comments, and docstrings do not count. Imports do. docs/DESIGN.md is the rule and the module tree. docs/ROADMAP.md is the split into pull requests.
Contributing
pip install -e ".[dev]"
pytest
CI runs that on Python 3.10, 3.11, and 3.12, then runs diffeval run --backend dummy --suite core.
Keep new behavior inside the line cap. Register tasks, metrics, and backends by name. Do not commit model weights. Do not report a smoke score as a paper result.
License
Apache-2.0. See LICENSE.
Metadata
Release files for diffeval 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| diffeval-0.1.2.tar.gz | 60.7 kB | Without provenance | Details for diffeval-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diffeval-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for diffeval-0.1.2-py3-none-any.whl |
Total release size: 161.0 kB
Release files / diffeval-0.1.2.tar.gz
| Download URL | diffeval-0.1.2.tar.gz |
|---|---|
| Size | 60.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57bf3932c90cb44149638b7e54e4fa5d7cc99b75fd44fba9ac22eae79f72da35
|
|
BLAKE2b-256 checksum How to use checksums |
58eb00663acb46a01a074f91fac8426c4236add52333fa9ebcfe9c0b1c74bdff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / diffeval-0.1.2-py3-none-any.whl
| Download URL | diffeval-0.1.2-py3-none-any.whl |
|---|---|
| Size | 100.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12aa6494cb5bbbb7121f1a32574649b1bd7f4b2a90b8c83a4e180194cf7ab22d
|
|
BLAKE2b-256 checksum How to use checksums |
7295c4da8666dcacef0568301185a6abbdd91212f1a251121e351def17a99b25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Security for diffeval 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.