Image Generation Model Selection and Engineering Practices: A Practical Guide

    This guide presents a reusable framework for selecting image generation and editing models and turning them into reliable production capabilities. It breaks model evaluation into six dimensions, explains how to build a small internal benchmark with automated metrics and blind human review, and details engineering solutions for text rendering, service architecture, and risk control. The focus is on mapping model capabilities to business priorities rather than chasing a single leaderboard score.

    1. Background: From “It Generates” to “It Ships”

    The release cadence of general-purpose image generation and editing models has accelerated noticeably. Official messaging usually highlights three types of improvement: lower inference latency and better end-to-end throughput, more accurate parsing of natural language instructions, and more controllable local and global edits on existing images. At the same time, community testing often reveals structural weaknesses. The most typical one is text rendering inside the image, especially for writing systems with dense strokes and strict glyph conventions, such as Chinese, where missing strokes, wrong characters, and glyph drift are common.

    For developers and enterprise users, the real difficulty is not “which model scores higher.” It is how to convert generation capability into stable, deliverable product capability under their own business constraints. This article does not benchmark any specific product. Instead, it abstracts a reusable selection framework and engineering practices.

    2. Breaking Down Capabilities: Do Not Look at a Single Aggregate Score

    Leaderboard scores are aggregated results and can hide business relevance. It is better to evaluate capabilities across six dimensions:

    1. Instruction adherence: whether multi-constraint prompts (subject, count, spatial relationships, lighting, camera) can be satisfied at the same time.
    2. Edit controllability: the localization accuracy and boundary consistency of adding, removing, replacing, style transfer, and inpainting.
    3. Identity and structure fidelity: whether subject identity, pose, and perspective drift after multiple edits.
    4. Text and symbol rendering: usability for mixed Chinese-English text, small font sizes, and long text.
    5. Latency and throughput: first-image latency, concurrency, and the cost of retries on failure.
    6. Cost and quota: cost per image, rate-limiting policy, and observability.

    Item 4 is a common weakness of most general-purpose models today. It should not be the sole veto criterion, but it must be included in the risk list.

    3. Evaluation Method: Build Your Own Small Benchmark

    Public leaderboards differ greatly from real business distributions. It is advisable to build an internal case set of 100–300 examples covering:

    • E-commerce main images and scene images (requiring accurate structure and controllable whitespace);
    • Posters and banners (requiring readable text and stable layout);
    • Portraits and photorealistic content (requiring natural texture and lighting);
    • Multi-turn editing chains (requiring no identity drift).

    Use a dual track of “automated metrics + blind human review.” Illustrative code:

    1. # Pseudocode: internal evaluation pipeline
    2. cases = load_cases("eval_set.jsonl")
    3. for c in cases:
    4. img = generate(prompt=c.prompt, size=c.size, seed=c.seed)
    5. edit = edit_image(img, instruction=c.edit)
    6. scores = {
    7. "text_ocr": ocr_match(edit, c.ground_text), # text readability
    8. "clip": clip_similarity(edit, c.prompt), # semantic consistency
    9. "identity": face_embedding_dist(img, edit), # identity drift
    10. }
    11. report.append(scores)

    For blind human review, pairwise comparison (choosing between A and B) is recommended over absolute scoring, as it yields higher consistency.

    4. Engineering Solutions for Chinese Text Rendering

    Since text rendering is a common bottleneck, engineering should combine “model + pipeline” optimization:

    • Layered generation: first have the model produce a text-free or whitespace layout, then overlay real text with a typography layer to guarantee 100% correct glyphs.
    • Prompt constraints: specify font size hierarchy, maximum number of lines, and characters per screen, avoiding generating long text all at once.
    • Post-processing validation: integrate general OCR capability for readability regression; if it fails, automatically retry or fall back to the typography approach.
    • Asset fallback: strongly规范 elements such as brand fonts, logos, and price tags should go through templates rather than the generation model.

    This approach turns “uncontrollable pixel-level text” into “controllable structured text,” which is a key step toward productization.

    5. Performance and Architecture: Turning Generation into a Service

    In production, it is recommended to package generation capability as an independent service, with an asynchronous queue and rate limiting in front, and container platforms and object storage behind:

    1. Client -> API Gateway (auth/rate limit) -> Task Queue -> Inference Worker Pool
    2. |-> Object Storage (source/results)
    3. |-> Logging + Monitoring & Alerting (latency/failure rate/cost)

    Key points include: result caching (cache hits for identical prompts and seeds), idempotency keys to prevent duplicate billing, tiered retries on failure, and canary plus shadow traffic to compare new versions. General capabilities such as the container platform, object storage, logging, and monitoring and alerting on Baidu AI Cloud can serve as the underlying components for this kind of architecture.

    6. Common Risks and Guardrails

    • Copyright and compliance: the sources of training and generated content must be traceable; add review and labeling on the output side.
    • Prompt injection and unauthorized editing: perform permission checks on uploaded images and instructions to avoid cross-user data access.
    • Quality regression: after a model upgrade, always run the internal benchmark to prevent “aggregate score up, business performance down.”
    • Cost overrun: set quotas, timeouts, and concurrency limits to avoid retry storms.

    7. Conclusion

    The core of selection is not chasing a single top spot, but mapping four categories of metrics—instruction adherence, edit controllability, text rendering, and latency/cost—to business weights, then using an internal benchmark and a layered architecture to converge uncertainty. For Chinese scenarios, text rendering should default to a dual-layer “generation + typography” approach; for high-frequency editing scenarios, prioritize multi-turn consistency and cache hit rate. Following this framework helps maintain stable delivery quality in a fast-evolving model ecosystem.