Introduction
Diffusion models have revolutionized image generation but remain computationally expensive. Post-training quantization (PTQ) offers a path to efficiency, yet standard techniques often fail to maintain quality in these iterative models. EDA-DM introduces a novel framework to address distribution mismatches, achieving significant speedup and compression with minimal fidelity loss.
The Challenge of Quantizing Diffusion Models
Standard PTQ struggles with diffusion models due to two primary mismatches:
- Calibration Mismatch: The internal activations of diffusion models shift significantly across time steps. As shown in the analysis of temporal activations, variations are most pronounced at the beginning and end of the process, meaning uniform sampling fails to capture the true distribution.
- Reconstruction Mismatch: The wide numerical range of activations leads to a paradox where block-level alignment causes internal layers to either overfit or underfit.
Methodology: EDA-DM
The proposed Enhanced Distribution Alignment for Diffusion Models (EDA-DM) framework consists of two core components designed to solve these alignment issues.
Temporal Distribution Alignment Calibration (TDAC)
TDAC moves beyond uniform sampling by selecting a "golden set" of calibration samples. It utilizes feature maps to calculate Density and Variety scores, ensuring selected time steps represent the overall distribution and maintain sample diversity across the denoising trajectory. This ensures the quantized model is calibrated on data that truly reflects its operational environment.
Fine-grained Block Reconstruction (FBR)
To solve the reconstruction mismatch, FBR optimizes a joint loss function. Unlike standard methods that only align block outputs, FBR incorporates a Layer-wise Hessian Loss to align individual layers within the block. This prevents the "overfitting trap" where the block output appears correct while internal layers are severely degraded.
Experimental Results
The framework was evaluated on benchmarks including CIFAR-10, LSUN, ImageNet, and MS-COCO (Stable Diffusion v1.4).
Performance and Efficiency
On an RTX 3090, EDA-DM achieved a 1.83× speedup and 4× compression for Stable Diffusion. At W4A8 precision (4-bit weights, 8-bit activations), it significantly outperformed existing state-of-the-art methods like Q-Diffusion. For instance, on CIFAR-10, it achieved an FID score of 4.03, rivaling full-precision baselines.
Visual Fidelity
Qualitative analysis confirms that EDA-DM maintains high visual fidelity even at 4-bit weight precision. While other 4-bit methods often produce grainy or distorted images, EDA-DM's outputs are virtually indistinguishable from the original 32-bit floating-point models.
Conclusion
EDA-DM effectively bridges the gap between efficiency and quality in diffusion model quantization. By addressing temporal and structural distribution mismatches through TDAC and FBR, it enables hardware-friendly deployment of high-performance generative models. Future work will explore extending these techniques to Transformer-based architectures and achieving stable 4-bit activation quantization.
Summary updated