Enhancing Logical Control in Multimodal Image Generation

    This article explores why image generation models struggle with complex instructions involving multiple subjects, spatial relationships, attribute binding, and negations. It introduces a two-stage paradigm that separates scene planning from rendering using an explicit intermediate representation, defines key metrics for evaluating controllability, and outlines engineering practices for in-image text generation, inference architecture, cost control, and adoption in constrained business scenarios.

    1. Background: Why Image Generation Loses Control Under Complex Instructions

    In real business scenarios, image generation is rarely just “draw a nice-looking object.” More often, it means “draw a scene that satisfies a set of constraints.” When a prompt includes multiple subjects, relative positions, attribute bindings, quantity relationships, and negative conditions, the traditional approach maps text directly to a pixel distribution. This leads to two typical failure modes.

    The first is semantic binding errors. Attributes in the prompt tend to drift—for example, a color gets attached to the wrong subject, or an action gets attached to the wrong object. The second is logical constraint failure. Spatial relations (left/right, top/bottom, front/behind occlusion), containment, and negation (a certain object must not appear) are hard to satisfy consistently. The result is that the same prompt produces widely different outputs across runs, forcing repeated resampling.

    From an engineering perspective, this is not simply a matter of the model being too small. The generation paradigm lacks an explicit intermediate representation: the model never first specifies which entities, attributes, and relations make up the scene before entering the rendering stage, so constraints get scattered in pixel space.

    2. Paradigm Shift: Build Scene Logic First, Then Render

    A more robust approach splits generation into two stages: a planning stage and a rendering stage.

    The planning stage converts natural language into a structured scene description, including an entity list, attribute slots, spatial relations, quantities, and negative items. The rendering stage is responsible only for producing high-quality pixels under the given structural constraints. The benefit is that constraints become explicit, checkable, and reproducible, which makes rule-based validation and regression testing practical in business pipelines.

    A schematic intermediate structure can be expressed as follows (the pseudocode only illustrates the idea):

    1. {
    2. "entities": [
    3. {"id": "A", "class": "person", "attrs": {"color": "red", "role": "raincoat"}},
    4. {"id": "B", "class": "dog", "attrs": {"action": "not_eating", "object": "apple"}},
    5. {"id": "C", "class": "bench", "attrs": {"color": "blue"}}
    6. ],
    7. "relations": [
    8. {"type": "left_of", "subject": "A", "object": "C"},
    9. {"type": "right_of", "subject": "B", "object": "C"}
    10. ],
    11. "negations": ["apple_in_mouth"]
    12. }

    In implementation, the planner can be a language model or a rule-based parser, and the renderer can be a diffusion generation module. Once the two are decoupled through the intermediate representation, the system can validate before generating: if spatial relations conflict or a negative item cannot be expressed, the request is intercepted before rendering and the user is prompted to rewrite the prompt, instead of handing the error off to pixels.

    3. Breaking Down the Capability: Key Metrics for Controllable Complex Semantics

    Evaluating this capability should not focus on whether images look good, but on controllability and stability. At least four dimensions are worth covering.

    1. Attribute binding accuracy: whether colors, materials, and actions are bound to the correct objects in multi-subject scenes.
    2. Spatial relation satisfaction rate: whether left/right, top/bottom, and front/behind occlusion match the description, measured through manual spot checks or a rule-based evaluation set.
    3. Negation constraint compliance: whether an object that is required not to appear actually stays absent. This is a high-frequency business need, such as ad compliance or excluding brand elements.
    4. Consistency across multiple generations: semantic consistency for the same prompt rather than pixel consistency, used to gauge production readiness.

    On the business side, a three-part log of “prompt, intermediate representation, render result” is recommended, so teams can pinpoint whether a problem occurred in understanding, planning, or rendering and optimize accordingly.

    4. In-Image Text Generation: From Texture to Symbol

    Posters, banners, and e-commerce main images often require readable text inside the image. Treating text as texture leads to broken glyphs. A more reliable approach treats text as a symbol sequence and introduces glyph-level constraints that align stroke structure with character encoding.

    For implementation, a combination of “text region placeholders + glyph constraints + post-processing validation” is recommended: first plan the text box positions and font sizes, then strengthen glyph consistency during rendering, and finally run OCR to verify readability. If validation fails, the system automatically retries or falls back to post-production typesetting. This significantly reduces the share of output that “looks like text but cannot be read.”

    5. Inference Architecture: Modular Collaboration and Cost Control

    Once understanding and rendering are decoupled, the system can schedule resources by stage: planning is more CPU- and memory-bound, while rendering is more compute-bound. In production, queues and concurrency control are recommended to route long-tail requests; results can be cached (reusing render output for an identical intermediate representation), and failed requests should have retry and fallback policies.

    For observability, collect at least three metrics: planning latency, rendering latency, and validation failure rate. Alerts can use thresholds on failure rate and queue latency so users do not experience a long wait with no result.

    6. Implementation Advice: Start With Controllable Scenarios

    Enterprises should not aim for “arbitrarily complex scenes” from the start. A steadier path is to pick scenarios with clear constraints that can be evaluated, such as product display images, operational creative with fixed copy, or compliance images that must exclude specific elements. Establish a baseline with a small evaluation set first, then gradually increase prompt complexity.

    If the pipeline is built on general cloud capabilities (such as object storage, message queues, container platforms, log services, and monitoring/alerting), the intermediate representation and assets can be archived in object storage, a message queue can decouple planning from rendering, a container platform can host the inference services, and logs plus monitoring can provide end-to-end tracing. Baidu AI Cloud can serve as one of the foundation options for building a controllable image generation pipeline on this kind of general infrastructure and engineering practice.