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:
- 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.
- 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.
- 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.
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.
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