Entropy Rectifying Guidance for Diffusion and Flow Models

Tariq Berrada, Adriana Romero-Soriano, Michal Drozdzal, Jakob Verbeek, Karteek Alahari

TL;DR

Entropy Rectifying Guidance (ERG) is a novel inference-time technique that simultaneously improves image quality, diversity, and prompt consistency in diffusion and flow models. By manipulating the "energy landscape" of attention layers, ERG provides a more powerful and flexible alternative to standard Classifier-Free Guidance (CFG) without requiring additional models or extra computational overhead.

Visual comparison of CFG vs ERG

What Problem Does This Paper Address?

In the world of generative AI, Classifier-Free Guidance (CFG) is the industry standard for ensuring a model accurately follows a given prompt. However, CFG is a bit of a blunt instrument. While it improves "prompt alignment" (consistency) and visual "pop" (quality), it often does so at the severe expense of diversity. High CFG scales tend to cause "mode collapse," where the model generates very similar-looking images, and can lead to over-saturated, "fried" pixels.

Existing fixes for these trade-offs usually come with a catch: they either require training a second, weaker "proxy" model, or they require more "forward passes" (Number of Function Evaluations, or NFE) per step, making image generation significantly slower. The authors of this paper sought a "free lunch"—a way to get better quality and diversity without the extra compute or memory cost.

Methods: Manipulating the Energy Landscape

The core innovation of ERG lies in how it treats the attention mechanism. The authors build on the mathematical framework that views attention as a gradient descent step on a Hopfield energy landscape.

Instead of just contrasting a "conditional" prediction with an "unconditional" one (as CFG does), ERG creates a "weak" version of the model by "rectifying" the entropy of its internal associations. They achieve this through two main components:

  1. C-ERG (Conditioning ERG): They modify the text encoder's self-attention by adjusting the softmax temperature ($\tau$). This creates a slightly "blurred" or weaker version of the prompt embedding.
  2. I-ERG (Image ERG): They modify the denoiser's internal attention layers. By introducing a few new hyperparameters ($\alpha$ for pattern matching weight and $\gamma$ for step size), they can essentially "warp" the energy landscape the model uses to retrieve information during the denoising process.

By contrasting the "strong" original signal with this "rectified/weak" signal, the model can guide itself toward higher-quality features without losing the inherent diversity of the data distribution. Crucially, this happens entirely at inference time and requires only two function evaluations (NFE) per step—the exact same computational cost as standard CFG.

Datasets and Experimental Setup

The researchers evaluated ERG across several scales and tasks:

  • Class-Conditional Generation: Tested on ImageNet at both $256 \times 256$ and $512 \times 512$ resolutions using the DiT-XL/2 architecture.
  • Text-to-Image Generation: Evaluated on the COCO '14 validation set (40k image-caption pairs).
  • Training Data: The 1.9B parameter model used for text-to-image was trained on a mix of a proprietary 320M text-image pair dataset and YFCC100M.

Key Insights

  • The "Aha!" Moment: The researchers realized that you don't need a separate "bad" model to perform guidance. You can mathematically derive a "weaker" version of the same model by simply tweaking the entropy of its attention layers.
  • Unconditional Guidance: One of the most surprising findings is that ERG works for unconditional sampling. Standard CFG is impossible without a prompt (or a class label) to contrast against. Because ERG modifies the internal attention logic, it can improve the structure and detail of images even when the model is just "dreaming" without a prompt.
  • Synergy with Other Methods: ERG isn't a "winner-take-all" solution. The paper shows it can be combined with other recent techniques like APG (Adaptive Projected Guidance) and CADS, pushing the Pareto front of quality and diversity even further than any single method could alone.

Key Results

Quantitative comparison of guidance methods

ERG consistently outperformed standard CFG and other advanced guidance techniques (like SAG and PAG) across multiple metrics:

  • Text-to-Image: On COCO at 512 resolution, ERG achieved a +30 point boost in Density (a measure of quality/realism) and a +4 point boost in VQAScore (consistency) compared to CFG.
  • Unconditional Generation: ERG dramatically improved results where CFG cannot be used, dropping the FID score from 101.50 (no guidance) to 36.25.
  • Efficiency: Unlike "Smoothed Energy Guidance" (SEG), which requires 3 forward passes, ERG maintains the standard 2 NFE, making it a highly efficient, drop-in replacement for CFG in production pipelines.

Limitations and Future Work

  • Hyperparameter Tuning: ERG introduces several new "knobs" to turn ($\alpha, \gamma, \tau, K$). While the authors provide recommended defaults, finding the absolute "sweet spot" for a specific model might require more manual tuning than the single "scale" parameter used in CFG.
  • Architecture Specificity: The current implementation is designed for Transformer-based diffusion models (like DiT or Stable Diffusion 3). While the underlying math should translate to U-Nets, the paper focuses on modern Transformer-heavy architectures.
  • Kickoff Threshold: The authors found that ERG works best when it's only applied after a certain "kickoff" point in the denoising process. Determining the optimal time to start guidance automatically is an area for further research.

Summary updated

BibTeX
@inproceedings{berrada2025entropy,
  author = {Tariq Berrada and Adriana Romero-Soriano and Michal Drozdzal and Jakob Verbeek and Karteek Alahari},
  title = {{Entropy Rectifying Guidance for Diffusion and Flow Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=RjN1LYymST},
}
Figure