NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Control and Realism: Best of Both Worlds in Layout-to-Image without Training

Bonan Li, Yinhan Hu, Songhua Liu, Xinchao Wang

TL;DR

WinWinLay is a new training-free layout-to-image generation method that simultaneously achieves precise spatial control and high visual realism. By introducing a non-local attention prior to prevent localized object collapse and a Langevin dynamics-based adaptive update rule to maintain in-distribution image quality, it eliminates the classic trade-off between layout adherence and photorealism.

What Problem Does This Paper Address?

Layout-to-Image (L2I) generation allows users to control where objects appear in a scene by providing bounding boxes alongside text prompts. While fine-tuning text-to-image (T2I) models on paired layout data works well, it is incredibly expensive and data-intensive. Consequently, researchers have pivoted to training-free methods that apply "backward guidance" during the denoising phase—using an energy function to steer cross-attention maps toward the target bounding boxes.

However, existing training-free methods suffer from two core flaws:

  1. Imprecise Localization (Attention Collapse): Objects often fail to fill the specified bounding boxes uniformly, instead collapsing into tiny sub-regions.
  2. Unrealistic Artifacts: The standard backpropagation rules used to update latent features do not account for the pre-trained model's original data distribution. Pushing the features too hard to satisfy layout constraints forces them out-of-distribution, resulting in distorted, unnatural images.

Methods

WinWinLay introduces two key strategies to tackle these issues collaboratively:

1. Non-local Attention Energy Function

The authors mathematically prove that standard attention energy functions suffer from an implicit bias: they inherently favor patches that already have high initial attention values, causing the object to collapse locally.

To fix this, WinWinLay introduces a Non-local Attention Prior. It constructs a prior distribution ($\tau$) that gently encourages attention to spread across the entire bounding box while prioritizing the center. By maximizing the KL divergence between the actual attention map and this prior, the model ensures uniform coverage. Furthermore, they apply a decaying schedule ($\rho$) over the denoising steps, allowing the strict box constraint to relax later in the process so objects can form natural, irregular shapes (like sprawling tree branches).

Visualization of cross-attention maps showing how the non-local prior prevents local attention collapse.

2. Langevin Dynamics Adaptive Update

Instead of using vanilla backpropagation to force layout compliance, WinWinLay treats the update step as sampling from a joint distribution of both the layout constraints and the pre-trained model's latent distribution.

Using Langevin dynamics, the update rule balances the unconditional score function (preserving realism) and the layout energy gradient (preserving control). Crucially, the authors eliminate tedious hyperparameter tuning by formulating this balance as a multi-task optimization problem. Borrowing from Nash Bargaining theory (Nash-MTL), they derive an adaptive parameter ($\nu$) that automatically calculates the optimal weight balance at each individual denoising step.

Comparison of latent variable trajectories between standard backpropagation and the proposed adaptive update.

Datasets

The method was evaluated using Stable Diffusion 1.5 and SDXL as base models on two standard benchmarks:

  • COCO2014
  • Flickr30K

Evaluation metrics included YOLOv7 object detection (AP and $\text{AP}_{50}$) to measure layout accuracy, CLIP-s for text-image alignment, and FID, PickScore, and ImageReward to evaluate visual quality and human preference.

Key Insights and Ideas

  • The Math Behind the Collapse: The paper provides the first rigorous theoretical analysis showing why backward guidance causes attention to cluster locally. Because all patches within a masked region receive identical gradient magnitudes during standard energy minimization, initial high-value patches gain an exponential advantage.
  • Realism vs. Control is a False Dichotomy: Traditional backward guidance treats layout enforcement as a hard optimization problem independent of the model's prior. By reframing it as joint distribution sampling via Langevin dynamics, the model naturally stays within the bounds of photorealism.
  • Automated Hyperparameter Balancing: Rather than manually tuning gradient step sizes across different prompts, calculating the ratio of the magnitudes of the score function and the energy gradient provides a mathematically sound, dynamically shifting balance parameter ($\nu$).

Key Results

WinWinLay significantly outperforms current state-of-the-art training-free methods like Layout-Control, AttRe, R&B, and CSG across both datasets.

  • Quantative Improvements: On COCO2014, WinWinLay achieved an AP of 19.74 (outperforming the next best method, R&B, at 17.63) and a CLIP-s score of 0.327. It also achieved the best image quality scores (lowest FID of 26.85 and highest ImageReward of 0.7218).
  • User Preference: In human evaluation studies, over 27.7% of participants selected WinWinLay as the best method for both controllability and image quality out of five competing approaches.
Qualitative comparison showing WinWinLay successfully filling bounding boxes while maintaining high image fidelity compared to other SOTA methods.

Limitations and Future Work

While WinWinLay represents a major leap forward, the authors note a few constraints:

  • Prior Sensitivity: If the hyperparameter $\rho$ (controlling the strength of the non-local prior) is set too high, it can force objects into unnaturally rigid, boxy configurations (e.g., generating a rabbit that looks perfectly square to match a canvas).
  • Optimization Overhead: Langevin dynamics requires iterative updates ($O=4$ steps per denoising step in their setup), which adds slight computational overhead compared to simple forward-pass generation, though it remains highly efficient compared to training-based alternatives.

Summary updated

BibTeX
@inproceedings{li2025control,
  author = {Bonan Li and Yinhan Hu and Songhua Liu and Xinchao Wang},
  title = {{Control and Realism: Best of Both Worlds in Layout-to-Image without Training}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=4Gs48lcx49},
}
Figure