Easing Concept Bleeding in Diffusion via Entity Localization and Anchoring

Jiewei Zhang, Song Guo, Peiran Dong, Ziming Liu, Yue Yu, Xiao-Ming Wu

Introduction

Diffusion models have revolutionized image generation, but they often stumble when asked to create multiple distinct objects. This leads to "concept bleeding," where features of different entities merge into hallucinated hybrids. To combat this, researchers introduce Entity Localization and Anchoring (ELA), a training-free, inference-time technique that anchors objects to specific regions, ensuring complex prompts like "a cat and a frog" yield distinct animals rather than a green, frog-like cat.

The Challenge: Concept Bleeding and Missing Entities

While text-to-image models like Stable Diffusion excel at single subjects, they frequently fail at compositional prompts. This failure typically manifests in two ways:

  1. Entity Leakage (Concept Bleeding): The visual features of two objects blend together.
  2. Missing Entities: One of the requested objects fails to appear entirely.
Comparison of baseline generation with concept bleeding versus ELA's distinct entity generation.

The root cause lies in the model's cross-attention maps, which link text tokens to spatial regions in the image. In standard models, these maps often "leak" into the background or overlap with other objects. Previous solutions attempted to fix this by training auxiliary masking networks, but these are computationally expensive and require specialized datasets.

Methodology: Entity Localization and Anchoring (ELA)

To solve this without additional training, the researchers propose ELA, which operates entirely during the inference (generation) phase. The process follows three main steps:

  1. Extraction: During the early denoising steps, the algorithm extracts cross-attention maps from the U-Net.
  2. Localization: To find the "true" home for an entity, the model calculates the difference between entity maps and subtracts the background.
  3. Anchoring via Tailored Loss: The model applies a two-part loss function. A concentration loss pushes the entity's attention values to be higher within its designated mask, while an attenuation loss pulls the attention values down everywhere else to prevent leakage.

This optimization is only applied during the early stages of denoising, as this is when the structural layout of the image is determined.

Key Insights

  • The SoT Token as a Background Map: A clever finding is that the first token in a CLIP sequence—the "Start of Text" (SoT) token—naturally captures background semantics. Using this to binarize a background mask allows for much cleaner entity localization.
  • Layout is Decided Early: There is no need to optimize the latent space through all 50+ diffusion steps. Applying the ELA loss only at the start of the process is sufficient to "set" the layout, saving computation time.
  • Leakage Causes Missing Entities: The paper argues that "missing entities" are often just a side effect of extreme leakage. If one object's attention map is completely swallowed by another's, it effectively disappears from the final image.

Results and Performance

ELA was evaluated on multi-entity prompts, attribute binding prompts, and a human evaluation set. Since it is training-free, the focus was entirely on inference-time performance.

  • Quantitative Superiority: ELA outperformed Stable Diffusion (SD), SDXL, and Attend-and-Excite in CLIP text-image similarity and BLIP-based text-text similarity scores. For example, in "Animal-Animal" pairings, ELA achieved a text-text similarity score of 0.7964, compared to SD's 0.7571.
  • Human Preference: In human evaluations, ELA was chosen as the best performer in 34.02% of cases for general multi-entity prompts, nearly doubling the score of its closest competitor, Attend-and-Excite (18.05%).
  • Attribute Binding: ELA proved highly effective at preventing "color bleeding," ensuring that attributes like "yellow" or "blue" stayed confined to their correct object masks.

Limitations and Future Work

Despite its success, ELA faces a few hurdles. The interplay between entities becomes significantly more intricate as the number of objects increases; with four or more entities, the model still occasionally overlooks objects or struggles with complex overlaps. Additionally, because ELA requires calculating gradients and updating the latent state during inference, it is slower than a standard diffusion pass. Future work will aim to streamline computational costs and refine the localization logic to handle more crowded, complex scenes.

Summary updated

BibTeX
@inproceedings{zhang2024easing,
  author = {Jiewei Zhang and Song Guo and Peiran Dong and Jie ZHANG and Ziming Liu and Yue Yu and Xiao-Ming Wu},
  title = {{Easing Concept Bleeding in Diffusion via Entity Localization and Anchoring}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=MsnJl6JkZS},
}
Figure