TL;DR
DiRotQ is a novel post-training quantization (PTQ) framework designed to enable highly accurate 4-bit weight and 4-bit activation (W4A4) execution for Diffusion Transformers (DiTs). By using PCA-guided rotation to isolate extreme activation outliers into a small high-precision subspace and smoothing the remaining components, it bridges the performance gap to full-precision baselines while delivering up to 9.2× speedups on consumer hardware.
What Problem Does This Paper Address?
Diffusion Transformers (DiTs) like FLUX.1 and PixArt-$\Sigma$ achieve state-of-the-art image generation quality but are exceptionally compute- and memory-intensive. Quantizing both weights and activations to 4-bit (W4A4) would drastically reduce hardware requirements, but aggressive quantization typically ruins image quality.
The primary culprit is the presence of massive, unpredictable activation outliers that vary across both channels and denoising timesteps. While rotation techniques (like Hadamard transforms) successfully smooth out outliers in Large Language Models (LLMs), they fail in diffusion models. This is because DiTs utilize adaptive normalization layers (such as AdaLN) that prevent fusing these rotations into preceding weights, and their activation distributions shift drastically at each denoising step.
Methods
The authors introduce DiRotQ, a PCA-based rotation-aware quantization framework that operates directly in the activation space:
- PCA-Guided Subspace Splitting: Using a small calibration dataset, DiRotQ estimates a time-averaged second-moment matrix for each linear layer. It rotates activations into this PCA basis, effectively concentrating the outlier energy into a small, high-variance subspace (the top ~10% of principal components), which is retained in high precision (16-bit).
- Residual Rotation: The remaining low-variance components are rotated using a random orthogonal matrix to equalize variance across channels, making them highly uniform and easy to quantize to 4-bit.
- Offline Weight Fusion: To eliminate runtime overhead, the inverse of the orthogonal transformation is fused directly into the static weights offline. The forward rotation remains online but is executed efficiently via a custom, highly optimized Triton kernel.
- VLM-as-a-Judge: To better evaluate quantization artifacts, the authors introduce a evaluation protocol using open-source Multimodal Large Language Models (MLLMs like Qwen2-VL and InternVL2) to score semantic consistency and perceptual quality.
Datasets
- Calibration: 128 randomly selected samples from the COCO Captions dataset.
- Evaluation:
- MJHQ-30K: A high-quality dataset sourced from Midjourney spanning 10 diverse artistic categories.
- sDCI (Summarized Dense Captions Interface): A dataset focused on realistic images with detailed prompts, compressed to 77 tokens to fit model constraints. The authors randomly sampled 5K prompts from each dataset for evaluation.
Key Insights and Ideas
- Activation-Space vs. Weight-Space: Prior state-of-the-art methods like SVDQuant perform low-rank decomposition in the weight space. DiRotQ shows that operating directly in the activation space via PCA is far more effective at capturing and isolating the true distribution of activation outliers.
- Time-Averaged Sharing: Even though diffusion activations change at every timestep, a single time-averaged PCA basis per layer is sufficient. Timestep-dependent magnitude shifts can be cleanly absorbed by per-token activation scales, allowing the rotation matrices to remain static and enabling offline weight fusion.
- VLMs as Better Evaluators: Traditional metrics like FID or LPIPS often fail to capture subtle structural or prompt-alignment degradations caused by low-bit quantization. Utilizing a VLM as a judge provides a much closer proxy to human preference.
Key Results
- Generative Quality: On PixArt-$\Sigma$ (MJHQ-30K), DiRotQ INT W4A4 achieved an FID of 15.9 and a PSNR of 19.1 dB, significantly outperforming the prior state-of-the-art, SVDQuant (FID 18.9, PSNR 17.6 dB).
- Hardware Acceleration: When deploying the 12B parameter FLUX.1-dev model on a consumer-grade 24 GB RTX 4090 GPU, DiRotQ reduced memory usage by 2.1×.
- Latency Speedups: For a batch size of 1, DiRotQ delivered a 2.3× end-to-end speedup per denoising step. For a batch size of 2, where the unquantized BF16 baseline forces slow CPU offloading, DiRotQ achieved a massive 9.2× speedup by keeping the entire model in GPU memory.
Limitations and Future Work
- Scope: The current framework is strictly evaluated on text-to-image generation. Extending DiRotQ to video generation models remains an open challenge due to complex temporal dependencies across frames.
- Static Rotations: The PCA basis is shared across all timesteps to save memory. The authors note that exploring per-timestep-group rotations under tighter memory budgets could be a promising future direction.
- Safety: While the method compresses models for efficiency, it does not inherently mitigate the risks of generating harmful or misleading content, which still requires complementary safeguards.
Summary updated