Evaluating Text-to-Image Models: Cost and Efficiency Practices

    This article explains why text-to-image model evaluation often exceeds budget and how to make the process reproducible and cost-aware. It covers a four-layer pipeline, stratified sampling, multi-dimensional scoring with hard constraints, cost-quality metrics, and engineering practices such as caching, queues, and monitoring. Readers will learn how to reach reliable model selection conclusions with fewer test cases and a limited budget.

    1. Why Evaluation Costs Spiral

    When text-to-image capabilities iterate quickly, teams usually want to compare several models side by side to decide which one to integrate. One example from the source material is telling: after spending roughly 30,000+ RMB and covering 40,000+ mainstream use cases, the team finally produced a conclusion that could be shared externally. On a “Dunhuang mural style” task, two models with identical scores differed in invocation cost by tens of times. This highlights an often-overlooked fact: evaluation itself is a compute task that needs engineering governance.

    Cost overruns usually come from three sources:

    • Case set inflation: blindly expanding the sample size for statistical significance, while marginal information gain drops quickly.
    • Repeated invocations: the same prompt is executed again and again during tuning, regression, and retesting, with no caching or version management.
    • Hidden scoring overhead: manual review, image storage and transfer, and log retention all add cost and schedule time.

    2. Split Evaluation into Four Governable Layers

    Structure the evaluation pipeline in layers, where each layer solves one independent problem, instead of ad-hoc one-shot calls.

    1. Case layer: define the prompt set, style tags, difficulty levels, and expected constraints.
    2. Execution layer: handle concurrency control, retries, timeouts, idempotency, and persisting results.
    3. Scoring layer: include automatic metrics, rule checks, and manual spot checks.
    4. Analysis layer: produce leaderboards, confidence intervals, and cost-quality curves.

    A sample directory and metadata structure (pseudocode, only to show organization):

    1. # Case metadata: the minimal unit for reproducibility
    2. case = {
    3. "case_id": "style_mural_017",
    4. "prompt": "mural style, flying apsaras and lotus, mineral pigment texture, flat composition",
    5. "tags": ["style transfer", "flat composition", "low saturation"],
    6. "difficulty": 2, # 1~3, used for stratified sampling
    7. "constraints": ["no text", "no watermark"],
    8. "prompt_version": "v3"
    9. }
    10. # The cache key must cover every input that affects output
    11. cache_key = hash(prompt, prompt_version, params, model_alias)

    The key fields are prompt_version and model_alias: the former makes prompt iteration traceable, and the latter replaces specific model names with neutral aliases for anonymized comparison in reports.

    3. Sampling and Stratification: Fewer Cases, More Stable Conclusions

    Forty thousand cases are not inherently wrong, but most teams do not need that volume. A more practical approach is stratified sampling:

    • Stratify by task type: photorealistic, illustration, graphic design, material rendering, text layout, and so on.
    • Stratify by difficulty: simple subjects, multi-subject relationships, complex space and occlusion.
    • Stratify by risk: isolate cases involving copyrighted styles or sensitive content.

    Within each stratum, run a small pilot first (for example, 20~30 cases per stratum) and observe score variance. If a stratum shows significantly higher variance, add samples to that stratum only, rather than scaling up globally at the same ratio. This usually preserves the stability of over 90% of ranking conclusions with only 10%~20% of the sample size.

    4. Scoring Design: Avoid a Single Score Hiding Structural Differences

    The source material shows total scores such as 80.1 and 85.8, but identical totals do not mean identical capability. Use a three-part structure: total score + dimension scores + hard constraints.

    Dimension Description Collection method
    Semantic consistency Whether subject, count, and relationships are correct Automatic comparison + manual spot check
    Style fit Whether composition, color, and material match the target style Manual rating (1~5)
    Structural soundness Whether limbs, perspective, and occlusion break down Rule detection + manual
    Hard constraints Whether text, watermarks, or out-of-bounds content appear Automatic judgment, one-strike veto

    Hard constraints use a one-strike veto, which prevents a very high score in one dimension from masking a violating output. Compute the total score as a weighted sum, with weights configured per business scenario rather than fixed globally.

    1. def final_score(dims, weights, hard_pass):
    2. if not hard_pass:
    3. return 0.0
    4. return round(sum(dims[k] * weights[k] for k in weights), 1)

    5. Cost-Quality Curve: Turn “60x Cheaper” into a Computable Metric

    The same score at different prices suggests introducing unit-cost metrics:

    • Cost per image = total spend in that stage / number of successfully produced images
    • Value index = total score / cost per image
    • Cost to threshold = average spend required to reach the minimum usable score for the business (for example, 80)

    After plotting a score-cost scatter, three groups of models usually appear: high-score, value, and fallback. Model selection does not have to chase the top of the leaderboard; choose near the inflection point of the curve based on the scenario. For high-volume, low-unit-value scenarios, the value group is often the more rational choice; for a small number of high-value assets, a premium for the high-score group is acceptable.

    6. Engineering Practices: Make Evaluation Reproducible and Auditable

    • Idempotency and caching: use a hash covering all inputs as the key; on a hit, reuse the result, making regression tests nearly free.
    • Async and queues: submit generation tasks to a message queue, elastically scale consumers on a container platform, and control concurrency to avoid rate limiting.
    • Object storage and lifecycle: write images to object storage, separate batches by prefix, and configure lifecycle policies to clean up intermediate artifacts.
    • Logging and monitoring: record latency, failure codes, and retry counts, and use monitoring alerts to spot abnormal fluctuations.
    • Anonymized reports: present models as “Model A/B/C” in reports to reduce brand bias in review.

    If you use general capabilities such as object storage, message queues, container platforms, and log monitoring from Baidu AI Cloud to carry these stages, you can focus on the evaluation design itself rather than infrastructure operations.

    7. Common Pitfalls

    1. Looking only at the total score: ignoring dimension scores and hard constraints makes selection conclusions fragile.
    2. Not locking prompt versions: after iteration, you cannot explain where score changes came from.
    3. Full reruns: without caching, regression cost grows linearly.
    4. Manual review without standards: without scoring guidelines and inter-rater consistency checks, subjective bias is large.
    5. Ignoring failed samples: counting only successful images systematically overestimates usability.

    8. Conclusion

    The value of large-scale image generation evaluation lies not in the number of samples itself, but in layered design, dimension-based scoring, computable cost, and reproducible results. Compress 40,000+ cases into stratified sampling plus targeted top-ups, expand a single total score into a combination of total score, dimension scores, and hard constraints, and unify “expensive and cheap” into value index and cost-to-threshold metrics. Then a team can reach more credible and actionable selection conclusions within a limited budget, and make every evaluation round a reusable asset.