CoDM: A Co-design Framework for Efficient Sparse Diffusion Models

Xiaolong Wu, Xiang Gao, Xiyun Song, Zongfang Lin, Heather Yu, David GuES-FoMo-III @ ICML 2025

TL;DR

Diffusion models are powerful but computationally expensive. This paper introduces CoDM, a co-design framework that combines hierarchical pruning with NVIDIA's Hopper GPU sparse tensor cores to significantly speed up diffusion model inference without sacrificing image quality. This approach makes high-fidelity generative models more accessible for real-world applications.

What Problem Does This Paper Address?

Diffusion models (DMs) are state-of-the-art for generating realistic, high-fidelity data like images and videos. However, their iterative denoising process requires immense computational power and memory, making them impractical for many real-world applications, especially with high-resolution data or long sequences. Existing methods for accelerating DMs often focus on either algorithmic compression (like reducing inference steps or pruning) or hardware acceleration (like specialized GPU cores) in isolation. This separation leads to suboptimal performance, as these approaches don't fully leverage the interplay between model structure and hardware capabilities. Specifically, previous attempts to use sparse hardware features in DMs have overlooked the unique structural properties of diffusion models, resulting in reduced sample quality and limited speedups.

Methods

CoDM tackles this challenge through a co-design approach, integrating model compression with specialized hardware features. Its key components are:

  • Hierarchical Pruning: A novel three-layer pruning strategy is introduced to reduce model weights. This includes:
  • Step Pruning: Exploiting the observation that early denoising steps focus on local details and later steps on global structure, and that adjacent steps are temporally correlated.
  • Taylor Expansion Pruning: Using Taylor expansion to assess the impact of pruning on the loss function for each step, allowing for more informed weight removal.
  • 2:4 Pruning: Specifically targeting the 2:4 sparsity pattern supported by NVIDIA's Hopper architecture, where two out of every four weights are retained. This is applied to maximize magnitude within the 2:4 constraint.
  • Sparse Tensor Core Integration: The framework is designed to leverage NVIDIA Hopper GPUs' Sparse Tensor Cores (SPTCs). These cores accelerate computations on sparse matrices by utilizing a specific N:M sparsity format.
  • Sparse Storage Format (HB-ELL): A new "all-in-one" sparse storage format called Hierarchical Blocked ELLPACK (HB-ELL) is proposed. This format supports the hierarchical sparsity introduced by the pruning algorithm and efficiently maps to the GPU's sparse tensor core capabilities, improving memory efficiency.
  • TensorRT Optimization and FP8 Calibration: The pruned models are further optimized using TensorRT for tensor fusion and FP8 precision calibration, which allows for lower precision computations with minimal accuracy loss.

Datasets

The paper evaluates CoDM on two standard image generation datasets:

  • ImageNet (256x256 resolution): Used for text-to-image generation.
  • CIFAR-10 (32x32 resolution): Also used for text-to-image generation.

Key Insights and Ideas

  • Co-design is Crucial: The most significant insight is that simply applying pruning techniques or hardware features in isolation is insufficient. A co-design approach that jointly optimizes model structure (pruning) and hardware utilization (sparse tensor cores, storage formats) is essential for achieving maximum efficiency gains in diffusion models.
  • Diffusion Model Structure Matters for Pruning: The hierarchical pruning strategy, which considers the specific temporal and structural properties of diffusion models (e.g., step-wise importance, temporal locality), is more effective than generic pruning methods.
  • Hardware-Aware Storage is Key: The novel HB-ELL sparse storage format is critical for efficiently mapping the hierarchically pruned model onto the GPU's sparse tensor cores, bridging the gap between algorithmic sparsity and hardware acceleration.
  • Significant Speedups are Achievable: The combination of these techniques can lead to dramatic speedups without compromising the quality of generated images, making diffusion models more practical.

Key Results

CoDM demonstrates substantial improvements in computational efficiency and image generation quality:

  • Speedup:
    • 7.4x speedup on the ImageNet (256x256) dataset.
  • 11.5x speedup on the CIFAR-10 (32x32) dataset.
  • Image Quality: The generated images maintain similar or better quality compared to state-of-the-art methods, as indicated by comparable or lower Fréchet Inception Distance (FID) scores.
  • Component Contributions: An ablation study shows that TensorRT optimization, hierarchical pruning, and the sparse storage format each contribute significantly to the overall performance gain (around 32-34% speedup each).

Limitations and Future Work

  • Limitations:
    • The paper focuses on a UNet-based diffusion model (LDM) and its application to text-to-image generation. The generalizability to other diffusion model architectures or tasks (e.g., video, 3D) is not extensively explored.
  • While the paper mentions FP8 calibration, the full impact and potential limitations of using FP8 precision on model quality are not deeply analyzed.
  • Future Work: The authors suggest exploring further optimizations and extensions of CoDM to support distributed and heterogeneous platforms (e.g., ASICs) and multi-GPU architectures. This indicates a path towards scaling these efficiency gains to even larger and more complex diffusion model applications.

Summary updated

BibTeX
@inproceedings{wu2025codm,
  author = {Xiaolong Wu and Xiang Gao and Xiyun Song and Zongfang Lin and Heather Yu and David Gu},
  title = {{CoDM: A Co-design Framework for Efficient Sparse Diffusion Models}},
  booktitle = {ES-FoMo-III @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=P0dPZZJ0FP},
}
Figure