EMAG: Self-Rectifying Diffusion Sampling with Exponential Moving Average Guidance

Ankit Yadav, Ta Duc Huy, Lingqiao LiuarXiv 2025 · DOI

Introduction

Modern generative models, such as Stable Diffusion 3 (SD3), rely heavily on Classifier-Free Guidance (CFG) to align generated images with user prompts. While effective, CFG often introduces "over-saturation" and a loss of fine-grained detail. Recent attempts to mitigate this through "auto-guidance"—contrasting a model with a degraded version of itself—often rely on "easy negatives" (e.g., blurred inputs) that fail to challenge the model to refine subtle textures.

Exponential Moving Average Guidance (EMAG) addresses this by generating "hard negatives": subtle, semantically faithful degradations that force the model to self-rectify fine-grained artifacts during the sampling process. This training-free, inference-time technique significantly boosts visual quality and human preference in diffusion transformers.

Methodology: Creating Hard Negatives

EMAG introduces a novel self-rectification loop without requiring additional training. The process consists of three core components:

  1. Attention EMA: During denoising, the model maintains an Exponential Moving Average (EMA) of its self-attention maps. Since self-attention refines images from coarse to fine, the EMA serves as a "lagging" low-pass version of the current state.
  2. Adaptive Layer Selection: Rather than perturbing a fixed layer, EMAG dynamically identifies the layer most "active" in adding high-frequency details by calculating the Mean Absolute Error (MAE) between current attention maps and the EMA.
  3. Self-Rectification: A "weak" prediction is generated by replacing the selected layer's attention map with its EMA. The model then guides the final output away from this weak version, effectively correcting the subtle artifacts introduced by the EMA.
Visual comparison of EMAG's self-rectification process against other guidance methods. The top row for each subject shows the 'weak' prediction (hard negative), while the bottom row shows the final guided result.

Key Results and Insights

EMAG was evaluated using ImageNet-1K (class-conditional) and COCO-2014 (text-to-image) with DiT and SD3 backbones.

  • Human Preference: On SD3-Medium, EMAG improved the Human Preference Score (HPS v2) by +0.46 over the standard CFG baseline.
  • Image Quality: In unconditional generation on ImageNet-256, EMAG achieved an FID of 29.85, significantly outperforming the baseline (52.76) and other methods like Self-Attention Guidance (SAG, 40.87).
  • Visual Fidelity: Qualitative results demonstrate that EMAG-guided images possess sharper textures (e.g., animal fur, fabric) and fewer "muddy" artifacts compared to standard CFG.
Quantitative evaluation of EMAG performance. (a) FID scores across different guidance scales. (b) HPS Mean scores, showing peak preference at moderate guidance scales.

Conclusion

EMAG demonstrates that "hard negatives" are a powerful tool for sharpening diffusion models. By leveraging the internal dynamics of attention maps, it provides a training-free path to higher-fidelity image generation. While currently tailored for Transformer-based architectures, the principle of self-rectification via EMA guidance offers a promising direction for improving quality across various generative modalities, including video and 3D synthesis.

Summary updated

BibTeX
@misc{yadav2025emag,
  author = {Ankit Yadav and Ta Duc Huy and Lingqiao Liu},
  title = {{EMAG: Self-Rectifying Diffusion Sampling with Exponential Moving Average Guidance}},
  year = {2025},
  eprint = {2512.17303},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.17303},
}
Figure