TL;DR
This paper introduces a lightweight, architecture-agnostic framework that accelerates diffusion model inference by learning optimal, per-timestep masks to skip redundant block computations. By reusing cached features from adjacent timesteps and optimizing each step independently, the method achieves up to a 2.75× speedup with virtually no loss in image quality, all while training in just a few hours on a single consumer GPU.
What Problem Does This Paper Address?
Diffusion Probabilistic Models (DPMs) excel at generating high-fidelity images, but their iterative denoising process makes them notoriously slow for real-time applications. Generating a single image requires running a deep neural network sequentially dozens or hundreds of times.
Recent studies have shown that the internal features of these networks change very little between consecutive timesteps, meaning a lot of computation is redundant. While existing "block caching" methods attempt to exploit this by skipping certain layers, they are either rigid, rule-based heuristics or require massive amounts of GPU memory to train globally across the entire generation chain. The authors address this gap by proposing a flexible, learned block-skipping schedule that can be applied to any pre-trained diffusion model without incurring prohibitive training costs.
Methods
The core innovation is Timestep-Aware Block Masking. The authors define a 2D binary mask matrix ($m_{t,b}$), where $t$ represents the inference timestep and $b$ represents a specific network block (such as an Attention block in a Transformer or a ResBlock in a CNN). If the mask value is 0, the block's computation is skipped, and the feature cache from the previous step is reused; if it is 1, the block executes normally and updates the cache.
To make this approach practical, the authors introduce three key techniques:
- Per-Timestep Optimization: Instead of backpropagating through the entire multi-step denoising chain, they freeze the base model and optimize the masks for each timestep independently. This isolates gradients to the current step, making training highly memory-efficient.
- Timestep-Aware Loss Scaling: Feature dynamics shift across the denoising trajectory. The authors use a piecewise loss weight function based on feature variation: critical timesteps with rapid feature changes prioritize generation quality, while stable timesteps allow for more aggressive block skipping.
- Knowledge-Guided Mask Rectification: A post-processing step that prunes extra dependencies. If a block's output isn't needed by the subsequent block in the same timestep, and won't be reused as a cache in the next timestep, it is safely turned off without requiring additional training.
Datasets
The method was evaluated across several standard image generation benchmarks spanning different resolutions and architectures:
- CIFAR-10 ($32 \times 32$) and LSUN-Bedroom / LSUN-Churches ($256 \times 256$) for CNN-based DDPMs.
- ImageNet ($256 \times 256$ and $512 \times 512$) for Latent Diffusion Models (LDM) and Diffusion Transformers (DiT-XL/2).
- MS-COCO ($1024 \times 1024$) for the advanced PixArt-Sigma-XL model.
Notably, the mask training process only requires random Gaussian noise as input, meaning no actual dataset images are needed during the optimization phase.
Key Insights and Ideas
- Decoupled Optimization: Breaking down a global sequence optimization problem into independent, per-step tasks drastically lowers the barrier to entry for model compression. Mask training takes less than 3 hours on a single NVIDIA RTX 4090.
- Granular Flexibility: Unlike macro-level caching methods that skip entire chunks of a network, this fine-grained block masking adapts dynamically to the unique sensitivity of each layer at different stages of the generation process.
- Quality Preservation via Adaptive Loss: By loosening constraints when the model is merely refining details and tightening them when the structural layout of the image is being formed, the framework maintains high visual fidelity.
Key Results
The proposed method consistently outperforms training-free and rule-based baselines across multiple architectures:
- LDM-4-G (ImageNet 256×256): Achieved a 2.75× speedup, slashing total Multiply-Accumulate operations (MACs) from 25.0T to 8.3T while maintaining an excellent Frechet Inception Distance (FID) of 3.51 (compared to the original 3.42).
- DDPM (LSUN-Churches): Delivered a 1.31× speedup and actually improved the generation quality metric, lowering the FID from 10.58 to 10.39.
- DiT-XL/2 (ImageNet 512×512): Reached a 1.48× speedup with minimal quality degradation, outperforming competitive baselines like L2C and FORA.
Limitations and Future Work
Although mask training is lightweight, it is tied to a specific sampling configuration (e.g., a fixed number of DDIM steps). If a user decides to change the number of inference steps, the masks must be re-optimized for that new schedule. Additionally, while the authors proved the framework's efficacy on image generation, extending this per-timestep masking strategy to more computationally demanding modalities like video or 3D synthesis remains an open avenue for future research.
Summary updated