Abstract
Diffusion Models (DM) have revolutionized the text-to-image visual generation process. However, the large computational cost and model footprint of DMs hinders practical deployment, especially on edge devices. Post-training quantization (PTQ) is a lightweight method to alleviate these burdens without the need for training or fine-tuning. While recent DM PTQ methods achieve W4A8 on integer-based PTQ, two key limitations remain: First, while most existing DM PTQ methods evaluate on classical DMs like Stable Diffusion XL, 1.5 or earlier, which use convolutional U-Nets, newer Diffusion Transformer (DiT) models like the PixArt series, Hunyuan and others adopt fundamentally different transformer backbones to achieve superior image synthesis. Second, integer (INT) quantization is prevailing in DM PTQ but does not align well with the network weight and activation distribution, while Floating-Point Quantization (FPQ) is still under-investigated, yet it holds the potential to better align the weight and activation distributions in low-bit settings for DiT. In this paper, we introduce FP4DiT, a PTQ method that leverages FPQ to achieve W4A6 quantization. Specifically, we extend and generalize the Adaptive Rounding PTQ technique to adequately calibrate weight quantization for FPQ and demonstrate that DiT activations depend on input patch data, necessitating robust online activation quantization techniques. Experimental results demonstrate that FP4DiT outperforms integer-based PTQ at W4A6 and W4A8 precision and generates convincing visual content on PixArt-alpha, PixArt-Sigma and Hunyuan in terms of several T2I metrics such as HPSv2 and CLIP.
1. Introduction
The emergence of Diffusion Transformers (DiTs) has set new benchmarks for high-fidelity image synthesis. However, their massive parameter counts and computational intensity make deployment on edge devices difficult. While Post-Training Quantization (PTQ) is a standard efficiency technique, existing research has largely focused on convolutional U-Net architectures and uniform Integer (INT) quantization. This paper identifies a critical distribution mismatch: INT quantization's uniform grid fails to capture the non-uniform distributions of DiT weights and activations. We propose FP4DiT, a framework that utilizes Floating-Point Quantization (FPQ) to achieve high-quality synthesis at ultra-low bitwidths (W4A6).
2. Methodology
FP4DiT optimizes the quantization process specifically for the transformer blocks found in modern DiT architectures.
2.1 Mixed-Format FPQ and GELU Sensitivity
Not all layers in a DiT block are equally sensitive to quantization. We discovered that layers preceding the GELU activation function are highly sensitive because the negative "dip" in the GELU function requires high precision near zero. FP4DiT employs a mixed-precision strategy, using specific FP formats like E3M0 for these sensitive layers to provide a denser distribution of values near zero, while using E2M1 or E1M2 elsewhere.
2.2 Scale-Aware Adaptive Rounding
To calibrate weights for FPQ, we introduce Scale-Aware AdaRound. Standard adaptive rounding assumes a single scale (as in INT), which is incompatible with the multiple exponential scales of floating-point formats. Our method normalizes the gradient descent slope across these scales, making optimization more stable and achieving optimal results with 8x fewer calibration steps than traditional methods.
2.3 Token-wise Online Quantization
Unlike U-Nets, where activation ranges typically shrink during the denoising process, DiT activations exhibit "shifting" behavior and vary significantly between different image patches (tokens). FP4DiT implements an online, token-wise min-max quantization scheme to ensure the quantization grid adapts to the specific data being processed at every denoising step.
3. Experimental Results
FP4DiT was evaluated on PixArt-alpha, PixArt-Sigma, and Hunyuan using benchmarks such as MS-COCO 2014, HPSv2, and ImageReward.
- Superior Performance at W4A6: FP4DiT achieved significantly higher CLIP and HPSv2 scores compared to integer-based baselines like Q-Diffusion and ViDiT-Q when pushed to 4-bit weights and 6-bit activations.
- Visual Fidelity: Qualitatively, FP4DiT avoids the noise and color-shifting artifacts common in other low-bit methods. For example, in the Hunyuan model, FP4DiT was the only method to correctly maintain a clean white background as requested by prompts at low bitwidths.
- Efficiency and Speed: The scale-aware mechanism reduces calibration time by 8x. On modern hardware like the NVIDIA RTX 5080, quantized layers showed an approximate 1.5x speedup compared to full-precision (W16A16) baselines.
4. Conclusion
FP4DiT demonstrates that Floating-Point Quantization is a more effective paradigm for compressing Diffusion Transformers than traditional integer methods. By addressing the unique activation dynamics and distribution requirements of DiTs, FP4DiT enables high-fidelity image generation at W4A6 precision. Future work will investigate even lower bitwidths and more granular mixed-precision strategies.
Summary updated