Towards More Accurate Diffusion Model Acceleration with a Timestep Tuner

Mengfei Xia, Yujun Shen, Changsong Lei, Yu Zhou, Deli Zhao, Ran Yi, Wenping Wang, Yong-Jin Liu

Abstract

Accelerating diffusion models by skipping steps usually leads to a "truncation error" that degrades image quality. This paper introduces TimeTuner, a lightweight plug-in that recovers lost quality by optimizing the timestep values used to condition pre-trained models. By finding a more accurate "integral direction" for each step without altering model weights, TimeTuner significantly reduces accumulative truncation error and improves generation performance across various samplers and benchmarks.

Introduction: The Challenge of Fast Diffusion

Diffusion models have become the gold standard for high-quality image generation. However, their iterative nature makes them computationally expensive, often requiring over 1,000 denoising steps. To address this, acceleration algorithms like DDIM or DPM-Solver are employed to skip steps, taking larger leaps through the denoising process.

These leaps introduce truncation error. Mathematically, the generation process is equivalent to solving a complex integral. When taking large steps, the "direction" calculated at the start of an interval becomes increasingly inaccurate as the process moves through it. This error accumulates, leading to blurry images or artifacts. The gap between the sampling distribution and the real data distribution widens as more steps are skipped.

TimeTuner: Optimizing the Integral Direction

The authors propose TimeTuner, a method to identify a "better" timestep condition for the noise prediction network to mitigate truncation errors.

Figure 1: Visualization of one-step and accumulative truncation errors, and how TimeTuner (green) aligns closer to the ground truth trajectory compared to baseline solvers (red).

Core Methodology

Normally, at timestep $t$, the network is conditioned on $t$. TimeTuner suggests that for a large interval, conditioning the network on an optimized timestep $\tau$ (near $t$) provides a more accurate gradient for the entire leap. This is inspired by the Mean Value Theorem, which implies an intermediate state exists that better represents the average direction of the interval.

Training Strategies

  1. Sequential Training: Timesteps ($\tau_1, \tau_2, ... \tau_K$) are optimized one by one, starting from noise ($T$) down to the final image ($0$). Each step minimizes a loss function aligning predicted noise with the "ground truth" direction.
  2. Parallel Training: For faster tuning, all $\tau$ values can be trained simultaneously across multiple GPUs, though this is slightly less accurate than the sequential approach.

TimeTuner is designed as a plug-in. It does not require retraining the massive diffusion model; it only optimizes a few scalar values, making it extremely lightweight and compatible with existing pre-trained models.

Key Insights and Results

TimeTuner addresses the "Conditioning Gap"—the quality drop in fast sampling caused by conditioning the network on a timestep that doesn't represent the average noise level of the interval.

Figure 2: Accumulative truncation error across different samplers (DDIM, DPM-Solver-2) and trajectories. TimeTuner (blue) consistently achieves lower error than the baseline (red).

Quantitative Performance

The improvements are most notable at low Number of Function Evaluations (NFE = 10):

  • LSUN Bedroom (DDIM, 10 steps): FID improved from 9.46 to 5.85.
  • FFHQ: FID improved from 23.58 to 14.80.
  • ImageNet: FID dropped from 10.13 to 9.63.
  • Consistency Models: Even for models optimized for few-step sampling, TimeTuner reduced FID from 8.14 to 7.14 at 1 step.

Universality and Efficiency

TimeTuner is universal, boosting performance for DDIM, DPM-Solver, and high-order solvers like EDM. It is also compatible with Classifier-Free Guidance (CFG). Optimization is efficient; tuning a 10-step schedule takes approximately one hour on a single NVIDIA A100 GPU.

Limitations and Future Work

While effective, TimeTuner has trade-offs. The sequential strategy is more accurate but slower than the parallel one. Furthermore, optimized timesteps are specific to the NFE and the pre-trained model; changing the step count requires re-tuning. Future research may focus on making parallel training as accurate as sequential training to further streamline the process.

Summary updated

BibTeX
@inproceedings{xia2024towards,
  author = {Mengfei Xia and Yujun Shen and Changsong Lei and Yu Zhou and Deli Zhao and Ran Yi and Wenping Wang and Yong-Jin Liu},
  title = {{Towards More Accurate Diffusion Model Acceleration with a Timestep Tuner}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2024},
  doi = {10.1109/cvpr52733.2024.00548},
}
Figure