How Text-to-Image Models Follow Complex Instructions: Separating Planning from Rendering

    Text-to-image models often satisfy only part of a complex prompt. They may apply a color to the wrong object, swap left and right, or draw an object the prompt excludes. This article explains why these failures happen and describes a two-stage approach that separates semantic planning from visual rendering. It covers four common failure types, a structured intermediate representation, separate handling of text rendering, a comparison of three approaches, and practical steps for engineering teams.

    1. Background

    Text-to-image generation has spread quickly over the past few years, yet many users run into similar problems. When a prompt describes multiple objects, their spatial relationships, and several constraints, the output often satisfies only some of them. For example, a color is applied to the wrong object, “left” and “right” are swapped, or a negative condition such as “without a certain object” is ignored.

    The root cause lies in how early models worked. They used a text encoder to compress the entire prompt into a conditioning vector, and a diffusion process then denoised that vector step by step into pixels. The conditioning vector preserves the meaning of the words but often fails to preserve the structural relationships between objects. The model knows which elements should appear, but it has no explicit intermediate representation of how those elements should be arranged.

    2. Problem Breakdown: Four Typical Failure Types

    In engineering evaluations, failures on complex instructions fall into four categories.

    1. Spatial relations: relative positions such as left and right, above and below, front and back, containment, and occlusion.
    2. Attribute binding: the match between colors, materials, quantities, and the specific objects they describe.
    3. Negative constraints: when a prompt describes what should not appear or what is absent, models tend to draw the excluded object anyway.
    4. Text rendering: characters, numbers, and labels that must appear accurately in the image.

    These four problems share a common trait. They require the model to parse the instruction into structure, not just recognize keywords. Only after the problems are clearly broken down can targeted improvements be designed.

    3. A Hybrid Approach: Plan First, Then Render

    A widely adopted approach in the industry splits the generation process into two stages.

    Stage one is semantic planning. An autoregressive model that is strong at language understanding reads the instruction and outputs a structured scene description. The description includes a list of objects, their positions, attributes, constraints, and background.

    Stage two is visual rendering. A diffusion-type model generates pixels step by step according to the plan, with a focus on texture, lighting, and detail quality.

    This division of labor lets the planning stage handle logical relationships explicitly, while the rendering stage focuses on visual quality. The interface between the two is an intermediate representation that can be inspected, validated, and modified.

    3.1 Output Design for the Planning Stage

    Use a fixed-structure data format for the plan so that downstream validation is straightforward. The structure below is illustrative, and the field names are used only for explanation.

    1. {
    2. "canvas": {"background": "indoor study"},
    3. "objects": [
    4. {"id": "boy", "type": "person", "attrs": ["wearing a blue hat"], "position": "right side of the image"},
    5. {"id": "desk", "type": "desk", "attrs": ["with an open book on it"], "position": "center of the image"},
    6. {"id": "plant", "type": "plant", "attrs": ["green leaves"], "position": "left side of the image"}
    7. ],
    8. "constraints": [
    9. {"type": "negation", "target": "plant", "forbidden": "flowering"}
    10. ]
    11. }

    This representation has several clear benefits. Each object is bound one-to-one to its attributes, which prevents colors from landing on the wrong object. Positions are recorded in explicit fields, which makes validation easier. Negative constraints are stored separately, so they can be checked before rendering.

    3.2 Conditioning Injection in the Rendering Stage

    After receiving the plan, the rendering model must convert the structural information into conditioning inputs. Common methods include converting the structured description into more detailed text conditions, using region masks to constrain object positions, or adding layout guidance during sampling. The specific method depends on the base model in use, so engineering teams should rely on their own evaluation results.

    3.3 Handling Text Rendering Separately

    Text in an image is a special kind of object. Traditional methods treat text as texture, which often produces broken strokes or characters that look like text but cannot be read. A more reliable approach is to list the text to be displayed as a separate planning field and use glyph-level conditioning inputs during rendering. After generation, read the text back with optical character recognition (OCR) to verify it. If the recognized text does not match the target, regenerate the image or send it for manual review.

    4. Comparison of Approaches

    The table below compares three common approaches across several dimensions.

    Dimension Pure diffusion generation Language model outputs layout directly Two-stage planning-plus-rendering approach
    Spatial relations Depends on the prompt, with moderate stability Can be expressed explicitly Expressed explicitly and can be validated
    Attribute binding Prone to misplacement Relatively good Relatively good, and can be checked in a structured way
    Negative constraints Often fails Can be filtered out at the planning layer Can be filtered out at the planning layer and validated
    Text rendering Frequent errors Needs to be combined with rendering Can be handled separately and checked by reading back the text
    Engineering complexity Low Medium High
    Debuggability Weak Medium Strong

    The two-stage approach is more complex, and its latency and cost are higher. Whether to adopt it depends on whether the business requires accuracy more than speed and cost.

    5. Engineering Implementation Steps

    1. Build an evaluation set. Prepare dozens of samples for each of the four categories (spatial relations, attribute binding, negation, and text), and record the pass rate for each category.
    2. Define the plan structure. Settle the fields and validation rules first, then connect the model, so the output format stays consistent.
    3. Write validation functions. Before rendering, check that all objects are present, positions are valid, and negative constraints refer to known objects.

    Sample code:

    1. def validate_plan(plan: dict) -> list[str]:
    2. errors = []
    3. ids = {obj["id"] for obj in plan.get("objects", [])}
    4. if not ids:
    5. errors.append("No objects found in the plan")
    6. for c in plan.get("constraints", []):
    7. if c.get("type") == "negation" and c.get("target") not in ids:
    8. errors.append(f"Negation constraint refers to an unknown object: {c.get('target')}")
    9. for obj in plan.get("objects", []):
    10. if obj.get("position") not in {"left side of the image", "center of the image", "right side of the image"}:
    11. errors.append(f"Invalid position for object {obj.get('id')}")
    12. return errors
    1. Set a fallback strategy. When validation fails, ask the planning module to regenerate its output or return an error directly. This keeps a non-compliant plan from reaching the rendering module.
    2. Log and monitor. Save each plan’s structure and the final image for issue review and future iteration.

    6. Considerations

    First, do not make the plan structure overly complex. More fields increase the chance of model errors and raise the cost of validation.

    Second, monitor text rendering accuracy continuously. Do not judge performance by a single demo result.

    Third, if generated content involves real people, brand logos, or sensitive scenes, add a content review step.

    Fourth, base performance metrics on your own test data. Do not cite unverified figures directly.

    7. Summary

    Image generation for complex instructions is fundamentally a problem of structured understanding. Splitting generation into planning and rendering stages, and connecting them with a verifiable intermediate representation, makes system behavior more controllable and easier to debug. For developers, the key is to build an evaluation set first, then decide how deeply to invest in the architecture.