TL;DR
DGQ (Distribution-aware Group Quantization) is a novel post-training quantization method that enables text-to-image diffusion models to run efficiently at low bit-widths (under 8-bit) without requiring any additional fine-tuning. By adaptively preserving activation outliers and using prompt-specific logarithmic scaling for cross-attention, DGQ maintains high image quality and strict text-image alignment while slashing computational costs by over 90%.
The Resource Bottleneck of Diffusion Models
Text-to-image diffusion models like Stable Diffusion are notoriously resource-hungry. As illustrated below, a single 50-step generation can require tens of thousands of Tera-Bit Operations (TBOPs) and gigabytes of memory.
To deploy these models on edge devices or enable real-time generation, researchers turn to quantization—converting high-precision floating-point numbers into low-bit integers (such as 8-bit or 6-bit). However, standard quantization often breaks diffusion models. At lower bit-widths, models typically produce degraded images or lose their ability to follow the text prompt (text-image misalignment). Existing solutions often rely on complex mixed-precision hardware or expensive fine-tuning, limiting their practical application.
Introducing Distribution-Aware Group Quantization (DGQ)
To overcome these limitations, the authors introduce DGQ, focusing on two primary strategies:
1. Outlier-Preserving Group Quantization
The researchers discovered that a tiny fraction of "outlier" activations are responsible for most of an image's structural integrity. Dropping these outliers causes the generated image to fall apart. DGQ identifies whether these outliers occur across specific channels or spatial pixels and groups them together. By assigning customized quantization scales to these specific groups, the method minimizes quantization error where it matters most, preserving the outliers without incurring high computational overhead.
2. Attention-Aware Quantization
Cross-attention layers act as the bridge between text prompts and image pixels. The authors found that the <start> token in the text prompt creates a massive peak in attention scores, which "drowns out" other tokens during standard uniform quantization. DGQ handles the <start> token separately in full precision and applies logarithmic quantization to the remaining tokens. Because attention scores naturally follow an exponential distribution, a logarithmic scale is much better suited to capture subtle details. Furthermore, DGQ uses dynamic scaling based on the specific input prompt to ensure text alignment remains sharp.
Key Insights
- Outliers are the "Soul" of the Image: Most activations can be quantized aggressively, but a few specific "heavy hitters" must be preserved. These outliers are not random; they cluster in specific channels or spatial locations.
- The
<start>Token Bias: In cross-attention, the<start>token often acts as a global anchor for background pixels. Standard uniform quantization treats all tokens equally, effectively erasing the subtle details provided by descriptive words in the prompt. - Logarithmic is Logical: For attention scores, logarithmic quantization is significantly more effective than linear quantization. It allows the model to accurately represent very small values, which is crucial for maintaining the fidelity of the text-to-image mapping.
State-of-the-Art Results
The authors evaluated DGQ on standard benchmarks like MS-COCO (for FID and CLIP scores) and PartiPrompts (for complex prompt generalization), calibrating the model using only 64 random captions. DGQ achieves state-of-the-art results for low-bit diffusion:
- Superior Quality: In the 8-bit setting (W8A8), DGQ achieved a better FID score (13.15) than the full-precision model (14.44) on MS-COCO, likely due to a slight regularizing effect from quantization.
- Breaking the 6-bit Barrier: While previous methods like TFMQ-DM fail to generate coherent images at 6-bit activations, DGQ produces high-quality, text-aligned images even at W4A6 (4-bit weights, 6-bit activations).
- Massive Efficiency Gains: The method reduces bit operations (BOPs) by 93.7% (from 694 TBOPs to 43.4 TBOPs for a single U-Net step).
Limitations and Future Work
While DGQ marks a significant step forward for activation quantization, the authors note that combining it with more advanced weight-only quantization methods (like AWQ or QuEST) could push efficiency even further. Additionally, while the current logarithmic approach is hardware-friendly, using lookup tables or reparameterization might yield even higher precision for the complex distributions found in cross-attention. Finally, deploying DGQ on specific NPU/GPU kernels remains an exciting step for future engineering work.
Summary updated