Building an Evaluation Framework for Text-to-Image Models When Multiple Models Update Simultaneously
When several text-to-image models release new versions in the same week, picking the "best" one by eyeballing a few cherry-picked samples leads to unreliable conclusions. This article explains why casual comparison fails, how to decompose "which model is stronger" into measurable dimensions, and how to build an evaluation framework with four components—a frozen test set, a unified adapter layer, automated metrics, and blind human review—illustrated with a minimal runnable pipeline skeleton in Python.
1. Why Simultaneous Updates Make Comparison Hard
When several text-to-image models ship new versions in the same week, a common approach is to open a few web pages, type in the same prompt, and pick the best-looking image. This approach has three problems. First, generation results are stochastic: the same model can produce noticeably different outputs across two runs, and cherry-picking the best image amplifies randomness. Second, models differ in default resolution, aspect ratio, and sampling parameters, so a direct side-by-side comparison lacks a valid baseline. Third, the gains from a version update often concentrate in specific dimensions—such as text rendering or understanding of certain languages—which an overall “look and feel” judgment cannot capture.
The first step in comparison is therefore to break “which one is stronger” down into definable, measurable questions.
2. Define Evaluation Goals First
“Stronger” must be grounded in concrete dimensions. A common industry breakdown of text-to-image capability includes:
- Instruction following: whether the image contains the subjects, counts, colors, and spatial relationships specified in the prompt.
- Image quality: whether structures are plausible, free of obvious distortion, and sharp in detail.
- Text rendering: whether text in the image is legible and matches the instruction.
- Style and consistency: whether multiple outputs under the same style instruction remain stylistically stable.
- Safety and compliance: whether inappropriate requests are handled according to policy.
- Latency and cost: per-generation time, failure rate, and per-call expense.
The weight of each dimension should be determined by the business scenario. E-commerce product images prioritize subject accuracy and legible text; illustration work prioritizes style consistency. Weights should be written down before the evaluation begins, to avoid adjusting the criteria after results are in.
3. Four Components of an Evaluation Framework
3.1 Test Set
The test set is the foundation of the evaluation. Organize cases by capability dimension, with a fixed number of cases per category—for example, at least 50 per category—covering normal scenarios, edge cases, and known failure-prone scenarios. Prompts should be version-controlled: every modification creates a new version number, so historical results remain traceable.
A case structure can look like this:
| Field | Description |
|---|---|
| case_id | Unique case identifier |
| category | Capability dimension, e.g., instruction following, text rendering |
| prompt | Input prompt |
| seed | Random seed, fixed when the model supports it |
| expected_text | Expected string for automated comparison; used only by text-rendering cases |
The test set should be frozen before any contact with the models under evaluation. If prompts were iteratively tuned against a particular model, results will be biased toward that model.
3.2 Unified Invocation Layer
Model APIs differ significantly. Write an adapter for each model that exposes a consistent generation method. The adapter handles parameter mapping—for example, converting a unified aspect ratio into the pixel dimensions each model supports. Every call should log the full set of actual parameters: model name, version, resolution, random seed, and request timestamp. Without this metadata, results cannot be reproduced, and you cannot tell whether the difference between two evaluation runs comes from the model or from the parameters.
3.3 Automated Metrics
Automated metrics are suitable for large-scale screening, but each has a clearly bounded scope:
- Image-text alignment: use a cross-modal matching model to compute similarity between image and text. It roughly indicates whether the subject appears, but is insensitive to counts and positional relationships.
- Text recognition accuracy: extract in-image text with OCR and compare it against the expected string. This metric is direct, but OCR itself makes mistakes, so sample-based manual verification is necessary.
- Distribution-level metrics: for example, FID, which measures the distance between a set of generated images and a reference set in feature space. It suits comparing overall characteristics of large batches, not judging a single image.
- Failure rate and latency: track the proportion of timeouts, rejections, and empty responses, and report median and P95 latency separately.
Automated metrics and human judgment may disagree. Before relying on an automated metric, validate its correlation with a small batch of human-labeled data.
3.4 Human Review
Automated metrics cannot fully replace human judgment, especially for aesthetics and style. Human review should be blind: hide model identities, randomize image order, and have reviewers score against a rubric. The rubric needs a written definition for every score point—for example, a 1-to-5 scale for instruction following, with explicit criteria for each value.
After multiple reviewers score independently, compute an agreement metric such as Cohen’s kappa or the intraclass correlation coefficient. Cases with low agreement should be discussed, the criteria revised, and the cases rescored—rather than simply averaging the scores.
4. Example Evaluation Pipeline
The code below is a minimal runnable skeleton showing how the adapter, executor, and record structure fit together. The interfaces are illustrative; a real implementation would connect to each model’s SDK.
import jsonimport randomimport timefrom dataclasses import dataclass, field, asdictfrom pathlib import Pathfrom typing import Optional, Protocol@dataclassclass TestCase:case_id: strcategory: strprompt: strseed: Optional[int] = Noneexpected_text: Optional[str] = Noneclass ImageModel(Protocol):name: strversion: strdef generate(self, prompt: str, seed: Optional[int]) -> bytes:...@dataclassclass RunRecord:model: strversion: strcase_id: strcategory: strimage_path: strlatency_s: floaterror: str = ""extra: dict = field(default_factory=dict)def run_suite(models: list, cases: list, out_dir: str) -> list:out = Path(out_dir)out.mkdir(parents=True, exist_ok=True)records = []for model in models:for case in cases:path = out / f"{model.name}_{model.version}_{case.case_id}.png"start = time.perf_counter()error = ""try:data = model.generate(case.prompt, case.seed)path.write_bytes(data)except Exception as exc:error = f"{type(exc).__name__}: {exc}"latency = time.perf_counter() - startrecords.append(RunRecord(model=model.name,version=model.version,case_id=case.case_id,category=case.category,image_path=str(path),latency_s=round(latency, 3),error=error,))payload = [asdict(r) for r in records](out / "records.json").write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")return recordsdef make_blind_batch(records: list, seed: int = 0):"""Build the blind-review task list. The returned key is kept by theorganizer and never shared with reviewers."""rng = random.Random(seed)valid = [r for r in records if not r.error]rng.shuffle(valid)tasks, key = [], {}for i, r in enumerate(valid):label = f"S{i:05d}"key[label] = {"model": r.model, "version": r.version, "case_id": r.case_id}tasks.append({"label": label, "image_path": r.image_path, "category": r.category})return tasks, key
At runtime, first call run_suite to complete generation and save all metadata, then use make_blind_batch to produce the shuffled, anonymized task list for reviewers. Once blind scores are collected, use the key to map labels back to models and aggregate results by category and by the predefined dimension weights.
