Local Conditional Controlling for Text-to-Image Diffusion Models

Yibo Zhao, Liang Peng, Yang Yang, Zekai Luo, Hengjia Li, Yao Chen, Xiaofei He, Wei Zhao, qinglin lu, Boxi Wu, Wei Liu

TL;DR

This paper introduces a training-free, inference-stage method for local conditional control in text-to-image diffusion models, allowing users to apply spatial constraints (like edges or depth maps) to specific regions without overriding the rest of the text prompt. By mitigating the "local control dominance" problem, the approach successfully generates complex multi-object scenes that remain faithful to both local image conditions and global text descriptions.

What Problem Does This Paper Address?

While tools like ControlNet and T2I-Adapter have made text-to-image generation incredibly controllable by incorporating structural guidance (e.g., Canny edges, depth maps), they operate globally across the entire image. If a user wants to apply a specific pose to just one object (e.g., a cat) using an edge map, but wants the rest of the image to freely generate other elements from a prompt (e.g., "a cat and a toy vehicle on the road"), standard models fail.

Directly feeding a localized condition into these models causes a catastrophic issue the authors term local control dominance. The structural guidance from the local condition hijacks the model's cross-attention layers. As a result, the model focuses entirely on the controlled region and completely ignores other objects mentioned in the text prompt, or erroneously blends their features into the controlled area.

The local control dominance problem: Naive local conditioning causes other prompt concepts (like the dog) to be ignored or poorly generated.

Methods

To solve this without the need for expensive retraining or specialized datasets, the authors propose a training-free framework applied entirely during the inference (denoising) stage. It consists of four core components:

  1. Control Concept Matching: At each denoising step, the model automatically identifies which text token (e.g., "cat") corresponds to the user-defined local control mask by analyzing cross-attention scores. A voting mechanism (Countmax) is used in the early timesteps to stabilize this selection while the image layout is forming.
  2. Regional Discriminate Loss (RDLoss): To prevent the local condition from dominating, RDLoss optimizes the noised latents at each step. It calculates the distance between maximum attention values inside and outside the masked region. For tokens not tied to the local control (e.g., "dog"), it forces the model to shift its attention outside the mask, prompting the generation of the missing objects in the background.
  3. Focused Token Response (FTR): FTR suppresses weaker, non-maximum attention scores along the token dimension. This sharpens object boundaries, enhances distinction between different subjects, and reduces duplicate object generation.
  4. Feature Mask Constraint (FMC): Injecting localized conditions into a global network like ControlNet leaves large "blank" areas that can corrupt the latent distribution and degrade image quality. FMC explicitly masks ControlNet’s output features before they are fused into the UNet, ensuring the model only looks at the control features within the designated zone.
Figure 3: Overview of our method. Given the text condition and local control condition, a latent variable zT is passed into the denoising network, i.e., UNet. At each denoising step, we apply Feature Mask Constraint (see Section 3.5) to the ControlNet branch output features. Cross-attention maps generated from UNet are refined by Focused Token Response (see Section 3.4), which suppresses weaker interfering responses to enhance object distinction. Furthermore, we use Regional Discriminate Loss (see Section 3.3) to update the latent zt, thereby identifying and regenerating ignored objects in the cross-attention map.

Datasets

The authors evaluated their approach using two primary datasets:

  • COCO2017 Validation Set: A standard benchmark where 5,000 images were randomly paired with one caption each to evaluate general image quality and spatial layout alignment.
  • Attend-Condition Dataset: A new dataset created by the authors specifically to test multi-concept generation under local control. It features 11 object and 11 animal categories, with prompts structured as "a [object] and a [animal]". Images with large subject areas were sourced from the internet to serve as local control templates.

Key Insights and Ideas

  • The Cross-Attention Hijack: The root cause of local control dominance is that high-frequency structural guidance (like sharp edges) inflates the attention scores of the matching token so aggressively that it suppresses the generation of any other concepts in the prompt.
  • Inference-Time Optimization is Enough: Instead of training a new architectural variant or adapter for local control, the layout can be successfully steered simply by backpropagating a specialized attention loss (RDLoss) to update the latents ($z_t$) during the first few denoising steps.
  • Timing Matters ($\beta$): Layout and object composition are locked in during the very early stages of diffusion. The authors found that stabilizing the concept matching specifically during the first 10% to 20% of the denoising steps ($\beta$ between 0.8 and 0.9) is critical for high-quality generation.

Key Results

The proposed method was compared against naive ControlNet/T2I-Adapter implementations, as well as specialized baselines like Noise-Masking and Inpainting.

Quantitative Performance

On the COCO2017 dataset, the method achieved state-of-the-art results in text-image alignment and image quality:

  • FID (Image Quality): Achieved 21.86, significantly outperforming naive ControlNet (27.87) and T2I-Adapter (30.32).
  • CLIP Score (Text Alignment): Reached 0.305, proving that the model successfully generated the background objects that baseline models ignored.

Qualitative Performance

As shown in the visual comparisons, when prompted with "a cat and a toy vehicle on the road", the baseline ControlNet only generates the cat. In contrast, the authors' method perfectly preserves the cat's pose from the edge map while cleanly rendering a toy vehicle next to it.

Visual comparison showing that the proposed method successfully respects local conditions while accurately generating secondary prompt objects.

Limitations and Future Work

  • Slight Spatial Fidelity Trade-off: Introducing latent updates via RDLoss slightly reduces the absolute spatial alignment precision compared to pure global ControlNet (as indicated by a minor drop in IOU and LPIPS scores in the ablation studies).
  • Hyperparameter Sensitivity: The success of the layout generation heavily relies on the threshold parameter $\beta$. Deviating from the optimal 0.8–0.9 range can cause a noticeable drop in image quality or text alignment.
  • Future Directions: The authors suggest exploring more adaptive ways to balance the strength of the local structural condition against the generative freedom of the text prompt dynamically throughout the denoising process.

Summary updated

BibTeX
@misc{zhao2023local,
  author = {Yibo Zhao and Liang Peng and Yang Yang and Zekai Luo and Hengjia Li and Yao Chen and Zheng Yang and Xiaofei He and Wei Zhao and qinglin lu and Boxi Wu and Wei Liu},
  title = {{Local Conditional Controlling for Text-to-Image Diffusion Models}},
  year = {2023},
  eprint = {2312.08768},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.08768},
}
Figure