Timestep-Aware Correction for Quantized Diffusion Models

Yuzhe Yao, Feng Tian, Jun Chen, Haonan Lin, Guang Dai, Yong Liu, Jingdong Wang

Abstract

Diffusion models (DMs) are powerful generative tools but are computationally expensive, hindering their deployment on edge devices. Post-Training Quantization (PTQ) is a common compression technique, but ultra-low precision (2-bit or 3-bit) typically results in significant image quality degradation due to error propagation and exposure bias. We present TAC-Diffusion, a timestep-aware correction strategy that improves the fidelity of low-precision quantized DMs. By dynamically rectifying noise estimation and input bias at each generative step without retraining, TAC-Diffusion achieves state-of-the-art results, making high-quality synthesis viable at ultra-low bit-widths with negligible computational overhead.

Introduction: The Challenge of Low-Precision Diffusion

Diffusion models require hundreds of iterations through large neural networks, making them difficult to run on mobile or edge devices. While Post-Training Quantization (PTQ) can compress weights and activations to lower bit-widths, pushing DMs to 2-bit or 3-bit precision causes the generative process to fail. The authors identify two primary causes for this failure:

  1. Error Propagation: Small quantization errors at one step are amplified in subsequent steps.
  2. Exposure Bias: Models trained on clean data struggle with the "corrupted" quantized data encountered during inference, leading to increasingly inaccurate noise estimation.

Methods: TAC-Diffusion

TAC-Diffusion corrects these errors on the fly during the sampling process using two main components: Input Bias Correction (IBC) and Noise Estimation Reconstruction (NER).

Overview of the TAC-Diffusion framework illustrating the error propagation problem and the proposed correction modules.

Input Bias Correction (IBC)

Quantization often shifts the mean of the data distribution. IBC calculates the average element-level bias ($B_t$) using a small calibration batch and subtracts this bias from the input at each timestep. This helps keep the latent variables within the distribution the model expects, mitigating exposure bias.

Noise Estimation Reconstruction (NER)

Instead of modifying the quantized model, NER applies a channel-wise scaling factor ($K_t$) to the output of the noise estimation network. This factor is determined by minimizing a convex loss function that balances Mean Squared Error (MSE) and relative distortion (rQNSR). This "re-scaling" ensures the corrupted noise estimation more closely resembles the full-precision version.

Crucially, both IBC and NER are timestep-aware. Because error characteristics evolve as an image transitions from pure noise to a structured object, correction factors are calculated independently for every step in the denoising sequence.

Key Insights

  • Linearity is Sufficient: Significant image fidelity can be recovered using simple linear scaling factors and bias terms pre-calculated on a small calibration batch, rather than complex neural network corrections.
  • Decoupled Error Correction: Treating input discrepancy and noise estimation discrepancy as separate problems is more effective than addressing them as a single unified "quantization noise" issue.
  • The Impact of Exposure Bias: While full-precision models can tolerate slight drift during inference, quantized models drift significantly off-course, requiring active "steering" via IBC to remain on the data manifold.

Experimental Results

TAC-Diffusion sets new benchmarks for low-precision diffusion models across several datasets, including CIFAR-10, LSUN-Church, LSUN-Bedroom, and Stable Diffusion v1.4.

  • CIFAR-10: At 3-bit weight quantization (W3A8), TAC-Diffusion achieved an FID of 9.55, a substantial improvement over the previous state-of-the-art (Q-Diffusion) at 17.31.
  • 2-bit Precision: The method successfully pushed LDM-4 models to 2-bit weight precision (W2A8) while maintaining recognizable quality, achieving an FID of 7.79 on LSUN-Bedrooms.
  • Efficiency: The correction factors are pre-calculated during a one-time calibration phase, resulting in negligible computational overhead during inference.

Limitations and Future Work

Despite its success, TAC-Diffusion has some limitations:

  • Calibration Dependency: Performance depends on the calibration dataset; significant distribution shifts in inference data may degrade results.
  • Sampler Specificity: Correction factors are tied to specific sampling trajectories (e.g., number of steps, sampler type). Changes to these parameters require re-calculation.
  • Future Directions: Integrating timestep-aware corrections into Quantization-Aware Training (QAT) could potentially yield even more robust ultra-low-bit models.

Summary updated

BibTeX
@inproceedings{yao2024timestep,
  author = {Yuzhe Yao and Feng Tian and Jun Chen and Haonan Lin and Guang Dai and Yong Liu and Jingdong Wang},
  title = {{Timestep-Aware Correction for Quantized Diffusion Models}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72848-8\_13},
}
Figure