DeeDiff: Dynamic Uncertainty-Aware Early Exiting for Accelerating Diffusion Model Generation

Shengkun Tang, Yaqing Wang, Caiwen Ding, Yi Liang, Yao Li, Dongkuan Xu · Submission to ICLR 2024 · Rejected

TL;DR

DeeDiff introduces dynamic early exiting to diffusion models, allowing the network to stop computation at intermediate layers when full network depth is unnecessary. Guided by a timestep-aware uncertainty estimation module and a specialized layer-wise training loss, DeeDiff cuts layer computation by over 40% with minimal quality degradation—and even improves generation quality over full baselines when run without exiting.

What Problem Does This Paper Address?

Diffusion models generate photorealistic images by iteratively denoising an input over dozens or hundreds of timesteps. While highly effective, each denoising step evaluates the entire deep neural network, leading to high latency and compute costs.

Prior acceleration methods focus primarily on reducing the number of sampling steps (the "width" of the generation process). However, treating every sampling step equally wastes computation: coarse structural denoising in earlier steps does not demand the same representational capacity as fine-grained detail synthesis in later steps.

While early exiting—halting inference early at intermediate layers for "easy" inputs—is popular in classification and language models, applying it to diffusion poses two distinct challenges:

  1. Diffusion is a continuous regression task lacking natural classification confidence scores or token entropies.
  2. Denoising is a sequential process where errors from early exits accumulate across sampling steps, causing severe visual artifacts if not carefully managed.

Methods

DeeDiff addresses these challenges with three core components:

  • Timestep-Aware Uncertainty Estimation Module (UEM): A lightweight module attached after each intermediate layer. Conditioned on intermediate hidden representations and the current timestep embedding, UEM outputs an uncertainty score $u_{i,t} \in [0, 1]$. If uncertainty falls below a preset threshold during inference, execution halts and the intermediate prediction is used.
  • Supervision for Uncertainty: Because true regression uncertainty is unlabelled, the authors train the UEM against a pseudo-ground-truth target: $\hat{u}_{i,t} = \tanh(|g_i(L_{i,t}) - \epsilon_t|)$, which reflects the smoothed absolute error between intermediate layer predictions and the ground-truth noise $\epsilon_t$.
  • Uncertainty-Aware Layer-Wise Loss ($\mathcal{L}_{\text{UAL}}$): Standard uniform intermediate supervision fails to curb multi-step error accumulation. DeeDiff weights each layer's intermediate denoising loss by $(1 - u_{i,t})$. By heavily penalizing errors on confident layers and timesteps, the model aligns intermediate representations with the final output where it matters most.
  • Joint Training: The entire network, intermediate projection heads, and UEMs are trained end-to-end using a joint objective combining the standard denoising objective, UEM regression loss, and $\mathcal{L}_{\text{UAL}}$.
[Layer 1] ──> [UEM 1] ──> Uncertainty > θ? ──(Yes)──> Continue to Layer 2
[Layer 2] ──> [UEM 2] ──> Uncertainty < θ? ──(No)───> Exit & Predict Noise

Datasets

The authors evaluated DeeDiff across standard generative benchmarks (no new datasets were introduced):

  • CIFAR-10 ($32\times32$): Unconditional image synthesis.
  • CelebA ($64\times64$): Unconditional human face generation.
  • ImageNet ($256\times256$): Class-conditional image generation (1,000 classes).
  • MS-COCO ($256\times256$): Text-guided image synthesis evaluated with latent diffusion representations.

Key Insights and Ideas

  • Representation Stabilization: Analyzing intermediate outputs revealed that layer-to-layer mean squared error drops sharply in early layers and quickly plateaus, demonstrating that deep layers often refine features rather than overhaul them.
  • Timestep-Dependent Difficulty: Denoising difficulty is non-uniform. Early sampling steps have lower reconstruction loss and allow earlier exits, whereas late sampling steps require precise, high-frequency details and utilize deeper layers.
  • Uncertainty Weighting Mitigates Cascading Errors: Prior early-exit schemes (like BERTxiT or CALM) collapse when applied naively to diffusion, producing Frechet Inception Distance (FID) scores above 20. DeeDiff’s uncertainty-weighted loss directly dampens error compounding across steps.
  • Free Regularization: Training with the uncertainty-aware loss acts as a regularizer. When evaluated without early exiting, the model outperforms the original baseline architectures, suggesting it prevents overfitting to specific timesteps.

Key Results

Evaluated on U-ViT backbones (and verified on CNN-based DDIM):

  • CIFAR-10: Achieves 47.7% layer reduction with an FID of 3.7 (baseline U-ViT: 3.11). Without exiting, DeeDiff achieves an FID of 2.7, improving upon the baseline.
  • CelebA: Achieves 46.2% layer reduction with an FID of 3.9 (baseline: 2.87; without exiting: 2.63).
  • ImageNet ($256\times256$): Cuts computation by 45.2% GFLOPs while maintaining an FID of 4.5 (baseline: 3.4). In contrast, prior methods CALM and BERTxiT degraded heavily to FIDs of 21.4 and 23.5.
  • MS-COCO: Yields 43.6% layer reduction at 7.40 FID (baseline: 5.95).
  • Sampling Compatibility: DeeDiff successfully stacks with fast ODE solvers (e.g., DPM-Solver with 50 steps), achieving 1.8 FID on CelebA.

Limitations and Future Work

  • Efficiency Ceiling: While the quality-efficiency curve remains flat up to ~45–50% layer reduction, pushing computational reduction beyond 60% causes steep FID degradation.
  • Depth-Only Adaptation: DeeDiff adaptively scales model depth (layers per step), but keeps the sampling trajectory (number of steps) fixed. The authors identify combining dynamic depth with dynamic, adaptive step sizing as an open direction for future work.

Summary updated

BibTeX
@misc{tang2023deediff,
  author = {Shengkun Tang and Yaqing Wang and Caiwen Ding and Yi Liang and Yao Li and Dongkuan Xu},
  title = {{DeeDiff: Dynamic Uncertainty-Aware Early Exiting for Accelerating Diffusion Model Generation}},
  year = {2023},
  eprint = {2309.17074},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.17074},
}

Loading related content...

Figure