Multimodal Generation: Plan First, Then Render for Better Control

    This article explains why complex multimodal prompts often fail and how a two-stage approach—semantic planning followed by visual rendering—improves control over attributes, spatial relations, and negations. It covers structured intermediate representations, symbol-level text rendering with validation and retries, constraint-based prompt templates, and engineering practices such as task orchestration, caching, quality gates, monitoring, and elastic scaling for production deployment.

    1. Background: Why Complex Instructions Lead to Generation Errors

    As multimodal generation moves into production engineering, the expectations for image generation have shifted from “produce a good-looking image” to “consistently satisfy constraints.” The original problem can be framed as a common scenario: a user provides a compound description containing a subject, attributes, spatial relations, and negation conditions—for example, “a character wearing a red raincoat sits on the left side of a blue bench, and on the right side there is an animal that does not eat fruit.” Traditional generation approaches often suffer from attribute mismatch, reversed relations, and failed negation constraints.

    The root cause is not entirely about visual aesthetics, but about how semantic parsing and pixel generation are coupled. If a model treats text only as a kind of conditional texture, without an explicit scene structure representation, it struggles to reliably handle constraints such as “left/right,” “include/exclude,” and “which subject a color is bound to.” From an engineering perspective, these issues can be grouped into three categories:

    • Attribute binding errors: colors, materials, or counts are assigned to the wrong subject.
    • Spatial relation errors: left/right, top/bottom, or front/back positions do not match the description.
    • Negation failures: the model ignores constraints such as “not,” “do not,” or “without,” and instead reinforces the negated object.

    2. Technical Paradigm: From Direct Drawing to Plan-then-Render

    A more robust approach is to split the generation pipeline into two stages: a semantic planning stage and a visual rendering stage. The semantic planning stage converts natural language into a structured scene description that specifies subjects, attributes, relations, and constraints. The rendering stage then generates pixels based on that structure. This layered design brings three direct benefits:

    1. Traceable constraints: every attribute is assigned to a subject, making validation easier.
    2. Computable relations: spatial relations can be converted into coordinate or region constraints.
    3. Executable negation: negation conditions can participate in generation as masking items or negative constraints.

    An illustrative structured intermediate representation might look like this (conceptual only, not a specific interface):

    1. {
    2. "entities": [
    3. {"id": "person", "attributes": {"clothing_color": "red"}},
    4. {"id": "bench", "attributes": {"color": "blue"}},
    5. {"id": "animal", "attributes": {"action": "not_eating"}}
    6. ],
    7. "relations": [
    8. {"type": "left_of", "subject": "person", "object": "bench"},
    9. {"type": "right_of", "subject": "animal", "object": "bench"}
    10. ],
    11. "negations": ["animal_eating_fruit"]
    12. }

    In practice, this can be implemented by combining a reasoning model that produces the structure with a rendering model that consumes it. The reasoning side emphasizes long-context understanding and logical consistency, while the rendering side emphasizes texture, lighting, and composition quality. Decoupling the two through an intermediate representation improves controllability and makes automated regression testing easier.

    3. Text Rendering: Treat Characters as Symbols, Not Textures

    Scenarios such as posters, banners, and infographics demand high text accuracy. When a model treats text as ordinary texture, common problems include missing strokes, incorrect glyph assembly, and characters sticking together. A more reliable approach is to treat text rendering as a symbol-level constraint:

    • Specify the text content, font style, font size hierarchy, and layout area.
    • Treat the text region as a separate layer or mask to avoid mixing with background textures.
    • Use segmented layout for long text to reduce single-line complexity.
    • Add character recognition validation after generation, and automatically redraw the region if it fails.

    Pseudocode example:

    1. def render_text_region(canvas, text, bbox, style):
    2. mask = build_text_mask(text, bbox, style)
    3. canvas = inpaint(canvas, mask, prompt=style)
    4. if not ocr_match(canvas, bbox, text):
    5. return render_text_region(canvas, text, bbox, style)
    6. return canvas

    This closed loop of “generate + validate + retry” is more suitable for production environments than relying on a single model pass.

    4. Complex Relations and Controllability: Replace Guesswork with a Constraint System

    To reliably satisfy complex scenarios, prompts need to be upgraded from a natural-language wish list to a constraint system. Developers are advised to adopt a structured prompt template:

    • Subject list: enumerate all entities with unique identifiers.
    • Attribute binding: colors, materials, and counts must be bound to subjects.
    • Spatial layout: describe positions using a grid, coordinate ranges, or relative relations.
    • Negation items: list prohibited elements separately.
    • Output specification: aspect ratio, resolution, blank areas, and text safe zones.

    Example:

    1. Subjects: Character A (red raincoat), Bench B (blue), Animal C
    2. Layout: A is to the left of B; C is to the right of B
    3. Negation: C must not eat any fruit
    4. Output: 16:9, with a title safe zone reserved at the bottom

    In team collaboration, these templates can be placed under configuration management and paired with an automated evaluation set for regression testing. Recommended evaluation dimensions include attribute accuracy, relation accuracy, negation compliance, text readability, and aesthetic score.

    5. Engineering Implementation: Stability, Cost, and Iteration Loops

    For enterprise applications, generation capabilities must be integrated with an engineering system to deliver reliably. The following practices can be referenced:

    • Task orchestration: build a pipeline of “parse, plan, render, validate, retry” to make it easier to locate failure points.
    • Caching and reuse: cache structured intermediate representations and common templates to reduce repeated computation.
    • Quality gates: use a fixed evaluation set before release, set thresholds, and block release if targets are not met.
    • Monitoring and alerting: establish monitoring and alerts for failure rate, retry rate, and latency distribution.
    • Resource elasticity: rendering tasks often have bursty traffic patterns, so container platforms and queue services can be used for elastic scaling and peak shaving.
    • Asset governance: store generated results, templates, and evaluation data in object storage separately, and track the call chain through logging services.

    When using cloud resources, a combination of general capabilities can be adopted: object storage for assets and outputs, a message queue for asynchronous tasks, a container platform for rendering workloads, and monitoring and alerting for stability. This helps control costs and supports canary releases and fast rollbacks.

    6. Conclusion

    The core competitiveness of multimodal generation is shifting from single-point image quality to “semantically controllable + process verifiable + engineering operable.” By splitting generation into planning and rendering layers, incorporating text and spatial relations as explicit constraints, and forming a closed loop through validation and retries, developers can move generation capabilities from demo effects to production readiness.