Divide & Bind Your Attention for Improved Generative Semantic Nursing

Yumeng Li, Margret Keuper, Dan Zhang, Anna Khoreva

Abstract

Text-to-image (T2I) diffusion models often struggle with complex prompts involving multiple objects or specific attribute bindings. We present "Divide & Bind," an inference-time optimization technique that utilizes Generative Semantic Nursing (GSN) to improve semantic fidelity. By maximizing the Total Variation of attention maps to "divide" spatial territory among objects and employing Jensen-Shannon Divergence to "bind" attributes to their respective subjects, our method significantly reduces object omission and attribute leakage without requiring model retraining.

Introduction

While large-scale text-to-image models like Stable Diffusion have reached impressive levels of visual quality, they frequently exhibit failures in semantic alignment. These failures typically manifest in two ways: missing objects (e.g., failing to render a "train" in a complex scene) and incorrect attribute binding (e.g., swapping colors between a "pink chair" and a "green bench").

Existing approaches, such as Attend & Excite, attempt to mitigate these issues by "nursing" internal cross-attention maps during the sampling process. However, these methods often focus on single-point activations, which can lead to competition between tokens and the suppression of secondary objects. "Divide & Bind" addresses these limitations by managing the spatial distribution of attention across the entire latent canvas.

Methodology: Generative Semantic Nursing

Divide & Bind operates during the inference phase by updating latent codes on-the-fly through two specialized loss functions. This process, termed Generative Semantic Nursing (GSN), ensures that the model's internal attention aligns with the user's prompt before the final image is produced.

The Divide Mechanism (Attendance Loss)

To ensure that every requested object is represented in the final output, the framework introduces an Attendance Loss based on Total Variation (TV) maximization. While TV is traditionally minimized in image processing to promote smoothness, D&B maximizes it within the attention maps of object tokens. This encourages the model to resolve "token competition" by creating multiple, spatially distinct regions of high activation. By forcing the model to explore different regions of the canvas for different objects, the "Divide" mechanism ensures that each entity is granted its own territory.

The Bind Mechanism (Binding Loss)

To solve the problem of attribute leakage or "color bleeding," the framework utilizes a Binding Loss based on Jensen-Shannon Divergence (JSD). This loss treats attribute binding as a distribution matching problem. By forcing the spatial distribution of an attribute's attention map (e.g., "purple") to align closely with the corresponding object's attention map (e.g., "dog"), the model ensures that the concept of the attribute is localized specifically to the intended subject.

Experimental Setup

The researchers evaluated Divide & Bind across seven distinct prompt benchmarks designed to test various aspects of semantic fidelity:

  • Standard Benchmarks: Animal-Animal and Color-Object.
  • Complex Benchmarks: Animal-Scene and Color-Obj-Scene, which introduce background complexity.
  • Multi-Object Benchmarks: Specifically designed to test counting and instance separation (e.g., "three sheep").
  • Real-world Captions: COCO-Subject and COCO-Attribute, derived from MS-COCO and filtered via the TIFA benchmark to ensure clear subjects and attributes.

Results and Discussion

Quantitative Performance

Using the TIFA score—a metric employing Vision-Question Answering to verify prompt adherence—Divide & Bind consistently outperformed both standard Stable Diffusion and the Attend & Excite baseline. Notably, the method achieved a 5% improvement over Attend & Excite on the challenging Color-Obj-Scene benchmark, demonstrating its robustness in complex environments.

Qualitative Improvements

Visual analysis confirms that Divide & Bind significantly improves counting accuracy and attribute localization. In scenarios where baseline models might generate two objects instead of the requested three, D&B consistently produces the correct count. Furthermore, it successfully prevents color bleeding in multi-object scenes where previous methods often failed.

Computational Efficiency

The method is designed for "plug-and-play" use without retraining. While it introduces a small computational overhead, the impact is manageable: generating an image takes approximately 17 seconds on a V100 GPU, compared to 13 seconds for standard Stable Diffusion.

Limitations

Despite its improvements, Divide & Bind is still subject to the underlying priors of the pretrained model. It may struggle with "impossible" or extremely rare prompts (e.g., "a gray apple") where the model's training data strongly favors specific colors. Additionally, while counting is improved, errors still occur due to the inherent limitations of the CLIP text encoder's linguistic understanding. Finally, as an inference-time technique on frozen weights, it inherits the social and data biases present in the original model.

Conclusion

Divide & Bind provides a mathematically grounded and efficient way to improve the reliability of generative models. By treating attention as a resource to be divided and attributes as distributions to be bound, the framework offers a significant step forward in achieving precise semantic control in text-to-image synthesis.

Summary updated

Abstract

Abstract
BibTeX
@inproceedings{li2023divide,
  author = {Yumeng Li and Margret Keuper and Dan Zhang and Anna Khoreva},
  title = {{Divide \& Bind Your Attention for Improved Generative Semantic Nursing}},
  booktitle = {BMVC},
  year = {2023},
  url = {https://openreview.net/forum?id=AGh67p5eI7},
}
Figure