RealCompo: Balancing Realism and Compositionality Improves Text-to-Image Diffusion Models

Xinchen Zhang, Ling Yang, Yaqi Cai, Zhaochen Yu, Kai-Ni Wang, Jiake Xie, Ye Tian, Minkai Xu, Yong Tang, Yujiu Yang, Bin Cui

TL;DR

RealCompo is a training-free, plug-and-play framework that solves a major bottleneck in text-to-image generation: the trade-off between image realism and spatial compositionality. By introducing a novel dynamic balancer that blends the predicted noise of standard text-to-image models and spatial-aware models during inference, it achieves state-of-the-art multi-object generation without requiring any extra model training.

What Problem Does This Paper Address?

Current state-of-the-art text-to-image (T2I) diffusion models (like Stable Diffusion or DALL-E) excel at creating highly realistic and aesthetically pleasing images. However, they frequently fail when prompts require precise spatial arrangements or complex multi-object compositions (e.g., "a cat sitting on the table to the right of the vase").

To fix this, researchers developed layout-to-image (L2I) and spatial-aware models (like GLIGEN or ControlNet) that accept bounding boxes, keypoints, or segmentation maps to anchor objects. Unfortunately, these spatial constraints introduce a "realism penalty"—the resulting images often look less natural, less aesthetic, and more unstable. The authors demonstrate that even if you turn off layout controls halfway through the generation process, the text-guided model fails to recover the lost realism. RealCompo addresses this fundamental conflict by dynamically balancing fidelity and spatial awareness at every step of the image generation process.

Figure 1: Motivations of RealCompo. (a) and (c) The realism and aesthetic quality of generated images become poor as more layout is incorporated. (b) Even if layout is incorporated only in the early denoising stages, the control of text alone still fails to alleviate the poor realism issue.

Methods

RealCompo operates as a training-free framework that runs two pre-trained diffusion models in parallel during the denoising process: a fidelity branch (a standard or stylized T2I model) and a spatial-aware branch (an L2I or ControlNet model).

The core architecture consists of three main steps:

  1. LLM-Based Layout Generation: The user's text prompt is first fed into a Large Language Model (like GPT-4) using in-context learning to automatically plan the spatial layout (bounding boxes) for the objects mentioned.
  2. Dynamic Balancer: Instead of simply averaging the outputs of the two diffusion branches, RealCompo introduces an inference-time optimization mechanism. At each denoising step $t$, the balancer analyzes the cross-attention maps of both models to see how well their internal features align with the target layout.
  3. Internal Coefficient Update: The balancer calculates a localization loss and uses its gradient to dynamically update the blending coefficients ($\xi_t$) for the predicted noises of both branches. This ensures that the spatial-aware branch dominates when positioning objects, while the fidelity branch takes over to refine textures, colors, and realism.

Furthermore, the authors introduce a generalized region-control transfer function, allowing RealCompo to seamlessly extend beyond bounding boxes to keypoint- and segmentation-based control models.

Figure 2: An overview of RealCompo framework for text-to-image generation. We first use LLMs or transfer function to obtain the corresponding layout. Next, the balancer dynamically updates the influence of two models, which enhances realism by focusing on contours and colors in the fidelity branch, and improves compositionality by manipulating object positions in the spatial-aware branch.

Datasets

The authors evaluated RealCompo using two primary resources:

  • T2I-CompBench: A comprehensive benchmark specifically designed to evaluate compositional text-to-image generation across seven distinct metrics, including attribute binding (color, shape, texture), object relationships (spatial and non-spatial), numeracy, and complex prompts.
  • COCO Validation Set: The authors randomly selected 3,000 text prompts from this dataset to evaluate image realism and text-image alignment using objective metrics like CLIP score and the LAION aesthetic predictor.

Key Insights and Ideas

  • The Realism Penalty is Persistent: A key finding is that layout injection permanently alters the trajectory of the diffusion process. Even if layout guidance is stopped early (e.g., at step 20 out of 50), text-only guidance cannot steer the model back to a high-realism state. Continuous, balanced intervention is necessary.
  • Noise-Level Optimization: Unlike prior methods that attempt to update the latent states directly (which can cause visual instability), RealCompo optimizes the coefficients of the predicted noise based on cross-attention gradients. This proves to be a much more stable way to guide the generation direction.
  • Universal Model Compositions: Because it requires zero training, RealCompo can pair virtually any T2I model—including highly customized or stylized community models—with any spatial-aware model, acting as a universal bridge for controllable generation.

Key Results

  • State-of-the-Art Compositionality: On T2I-CompBench, RealCompo achieved the highest scores across all seven evaluation tasks. Notably, it scored 0.7741 in color attribute binding (compared to GLIGEN's 0.4288) and 0.3173 in spatial object relationships.
  • Superior Realism: RealCompo achieved a CLIP score of 0.334 and an Aesthetic score of 5.742, outperforming both standard T2I baselines (SD v1.5: 5.326) and layout models (GLIGEN: 4.892).
  • Human Approval: A user study collecting 1,755 votes from 39 participants showed an overwhelming preference for RealCompo in terms of realism, compositionality, and comprehensive image quality compared to standalone models.

Limitations and Future Work

The primary limitation of RealCompo is its computational overhead. Because the framework runs two separate diffusion models simultaneously and computes gradients at each inference step, its computational cost is higher than running a single standard T2I model.

For future work, the authors plan to investigate more efficient computational methods to reduce inference times. They also aim to extend this dynamic balancing paradigm to more complex generative tasks, such as text-to-video and text-to-3D generation.

Summary updated

BibTeX
@inproceedings{zhang2024realcompo,
  author = {Xinchen Zhang and Ling Yang and Yaqi Cai and Zhaochen Yu and Kai-Ni Wang and Jiake Xie and Ye Tian and Minkai Xu and Yong Tang and Yujiu Yang and Bin Cui},
  title = {{RealCompo: Balancing Realism and Compositionality Improves Text-to-Image Diffusion Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=R8mfn3rHd5},
}
Figure