Zero-Painter: Training-Free Layout Control for Text-to-Image Synthesis

Marianna Ohanyan, Hayk Manukyan, Zhangyang Wang, Shant Navasardyan, Humphrey Shi

Introduction

Modern text-to-image (T2I) synthesis has reached unprecedented levels of visual quality, yet precise spatial control remains a significant hurdle. While models like Stable Diffusion can generate stunning imagery from text, they often struggle with complex spatial reasoning. When a user provides a prompt requiring multiple objects in specific locations, the resulting images frequently suffer from attribute leakage—where characteristics of one object bleed into another—or a complete disregard for the requested layout.

Zero-Painter is a novel, training-free framework designed to address these limitations. By decoupling the generation process into a two-stage "generate-then-compose" pipeline, Zero-Painter achieves state-of-the-art shape fidelity and attribute preservation without the need for expensive model fine-tuning or specialized datasets.

The Challenge of Spatial Reasoning

Existing solutions for layout control generally fall into two categories: training-based and training-free. Training-based methods, such as GLIGEN or ControlNet, require large-scale specialized datasets and significant computational resources. Conversely, existing training-free methods often rely on attention guidance that fails to keep objects strictly within user-defined boundaries, leading to blurry edges or misplaced objects. Zero-Painter bridges this gap by providing the flexibility of a training-free approach with the precision typically reserved for layout-aware models.

Methodology

Zero-Painter utilizes a two-stage pipeline that moves away from traditional "all-at-once" generation, focusing instead on individual object integrity and harmonious composition.

Stage 1: Single Object Generation (SOG)

In the first stage, Zero-Painter generates each object individually on a flat background. To ensure the generated object adheres strictly to the user's provided mask, the authors introduce Prompt-Adjusted Cross-Attention (PACA). PACA modifies the cross-attention layers to amplify the influence of object-specific tokens within the masked area.

A key innovation in this stage is the use of the Start of Text (SOT) token. The researchers discovered that the SOT token acts as a "null" signal. By forcing pixels outside the mask to attend to the SOT token, the model effectively mutes the prompt in those regions, preventing the object from spilling over its boundaries. Following generation, the Segment Anything Model (SAM) is used to refine the masks, ensuring the final composition uses the actual shape of the generated object rather than a rough approximation.

Stage 2: Comprehensive Composition (CC)

Once individual objects are generated, they are stitched together using a pre-trained inpainting model. To prevent attribute leakage during this merge, the authors developed Region-Grouped Cross-Attention (ReGCA). ReGCA acts as a "semantic firewall" by partitioning the latent image into groups based on the masks. Each group is restricted to attending only to its specific local prompt. This ensures that a "red apple" and a "blue vase" can coexist in the same frame without the colors bleeding into one another.

Experimental Evaluation

The researchers evaluated Zero-Painter using two primary datasets:

  • MSCOCO: A validation set of 3,000 segmentation layouts for quantitative benchmarking.
  • Unsplash: A hand-crafted test set derived from real-world images to test qualitative performance in practical scenarios.

Key Results

Zero-Painter consistently outperformed existing state-of-the-art (SOTA) training-free methods, such as eDiff-I and MultiDiffusion, across several metrics:

  • Text Alignment: Zero-Painter achieved a Local CLIP Score of 26.68, indicating superior alignment between generated objects and their textual descriptions.
  • Shape Fidelity: The model reached an Intersection over Union (IoU) of 0.75, a significant improvement over the 0.62 achieved by eDiff-I. This demonstrates that Zero-Painter follows user-provided masks with much higher precision.
  • User Preference: In subjective studies, participants overwhelmingly preferred Zero-Painter for its ability to match shapes and preserve object properties accurately.

Discussion and Limitations

The "divide and conquer" approach of Zero-Painter allows the model to dedicate its entire attention budget to a single object at a time, preventing the pixel competition that often plagues complex scenes. However, the framework does have limitations. Currently, Zero-Painter struggles with overlapping masks, as ReGCA treats each mask as a distinct region for inpainting. This makes it difficult to handle complex occlusions or depth-layering naturally. Additionally, because objects are generated individually, the computational cost is higher than single-pass generation methods, though batching can mitigate this to some extent.

Future work will likely focus on improving composition logic to handle depth and occlusion, further refining the balance between training-free flexibility and structural precision.

Summary updated

BibTeX
@inproceedings{ohanyan2024zero,
  author = {Marianna Ohanyan and Hayk Manukyan and Zhangyang Wang and Shant Navasardyan and Humphrey Shi},
  title = {{Zero-Painter: Training-Free Layout Control for Text-to-Image Synthesis}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  url = {https://openreview.net/forum?id=twj8aOaPHH},
}
Figure