TL;DR
OFA-Diffusion is a once-for-all compression framework that trains a single diffusion model from which dozens of smaller, high-performing subnetworks can be instantly extracted to fit different hardware constraints. By replacing massive random architecture searches with a targeted, importance-based channel allocation and a smart loss-reweighting strategy, it slashes training overhead while matching or beating models compressed individually.
What Problem Does This Paper Address?
Diffusion Probabilistic Models (DPMs) like Stable Diffusion deliver stunning image generation but are computationally heavy, making them difficult to deploy on edge devices. Existing compression methods (like pruning, quantization, or distillation) typically target a single, fixed model size.
However, real-world deployment spans a wide variety of devices—from high-end cloud servers to smartphones—each with unique memory, power, and latency constraints. Compressing and retraining a separate model for every single device configuration is computationally ruinous. While "Once-For-All" (OFA) training has successfully solved this for image classification by training a single "supernet" that contains many smaller "subnetworks," applying it naively to diffusion models fails. The massive architectural search space introduces too much optimization noise, severely destabilizing and slowing down the training of delicate generative models.
Methods
The authors introduce OFA-Diffusion, a framework designed to compress pre-trained DPMs into multiple sizes in a single training run (one-shot manner) by adjusting channel widths. Its core components include:
- Restricted Candidate Space: Instead of randomly sampling thousands of subnetwork architectures during training, the authors restrict the framework to a discrete set of target parameter sizes (dozens instead of thousands) that lie on the Pareto frontier of performance and efficiency.
- Greedy Channel Allocation: To determine which channels to keep, they compute a sensitivity-based importance score using a first-order Taylor expansion of the training loss. Channels are pruned in ascending order of importance, ensuring that the most critical channels are shared across all subnetworks. Crucially, instead of pruning uniformly, they dynamically allocate more channels to the most important layers of the network.
- Reweighting Training Strategy: Because larger subnetworks retain more parameters from the pre-trained initialization, they naturally converge faster than smaller subnetworks during joint training. To balance this, the authors introduce a loss-reweighting strategy that assigns higher training weights to smaller subnetworks, ensuring all sizes converge effectively.
Datasets
The framework was evaluated across multiple architectures (U-Net and Vision Transformers) using several standard generative benchmarks:
- CIFAR-10 (32×32) and ImageNet (64×64) for standard unconditional and class-conditional generation tasks.
- FFHQ (64×64) and AFHQv2 (64×64) for high-quality face and animal image synthesis.
- CelebA (64×64) for evaluating transformer-based (U-ViT) backbones.
- MS-COCO 2014 (512×512) for text-to-image generation using Stable Diffusion v1.5.
Key Insights and Ideas
- Uniform Pruning is Suboptimal: Different layers in a diffusion model play vastly different roles in image synthesis. A greedy strategy that preserves more channels in high-importance layers yields significantly better image quality than standard uniform pruning.
- Smaller Models Need More Attention: In a weight-sharing supernet initialized from a pre-trained model, smaller sub-models suffer from slower convergence. Giving smaller sub-models a higher loss weight prevents them from being underfitted.
- Pruning Beats Depth Reduction for Latency: While reducing model depth can drastically hurt generation performance, pruning channel widths allows parallel computation hardware to maintain high performance while significantly reducing memory footprint and accelerating inference.
Key Results
- Massive Training Savings: Instead of training $N$ separate compressed models (which scales training costs linearly as $N \times 200\text{K}$ iterations), OFA-Diffusion requires only a single training run ($200\text{K}$ iterations) to produce 28 unique subnetwork sizes.
- Superior Image Quality: On the AFHQv2 dataset, the proposed method achieved an average Frechet Inception Distance (FID) of 3.05, outperforming the separate compression baseline (3.32) across various parameter constraints.
- Drastic Storage Reduction: Because all subnetworks share weights within a single master file, the total disk space required for deployment drops dramatically (e.g., 213M vs 3578M total for separate models on CIFAR-10).
Limitations and Future Work
- Static Importance Scores: The authors noted that attempting to dynamically update channel importance scores during training, or calculating separate importance scores for different diffusion time steps ($t$), actually degraded performance by introducing optimization noise.
- Non-Linear Latency Speedups: Due to the parallel nature of modern GPU/CPU hardware, reducing channel width does not result in a perfectly linear reduction in latency (e.g., a 25% parameter retention rate yields roughly a 2.4× speedup rather than a strict 4× speedup). Incorporating direct hardware latency lookups into the greedy allocation strategy remains an open direction for future work.
Summary updated