Planning and Rendering for Complex Compositional Image Generation
Complex image generation fails less often on visual fidelity than on constraint satisfaction. This article breaks generation into a planning stage that emits a verifiable scene structure and a rendering stage that fills in pixels, then covers the four common failure modes (attribute binding drift, spatial relations that never become layout, negation read as a positive prompt, text treated as texture), what the planning layer should output, how to make text a first-class symbol channel with OCR read-back, a staged production pipeline with assertion-based QA, layered evaluation metrics, and deployment notes for splitting planning and rendering across services.
With complex instructions, the hard part of image generation is usually not whether the picture looks right, but whether it holds under the constraints. A poster has to satisfy subject placement, locked colors, object states, background relationships, and readable text at the same time. If any one of those fails, the image cannot enter a design or ad-serving workflow.
Traditional single-pass denoising generation is good at producing a visual result quickly in terms of texture, lighting, and style. It lacks a stable intermediate commitment for discrete symbols and logical relations, so it tends to produce extra fingers, flipped left and right, missing objects that should be present, and text that degrades into unreadable texture.
Separate Two Capabilities First
It helps to split generation into planning and rendering. Planning turns natural language into checkable picture facts: which objects exist, their attributes, spatial relations, whether something is allowed to appear, and the exact character sequence of any text. Rendering works under those facts to produce composition, materials, lighting, and detail. The two have different goals, yet they are usually crammed into a single sampling pass. When one sampler has to guess both semantics and pixels, high-frequency detail overwhelms low-frequency logic, and the model leans toward an image that “looks plausible” rather than one that “strictly satisfies the instruction.”
The more robust engineering approach is to let an autoregressive sequence model emit a structured blueprint first, then have a diffusion or other pixel model fill in color against that blueprint. The planning module generates objects and relations in order, which suits discrete decisions such as “left/right,” “contains/does not contain,” and “is/is not.” The rendering module then focuses on the continuous visual distribution. This is not simply chaining two models together; it moves business constraints that cannot be differentiated through forward into a symbolic layer that can be validated.
Why Complex Instructions Fail
Failures fall into four common categories.
First, attribute binding loosens. When multiple objects share colors, materials, or actions, attributes bleed onto the wrong object. If “a person in a red coat” and a “blue bench” appear together, the colors may swap.
Second, spatial relations stay linguistic and never become layout. The model knows that words like “left” and “right” co-occur with certain compositions, but without explicit coordinates or region commitments, the relation gets overwritten by style priors during sampling.
Third, negative instructions are treated as positive prompts. In the training distribution of generative models, a named concept is more likely to appear. If “do not eat the apple” is injected only as a negated sentence, the apple may still be drawn. The planning layer needs to state object state explicitly: the apple is not at the mouth, not in the hand, or the object does not enter the scene at all.
Fourth, text is treated as texture. If glyph shapes, stroke order, and character boundaries are not modeled separately, a poster headline turns into a pattern that merely resembles characters. Chinese, multi-line typesetting, capitalization, and punctuation all amplify the problem.
What the Planning Layer Should Output
The planning result should be an intermediate representation, not another, longer piece of natural language. Natural language is still ambiguous and cannot be accepted automatically downstream. A usable scene description contains at least: canvas and safe area, object list, attribute table, relation table, text layers, negative constraints, and render hints. Render hints keep only style, lighting, and camera, and no longer carry logic.
A sketch of the structure:
{"canvas": {"ratio": "3:4", "safe_margin": 0.08},"objects": [{"id": "person", "region": "left", "attrs": ["red-coat"]},{"id": "bench", "region": "background", "attrs": ["blue"]}],"relations": [{"type": "left_of", "a": "person", "b": "bench"}],"negatives": ["person holding apple"],"text_layers": [{"content": "Grand Opening", "script": "latin", "align": "center"}]}
Regions can use discrete labels such as left, right, top, bottom, foreground, and background, or normalized boxes instead. Discrete labels are easier for people and rules to check; boxes are better suited to downstream layout control. Text layers must preserve the exact string, the writing system, and line order, and must not rewrite the copy during planning.
The planning module can use constrained decoding: object IDs must come from a whitelist, relation types from an enumeration, and text-layer characters must match the user’s original text character for character. This reduces secondary errors caused by the planner inventing things on its own. If the instruction is self-contradictory, for example the same object required to be both fully red and fully blue, planning should reject it and return the conflicting items rather than leaving rendering to chance.
Space, Containment, and Negation
Spatial relations need to land on verifiable predicates. left_of should not live only in the prompt; after layout passes, check the horizontal order of the two regions. contains should check box containment, and not_overlap should check the safe margin. Thresholds depend on the business: poster whitespace and edge-to-edge illustration have different standards.
Negations are best rewritten as positive states. Instead of only saying “does not eat the apple,” state that the hands are empty, the mouth is closed, and no apple instance is generated in the scene. Rendering then treats these states as conditions. If the renderer supports regional conditioning or reference layouts, strengthen the condition only inside the corresponding box so global prompts do not contaminate each other.
Multi-object scenes also need binding tests: attach each attribute to exactly one object ID, then after rendering use detection or human spot checks to confirm the ID still maps to the same region. This catches errors where “the color is right but painted on someone else,” which an aesthetic score alone will never reveal.
Treat Text as Symbols
Readable text needs a dedicated symbolic path rather than hoping a diffusion process grows glyphs out of texture. Engineering-wise, at least three things must hold.
The character sequence must be correct. When titles, prices, and campaign names come from business data, compare them character for character; semantic similarity is not a substitute. Simplified and traditional forms, full-width and half-width, digits and letters all need checking by original code point.
The glyph structure must be sound. The component and stroke connectivity of Han characters and the skeleton of Latin letters should be preserved in text rendering or glyph conditioning. One approach is to render text first into a transparent-background glyph image, pass it to the image model as a spatial condition, and let the model handle lighting, material, and style blending. The model is then responsible for “looking like it belongs in the scene,” and the typesetting engine is responsible for “the characters being right.”
The layout must stay editable. Production posters should keep a text layer, or at least keep text boxes. The image model handles background and subject, and the title is composited by the typesetting system, which satisfies brand fonts, leading, and later copy edits. Only when text must follow perspective, fabric, or neon material should glyph conditions be deeply fused into the image, followed by an OCR read-back after fusion.
Read-back should not rely on whole-sentence similarity alone. Report character error rate and the positions of missing and extra characters. A single wrong character on a poster usually invalidates the whole batch, so text metrics should be stricter than overall aesthetic metrics.
A Production Pipeline That Works
Split one image generation into fixed stages rather than a single end-to-end call.
- Instruction normalization: extract objects, attributes, relations, and the original text; flag ambiguity and conflicts.
- Planning generation: output the scene structure, then accept it via schema validation, enum constraints, and character comparison.
- Layout solving: turn region labels into boxes that do not violate each other, handling safe areas and text avoidance.
- Layered rendering: generate background, subject, and text conditions separately, or control their strengths separately, to reduce attribute bleed.
- Automated QA: check that objects are all present, relations hold, text reads back identically, and no obvious anatomical anomalies appear.
- Failure feedback: redo only the failed layer. If the text is wrong, do not resample the whole background; if a relation is wrong, fix the layout before rendering.
QA rules should be written as assertions, not as another round of “does it look good.” For example: the specified subject must be detected in the left region; the dominant color of the blue object falls within an agreed range; the detection score for negative objects is below a threshold; the text read-back matches the original exactly. Aesthetic ranking can serve as a secondary ordering among candidates from the same batch, but it must not override hard constraints.
Cap the number of candidates. After planning passes, render only a few candidates per layout and filter them with assertions instead of sampling heavily without constraints. This keeps latency and cost predictable and makes it easy to record which constraint caused a failure.
What to Measure
The offline set should cover relations, negation, attribute binding, long text, multiple languages, and dense small text, not just the look of landscapes or portraits. Layered metrics are more useful: planning validity rate, layout conflict rate, object recall, relation accuracy, character error rate, and human usability rate. Do not let a single “win rate” hide samples where the text is entirely wrong but the style looks good.
Regression tests must fix random seeds, resolution, and condition strengths; otherwise you cannot tell model regression from sampling variance. After launch, aggregate by failure type and prioritize filling in planning templates and QA assertions rather than blindly lengthening prompts.
Deployment and Collaboration Notes
Planning and rendering can be deployed separately. Planning is sequence-heavy compute, rendering is high-VRAM image compute, and decoupling them with queues also lets OCR read-back and detection be inserted asynchronously. Intermediate structures, glyph condition images, and final renders fit well in object storage, with version numbers linking instruction, layout, and model configuration. Logs and monitoring alerts should record per-stage latency, rejection reasons, and retry counts so you are not left looking only at the final failure.
On permissions, user copy and reference images should be managed as business data, and logs should avoid retaining unnecessary original images long term. If a frame contains logos or faces, the access scope of QA services should be controlled separately. These are general engineering practices and do not depend on any single vendor’s proprietary interface.
Summary
Stability in complex image generation comes from taking logic out of pixel sampling. First commit to objects, relations, negation, and text with verifiable structures; then let the rendering model handle lighting and style; finally use assertions to decide what ships. Handled this way, failures with left/right, containment, negation, and poster text can be localized to a specific stage — planning, layout, rendering, or read-back — instead of being met with another vague resample. Teams that make the intermediate representation and QA solid first can still reuse their business constraints when they swap the underlying generation implementation later.
