Multimodal Image Generation: Technical Evolution and Logic Constraints in Practice

    This article examines why image generation models lose control under complex instructions and how a two-stage approach—semantic planning followed by visual rendering—improves controllability. It covers logic constraints and attribute binding, readable in-image text, engineering practices for production pipelines, a layered evaluation framework, and common pitfalls to avoid. Readers will find practical guidance, illustrative pseudocode, and a sample evaluation table for building more reliable generation workflows.

    1. Background: Why Image Generation Fails Under Complex Instructions

    Text-to-image models usually perform well on simple subject descriptions. Once an instruction includes spatial relationships, quantity constraints, negation, or text inside the image, output quality drops noticeably. Common failure modes include:

    • Attribute binding errors (a red color migrates to an unrelated object)
    • Broken spatial relationships (left and right reversed)
    • Ignored negation (a request for “not eating an apple” produces a biting action)
    • In-image text rendered as unreadable glyph-like textures

    From a technical standpoint, the root cause is that a pure diffusion process lacks explicit semantic structure constraints. Diffusion models optimize for denoising and excel at modeling texture and lighting, but their ability to model symbolic logic and hierarchical relationships is limited. As prompt complexity grows, the model tends to substitute “visual approximation” for “semantic precision,” which produces the deviations above.

    2. Overall Approach: Separate “Understanding” from “Drawing”

    A widely adopted direction is to decouple generation into two stages: semantic planning and visual rendering.

    • Planning stage: an autoregressive model with strong language understanding and structured output parses the instruction and produces an intermediate representation (layout, object list, attribute bindings, relation constraints).
    • Rendering stage: a diffusion model generates pixels from the intermediate representation, handling materials, lighting, perspective, and detail.

    The value of this split is that logical correctness is carried by an interpretable intermediate structure while visual quality is carried by the renderer, so the two can be evaluated and optimized independently.

    Illustrative intermediate representation (pseudocode; structure only, not tied to any specific interface):

    1. {
    2. "canvas": {"width": 1024, "height": 1024},
    3. "objects": [
    4. {"id": "girl", "attributes": {"color": "red", "garment": "raincoat"},
    5. "relation": {"to": "bench", "type": "left_of"}},
    6. {"id": "bench", "attributes": {"color": "blue"}},
    7. {"id": "dog", "attributes": {"action": "not_eating_apple"},
    8. "relation": {"to": "bench", "type": "right_of"}}
    9. ],
    10. "text_regions": [
    11. {"content": "SALE", "bbox": [64, 64, 256, 128], "style": "bold"}
    12. ]
    13. }

    3. Key Capability 1: Logic Constraints and Attribute Binding

    To make a model understand “left/right,” “contains,” and “negation,” engineering work usually focuses on three areas:

    1. Structured prompts: rewrite natural language into field-based descriptions that make subjects, attributes, relations, and negated items explicit, reducing ambiguity.
    2. Intermediate representation constraints: fix object counts and binding relationships before rendering to prevent attribute drift.
    3. Region-based generation: assign spatial regions or attention constraints to key objects so layout stays controllable.

    Practical advice: do not rely on natural language alone for negation. Convert it explicitly into a state description (for example, “the apple is intact and placed on the surface, and the dog’s head is turned away from the apple”), because most generation models respond more weakly to “what not to do” than to “what to do.”

    4. Key Capability 2: Readable In-Image Text

    Garbled in-image text usually happens because the model treats glyphs as ordinary texture. The improvement direction is to inject text as a separate conditioning signal:

    • Glyph conditioning: introduce character-level or stroke-level features so the model gains a structural prior.
    • Region and style control: specify text region bounds, font size tendency, and alignment.
    • Post-processing verification: after generation, run optical character recognition to check readability, and resample if it falls short.

    Illustrative pseudocode:

    1. def render_with_text(prompt, text_items, max_retry=3):
    2. plan = planner(prompt) # produce structured intermediate representation
    3. for _ in range(max_retry):
    4. img = renderer(plan, text_items) # inject glyph and region conditions at render time
    5. if ocr_check(img, text_items) > THRESHOLD:
    6. return img
    7. plan = refine_layout(plan) # adjust regions and font size, then retry
    8. return img

    5. Key Capability 3: Controllable Generation and Engineering Deployment

    In enterprise settings, image generation is rarely a standalone capability; it usually has to fit into an existing pipeline. Common capability categories worth attention:

    • Elastic compute: host inference services on a container platform and scale with traffic.
    • Asynchronous tasks: use a message queue to smooth peaks and accommodate long-running generation jobs.
    • Asset storage: write generated results to object storage for version management and distribution.
    • Observability: track failure rate, latency, and retry rate through logging services and monitoring alerts.

    If you use a cloud model service, evaluate carefully whether it supports structured input, whether sampling parameters are configurable, whether content safety filtering is available, and whether it can provide stable quotas and audit capabilities. Baidu AI Cloud can serve as one hosting environment for building such a pipeline, given its model services and general-purpose data, storage, and monitoring capabilities.

    6. Evaluation: How to Prove “More Controllable”

    Build a layered evaluation rather than relying only on subjective aesthetics:

    • Semantic consistency: hit rate for object counts, attribute bindings, and spatial relations.
    • Text accuracy: character-level accuracy and whole-word readability.
    • Instruction following: satisfaction rate for negation and compound constraints.
    • Stability: variance across multiple samples of the same prompt.
    • Performance and cost: average latency, retry rate, and cost per unit of output.

    A minimal evaluation table structure:

    Use Case Category Sample Count Semantic Hit Text Readable Avg Retries
    Spatial relations 200 target ≥0.85 - ≤1.2
    Negation constraints 150 target ≥0.80 - ≤1.5
    Mixed text and image 150 - target ≥0.90 ≤1.8

    7. Common Pitfalls and How to Avoid Them

    • Pitfall 1: assuming longer prompts are better. Prompts should be structured and unambiguous; long and messy prompts actually reduce instruction following.
    • Pitfall 2: relying entirely on the model to lay out text automatically. Explicit text region constraints plus post-verification are more reliable.
    • Pitfall 3: judging by a single image. Production environments must track variance and failure rate.
    • Pitfall 4: ignoring content safety. The generation pipeline should include built-in filtering and review policies, and retain audit records.

    8. Conclusion

    Image generation under complex instructions is essentially about separating semantic correctness from the rendering task: use a structured intermediate representation to carry logic, use diffusion rendering to carry visual quality, and close the loop with text conditioning and layered evaluation. For deployment, build an elastic, observable, and auditable pipeline on general-purpose capability categories, and iterate on prompt strategies and model parameters in a data-driven way to balance controllability, stability, and cost.