Linguistic Binding in Diffusion Models: Enhancing Attribute Correspondence through Attention Map Alignment

Royi Rassin, Eran Hirsch, Daniel Glickman, Shauli Ravfogel, Yoav Goldberg, Gal Chechik

Abstract

While diffusion models have achieved remarkable success in generating high-fidelity images, they frequently struggle with compositional linguistic structures, leading to a phenomenon known as improper binding. In these cases, attributes such as colors or textures are often mismatched with their intended subjects or ignored entirely. We present SynGen (Syntax-Guided Generation), an inference-time intervention that leverages syntactic parsing to align cross-attention maps with the grammatical structure of the input prompt. By enforcing spatial overlap between modifiers and their corresponding nouns while discouraging leakage to unrelated entities, SynGen significantly improves attribute binding without requiring model retraining. Our evaluations on standard benchmarks and a new, more challenging dataset (DVMP) demonstrate that SynGen outperforms existing state-of-the-art methods in both automated metrics and human preference.

Introduction

State-of-the-art text-to-image models, such as Stable Diffusion, often fail to accurately reflect the relational structure of complex prompts. This "linguistic blindness" typically manifests as improper binding, where the model treats a prompt as a "bag of words" rather than a structured sentence. For instance, a request for a "pink sunflower and a yellow flamingo" might result in a yellow sunflower and a pink flamingo.

This failure mode generally takes three forms:

  1. Semantic Leakage: Attributes from one object bleed into another.
  2. Attribute Neglect: A specified modifier is omitted from the final image.
  3. Entity Casting: A modifier is misinterpreted as a primary object (e.g., "baby lion" generating both a lion and a human infant).

These issues stem largely from the limitations of the underlying text encoders (typically CLIP), which do not perfectly capture the dependencies between modifiers and nouns. SynGen addresses this by intervening in the model's internal attention mechanisms during the generation process.

Methodology

SynGen is an inference-time optimization technique that requires no fine-tuning of the diffusion model's parameters. The approach consists of two primary stages: syntactic analysis and attention map alignment.

Syntactic Analysis

Before the denoising process begins, the input prompt is processed using a standard natural language processing tool (spaCy). The parser identifies specific noun-modifier pairs (e.g., "checkered" + "tablecloth"). This step allows the system to distinguish which adjectives should be bound to which entities, providing a structural blueprint for the image layout.

Attention Map Alignment

During the first 25 steps of the diffusion process, SynGen applies a specialized loss function to the model’s cross-attention maps. These maps represent the spatial regions the model associates with specific tokens in the prompt. The optimization utilizes two distinct components:

  • Positive Loss ($L_{pos}$): This term encourages the attention map of a modifier to overlap significantly with the attention map of its associated noun. This ensures that the visual representation of the attribute (e.g., the color "pink") is spatially grounded in the same region as the object (e.g., the "sunflower").
  • Negative Loss ($L_{neg}$): This term discourages the modifier’s attention map from overlapping with unrelated nouns or other modifiers. This "push" mechanism is critical for preventing semantic leakage across different objects in the scene.

By minimizing this combined loss at each denoising iteration, the model is steered toward a latent representation where the linguistic structure of the prompt is accurately reflected in the spatial distribution of the image features.

Experimental Evaluation

Datasets

The researchers evaluated SynGen across three distinct prompt sets:

  • ABC-6K: A benchmark consisting of 3,200 natural compositional prompts derived from MSCOCO.
  • Attend-and-Excite (A&E) Data: A dataset used to test basic attribute binding in previous state-of-the-art models.
  • DVMP (Diverse Visual Modifier Prompts): A new, more rigorous challenge set introduced by the authors. Unlike previous benchmarks that focus primarily on color, DVMP includes complex modifiers such as textures ("checkered"), materials ("wooden"), and states ("sleepy"), with some prompts containing up to six modifiers.

Results

SynGen demonstrated significant improvements over existing methods like Structured Diffusion and Attend-and-Excite. On the A&E dataset, SynGen achieved a "Proper Binding" score of 94.76%, a substantial increase over the 81.90% achieved by the next best method.

In human preference studies on the challenging DVMP set, raters chose SynGen’s outputs for "Concept Separation" nearly twice as often as the previous state-of-the-art. Qualitatively, SynGen proved particularly effective at resolving entity casting errors; for a prompt like "a furry baby rabbit," SynGen correctly bound "baby" as a modifier to the rabbit, whereas baseline models often generated a separate human baby.

Discussion and Limitations

While SynGen offers a powerful solution to the binding problem, it introduces certain trade-offs. The primary drawback is computational overhead; because the method performs optimization at every denoising step, it is approximately 144% slower than standard Stable Diffusion (roughly 9.7 seconds per image compared to 4 seconds).

Furthermore, the method's efficacy is dependent on the accuracy of the syntactic parser. If the NLP tool misidentifies a relationship in a highly complex or ambiguous sentence, the resulting optimization will enforce incorrect bindings. There is also a risk of image degradation; if the negative loss constraints are too aggressive, the latent representation may be pushed outside the model's learned distribution, leading to blurred or incoherent results. Future work will focus on hyper-parameter tuning and integrating more robust parsers to handle increasingly cluttered and complex scenes.

Summary updated

BibTeX
@inproceedings{rassin2023linguistic,
  author = {Royi Rassin and Eran Hirsch and Daniel Glickman and Shauli Ravfogel and Yoav Goldberg and Gal Chechik},
  title = {{Linguistic Binding in Diffusion Models: Enhancing Attribute Correspondence through Attention Map Alignment}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=AOKU4nRw1W},
}
Figure