Selective Aggregation of Attention Maps Improves Diffusion-Based Visual Interpretation

Jungwon Park, Jungmin Ko, Dongnam Byun, Wonjong RheearXiv 2026

TL;DR

Instead of averaging all cross-attention heads to interpret text-to-image (T2I) diffusion models, selectively aggregating only the most concept-relevant heads significantly improves visual interpretability and object segmentation accuracy. This targeted approach filters out background noise and provides a powerful tool for diagnosing how generative models misinterpret ambiguous prompts.

What Problem Does This Paper Address?

Text-to-image models like Stable Diffusion rely heavily on cross-attention layers to map input text tokens to specific spatial regions in an image during generation. To understand how a model interprets a word, popular interpretability tools like DAAM (Diffusion Attentive Attribution Maps) average cross-attention maps across all attention heads and timesteps.

However, this indiscriminate averaging assumes all attention heads are equally useful. In reality, different heads specialize in different features; some focus on specific visual concepts, while others track backgrounds or abstract structures. Averaging them all introduces significant noise, blurring the boundaries of the interpreted objects and limiting our ability to precisely diagnose model behavior or prompt misinterpretations.

Methods

The authors propose a method for Selective Attention Map Aggregation. The pipeline consists of two main steps:

  1. Head Scoring via HRV: They leverage the Head Relevance Vector (HRV) method to quantify how strongly each attention head responds to specific human-defined visual concepts (e.g., "Animals" or "Electronics").
  2. Selective Aggregation: Instead of averaging all $H$ heads (where $H=128$ in Stable Diffusion v1.4), they select only the top 20–25% most relevant heads (specifically, the top 30 heads) for a target concept. They then compute the aggregated attention map using only this optimized subset.
Qualitative comparison showing that selective aggregation (Ours) focuses more accurately on the target object compared to DAAM.

Datasets

To benchmark the approach, the authors focused on the Animals category:

  • Evaluation Dataset: 100 images generated using Stable Diffusion v1.4 based on the prompt template "photo of a {animal}", covering 10 distinct animals (bear, bird, cat, cow, dog, elephant, sheep, horse, monkey, zebra) across 10 random seeds.
  • Ground Truth: Ground-truth semantic segmentation masks were generated automatically using Grounded-SAM (Grounded Segment Anything Model) to evaluate the accuracy of the attention maps.

Key Insights and Ideas

  • Attention Heads are Highly Specialized: Comparing the top 30 most relevant heads against the 30 least relevant heads reveals a massive disparity. The least relevant heads completely miss the target object, focusing instead on background elements or unrelated textures.
Comparison of attention maps generated by the 30 most relevant vs. 30 least relevant attention heads for the concept 'Animals'.
  • Visual Diagnosis of Polysemy: When a model encounters an ambiguous word like "mouse," it can get confused. For the prompt "A mouse and other office objects are on the desk," Stable Diffusion mistakenly generated both a rodent and a computer mouse. By isolating concept-specific heads ("Animals" vs. "Electronics"), the authors could cleanly separate the attention maps for each distinct interpretation, providing a clear window into the model's internal confusion.
Isolating different meanings of the ambiguous word 'mouse' using concept-specific attention heads.

Key Results

  • Higher Segmentation Accuracy: The proposed selective aggregation method consistently outperformed DAAM across multiple binarization thresholds when measured against Grounded-SAM masks using mean Intersection over Union (mIoU). At a threshold of 0.4, the selective method achieved an mIoU of 0.7765 compared to DAAM's 0.7540.
  • The Cost of Irrelevance: Aggregating the 30 least relevant heads caused the mIoU to plummet to 0.6172 (at threshold 0.4), proving that indiscriminate head averaging actively harms interpretability.
  • Optimal Head Count: An ablation study revealed that selecting 30 heads yielded the best performance for Stable Diffusion v1.4; selecting too few (20) or too many (40) reduced the segmentation accuracy.

Limitations and Future Work

While promising, the authors note a few limitations:

  • Model Scope: The evaluation was strictly performed on Stable Diffusion v1.4. Testing on newer, larger architectures (like SDXL or flow-matching transformers) remains future work.
  • Concept Scope: Quantitative benchmarking was restricted to the "Animals" category. Expanding the evaluation framework to encompass a broader, more diverse dictionary of visual concepts is a critical next step to prove generalizability.

Summary updated

BibTeX
@misc{park2026selective,
  author = {Jungwon Park and Jungmin Ko and Dongnam Byun and Wonjong Rhee},
  title = {{Selective Aggregation of Attention Maps Improves Diffusion-Based Visual Interpretation}},
  year = {2026},
  eprint = {2604.05906},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.05906},
}
Figure