NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Fine-Grained Perturbation Guidance via Attention Head Selection

Donghoon Ahn, Jiwon Kang, Sanghyun Lee, Minjae Kim, Jaewon Min, Wooseok Jang, Saungwu Lee, Sayak Paul, Susung Hong, Seungryong Kim

Abstract

Recent guidance methods in diffusion models steer reverse sampling by perturbing the model to construct an implicit weak model and guide generation away from it. Among these approaches, attention perturbation has demonstrated strong empirical performance in unconditional scenarios where classifier-free guidance is not applicable. However, existing attention perturbation methods lack principled approaches for determining where perturbations should be applied, particularly in Diffusion Transformer (DiT) architectures where quality-relevant computations are distributed across layers. In this paper, we investigate the granularity of attention perturbations, ranging from the layer level down to individual attention heads, and discover that specific heads govern distinct visual concepts such as structure, style, and texture quality. Building on this insight, we propose "HeadHunter", a systematic framework for iteratively selecting attention heads that align with user-centric objectives, enabling fine-grained control over generation quality and visual attributes. In addition, we introduce SoftPAG, which linearly interpolates each selected head's attention map toward an identity matrix, providing a continuous knob to tune perturbation strength and suppress artifacts. Our approach not only mitigates the oversmoothing issues of existing layer-level perturbation but also enables targeted manipulation of specific visual styles through compositional head selection. We validate our method on modern large-scale DiT-based text-to-image models including Stable Diffusion 3 and FLUX.1, demonstrating superior performance in both general quality enhancement and style-specific guidance. Our work provides the first head-level analysis of attention perturbation in diffusion models, uncovering interpretable specialization within attention layers and enabling practical design of effective perturbation strategies.

Introduction

In the world of diffusion models, Classifier-Free Guidance (CFG) is the gold standard for boosting image quality. However, it faces two significant limitations: it requires conditional prompts to function and often results in "over-baked" or over-saturated images. Recent alternatives like Perturbed-Attention Guidance (PAG) attempt to address this by "weakening" the model during inference—specifically by replacing attention maps with identity matrices—and guiding the generation away from this weakened state.

Existing PAG methods are relatively blunt, typically perturbing entire layers at once. In modern Diffusion Transformer (DiT) architectures, semantic information is distributed across many layers and heads. Perturbing a whole layer is often inefficient, as it may destroy beneficial computations alongside the "bad" ones, leading to over-smoothing. This paper addresses the question: Where exactly should we perturb to achieve optimal results?

The HeadHunter Framework

We propose two primary innovations to provide surgical control over model guidance:

  1. HeadHunter: An iterative search framework designed to identify the most effective attention heads for specific goals (e.g., improving general quality or achieving a specific artistic style). Instead of a one-shot search, HeadHunter selects heads greedily over multiple rounds. This captures "compositional synergy," where certain heads perform better when combined with others than they do in isolation.
  2. SoftPAG: While standard PAG is binary (original map vs. identity matrix), SoftPAG introduces a continuous interpolation knob ($u$): $A_{soft} = (1-u)A + uI$. This allows users to fine-tune guidance intensity, effectively suppressing artifacts like over-saturation.

Analysis of Attention Head Specialization

A key discovery of this work is that individual attention heads act as "semantic substructures." One head might control object geometry, while another governs lighting, blue tones, or shadows.

Visualizing the specialization of individual attention heads and their compositional effects on image generation.

These visual concepts are additive. By perturbing multiple specific heads, users can combine their effects to achieve complex stylistic goals. Furthermore, perturbing a small, optimized subset of heads often yields better results than perturbing an entire layer, demonstrating the efficiency of sparsity in guidance.

Experimental Results

We validated HeadHunter on state-of-the-art models including Stable Diffusion 3 (SD3) and FLUX.1. The framework demonstrated significant improvements in both general quality and style-oriented alignment.

Comparison of generation quality and style alignment using targeted head selection.

Key Findings:

  • Quality Boost: HeadHunter outperforms standard layer-level PAG. In SD3, a compact set of top-ranked heads achieved better FID scores than full layer-level perturbation.
  • Style Control: The method excels at style-specific enhancement. As more heads are accumulated via HeadHunter, images align more strongly with target styles (e.g., "cinematic lighting" or "line art") while maintaining structural integrity.
  • Generalizability: Heads selected using a small set of 20 prompts generalize remarkably well to unseen content, proving they capture intrinsic visual properties rather than prompt-specific features.

Conclusion

HeadHunter provides the first head-level analysis of attention perturbation in diffusion models, uncovering interpretable specialization within DiT layers. By moving from coarse layer-level guidance to fine-grained head selection, we enable precise, training-free control over image generation quality and style. Future work will explore faster head-selection strategies and the developmental emergence of these specialized heads during training.

Summary updated

BibTeX
@inproceedings{ahn2025fine,
  author = {Donghoon Ahn and Jiwon Kang and Sanghyun Lee and Minjae Kim and Jaewon Min and Wooseok Jang and Saungwu Lee and Sayak Paul and Susung Hong and Seungryong Kim},
  title = {{Fine-Grained Perturbation Guidance via Attention Head Selection}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=m7zEbdAMsh},
}
Figure