Cross-Attention Head Position Patterns Can Align with Human Visual Concepts in Text-to-Image Generative Models

Jungwon Park, Jungmin Ko, Dongnam Byun, Jangwon Suh, Wonjong Rhee

TL;DR

Researchers have discovered that individual cross-attention heads in text-to-image (T2I) diffusion models specialize in specific human-visual concepts like "color," "material," or "animals." By mapping these specializations into Head Relevance Vectors (HRVs), we can precisely steer model behavior to fix common failures. This approach successfully addresses issues such as misinterpreting ambiguous words (e.g., "Apple" the fruit vs. "Apple" the tech brand) and prevents the model from "forgetting" objects in complex, multi-concept prompts.

The Challenge: Black Box Hurdles in T2I Models

While T2I models like Stable Diffusion produce stunning results, their internal mechanics remain largely opaque. This "black box" nature leads to models frequently stumbling over three specific hurdles:

  1. Polysemy: Models often pick the wrong meaning for ambiguous words. For instance, generating a lavender plant when the user explicitly wanted the color "lavender."
  2. Catastrophic Neglect: In complex prompts like "a deer and a horse," the model might focus heavily on one subject and completely fail to generate the other.
  3. Coarse Control in Editing: Existing editing methods often struggle to change specific attributes—like turning a glass teapot into a granite one—without destroying the overall composition of the original image.
Three applications of HRVs: correcting misinterpretation, improving image editing, and reducing neglect in multi-concept generation.

The authors tackle these issues through the lens of mechanistic interpretability, seeking to understand if specific parts of the model's architecture (specifically, the cross-attention heads) are responsible for distinct visual concepts.

Methodology: Unlocking the Cross-Attention Heads

The core innovation of this paper is the Head Relevance Vector (HRV). Here is how the researchers build and utilize them to gain fine-grained control over image generation:

1. Constructing HRVs

The authors used GPT-4o to define 34 visual concepts (e.g., "Texture," "Furniture," "Shape") and 10 associated words for each. They then generated 2,100 random images. For every cross-attention head, they measured which visual concept showed the strongest activation. By aggregating these results, they created a vector for each concept that ranks every head by its relevance to that specific concept.

2. Validation via Ordered Weakening

To prove these heads actually "mean" what the HRVs indicate, the authors performed a stress test called ordered weakening.

Ordered weakening analysis demonstrating the effect of suppressing heads relevant to 'Color' versus 'Furniture'.

As shown above, if you suppress the "most relevant" heads for a concept (like "Furniture"), the furniture properties in the image vanish almost instantly into noise. Conversely, suppressing the "least relevant" heads has almost no effect on the generated image, confirming the heads' specialized roles.

3. Steering (Strengthening & Adjusting)

Once the specialized roles of the heads were mapped, the authors developed two control methods:

  • Concept Strengthening: Boosting the activation of heads relevant to a desired concept to ensure it appears prominently.
  • Concept Adjusting: Boosting desired heads while simultaneously suppressing heads associated with an undesired "distractor" concept (e.g., boosting "Brand Logos" while suppressing "Fruits" for the ambiguous word "Apple").

Key Insights and Discoveries

  • Heads are Specialists: Cross-attention heads aren't just redundant workers; they are highly specialized. Some heads care deeply about "Geometric Patterns," while others are dedicated entirely to "Weather Conditions."
  • Timestep Invariance: Surprisingly, the relevance of a head to a concept remains remarkably consistent throughout the entire diffusion process (from pure noise to a finished image). A "color head" acts as a "color head" at step 1 and step 50.
  • Architecture Agnostic: These patterns hold true across different model scales. The authors successfully extended their findings from Stable Diffusion v1.4 (128 heads) to the much larger SDXL (1,300 heads).
  • Negative Steering is Powerful: To fix polysemy, it isn't enough to tell the model what you want; you often have to explicitly tell it what you don't want by suppressing the "wrong" heads.

Experimental Results

The application of HRVs yielded significant improvements across multiple generative tasks:

  • Polysemy Fix: In human evaluations, the misinterpretation rate for ambiguous words dropped dramatically from 63.0% to 15.9% using the Concept Adjusting method.
  • Superior Editing: The proposed method (P2P-HRV) outperformed state-of-the-art editing tools like Prompt-to-Prompt (P2P) and MasaCtrl. It achieved 2.32% to 11.79% higher image-text alignment scores and received more than double the preference votes in human studies across 500 edited images.
  • Solving Neglect: By integrating HRVs with the Attend-and-Excite algorithm, the researchers improved multi-concept generation performance by up to 6.3%, ensuring that all requested objects actually appear in the final render.

Limitations and Future Directions

While highly effective, the authors identify two main limitations to their approach:

  1. Base Model Limits: If the underlying model (like SDXL) fundamentally struggles with a concept—such as precise "Counting" (e.g., distinguishing three balls from four)—HRVs cannot magically fix it. The model must have some latent understanding of the concept first.
  2. Concept Granularity: Some concepts, like "Facial Expressions," are currently too broad. The HRVs can identify heads for "faces" generally, but struggle to distinguish between specific emotions like "happy" vs. "sad" at the head level.

Future work may involve creating more fine-grained HRVs and exploring automated pipelines to identify distractor concepts using LLMs, removing the need for manual setup and further streamlining the generation process.

Summary updated

BibTeX
@inproceedings{park2025cross,
  author = {Jungwon Park and Jungmin Ko and Dongnam Byun and Jangwon Suh and Wonjong Rhee},
  title = {{Cross-Attention Head Position Patterns Can Align with Human Visual Concepts in Text-to-Image Generative Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=1vggIT5vvj},
}
Figure