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

Where and How to Perturb: On the Design of Perturbation Guidance in Diffusion and Flow Models

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

Classifier-Free Guidance (CFG) has long been the gold standard for improving image quality in diffusion models. However, it relies heavily on conditional generation (requiring a prompt) and often yields over-saturated, "over-baked" images. Recent alternatives like Perturbed-Attention Guidance (PAG) address this by "breaking" the model's attention mechanism during inference to create a weak implicit model, then guiding generation away from that weakness.

While PAG is effective, current methods are blunt instruments that perturb entire layers at once. In modern Diffusion Transformer (DiT) architectures—such as Stable Diffusion 3 (SD3) or FLUX.1—semantic information is distributed thinly across many layers. Applying perturbations at the layer level is inefficient, often leads to over-smoothing, and lacks the precision needed to target specific attributes like lighting or texture.

To solve this, researchers have introduced a more surgical approach to perturbation, moving beyond coarse layer-level guidance to target individual attention heads.

The Framework: HeadHunter and SoftPAG

The proposed solution relies on two key innovations that provide fine-grained control over image quality and style without requiring any additional model training:

  • HeadHunter: An iterative search framework that automatically retrieves a subset of individual attention heads aligning with a specific objective (e.g., maximizing a human preference score or targeting a specific style). Instead of guessing which layers to perturb, HeadHunter operates in three stages: Generation (testing candidate heads), Evaluation (scoring results using reward models like PickScore), and Expansion (greedily adding the best-performing heads to the guidance set).
  • SoftPAG: Standard PAG is binary—it either keeps the attention map or replaces it entirely with an identity matrix. SoftPAG introduces a continuous interpolation knob ($u$) that linearly blends the original attention map with the identity matrix. This allows users to tune the intensity of the guidance, mitigating the artifacts and over-simplification caused by aggressive, binary perturbations.

Key Insights: Attention Heads as Specialists

By investigating the granularity of attention perturbations down to the individual head, the researchers uncovered several fascinating properties of DiTs:

  • Heads are Specialists: Individual attention heads are highly specialized. One head might govern "cinematic lighting," while another controls "horizontal grain" or "geometric structure."
  • The Power of Composition: These functional roles are additive. By combining a "darkness" head with a "shearing" head, the model produces images that are both darker and geometrically distorted. This enables "compositional guidance," where users can mix and match heads to achieve complex visual effects.
  • Synergy of "Weak" Heads: Interestingly, some heads that produce poor results when perturbed in isolation become incredibly effective when combined with others. This justifies the iterative nature of the HeadHunter framework, which finds synergistic "team players" that a one-shot search would miss.
  • Efficiency: HeadHunter can outperform full layer-level perturbation using only about 25% of the available heads, proving that a principled, sparse selection is more effective than blanket layer perturbation.

Performance and Style Control

Evaluated on state-of-the-art DiT models (SD3 and FLUX.1-Dev) using datasets like MS-COCO and Pick-a-pic, the framework demonstrated significant improvements.

For general quality, HeadHunter achieved superior FID and PickScore results compared to standard layer-level guidance, yielding sharper details and better structural integrity. Furthermore, quantitative grid searches showed that the "sweet spot" for guidance often lies at a SoftPAG interpolation value of $u < 1.0$, proving that continuous control is essential for avoiding over-saturation.

Perhaps most impressively, the authors demonstrated style-oriented guidance. HeadHunter successfully steered models toward specific aesthetics—such as line art, neon glow, or distinct artistic mediums—without changing the prompt or retraining the model.

Style-oriented guidance allows HeadHunter to steer generation toward specific aesthetics without altering the prompt or retraining the model.

Limitations and Future Work

The primary limitation of this approach is the computational cost of the initial search. Running HeadHunter to find the optimal heads for a specific model or objective requires multiple inference passes. While this is a one-time "offline" cost (selected heads can be reused for any future prompt), it remains resource-intensive for very large models.

Future work may explore faster retrieval strategies for these heads or investigate how head specialization changes across different timesteps of the diffusion process. Additionally, there is an open question about how these interpretable heads relate to the underlying training data, potentially opening doors to "unlearning" specific styles or biases directly at the attention-head level.

Summary updated

BibTeX
@inproceedings{ahn2025where,
  author = {Donghoon Ahn and Jiwon Kang and Sanghyun Lee and Minjae Kim and Wooseok Jang and Jaewon Min and Sangwu Lee and Sayak Paul and Seungryong Kim},
  title = {{Where and How to Perturb: On the Design of Perturbation Guidance in Diffusion and Flow Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=m7zEbdAMsh},
}
Figure