NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Gradient-Aligned Calibration for Post-Training Quantization of Diffusion Models

Dung Anh Hoang, Cuong Pham, Trung Le, Jianfei Cai, Thanh-Toan Do

TL;DR

This paper introduces a novel Post-Training Quantization (PTQ) method for diffusion models designed to solve the "gradient conflict" problem. By employing a meta-learning approach to assign specific importance weights to calibration samples, the authors successfully align gradients across different denoising timesteps. This significantly improves image synthesis quality in low-bit regimes (e.g., 4-bit weights) where previous methods struggle.

The Problem: Gradient Conflict in Diffusion Models

Diffusion models have become the gold standard for image generation, but their architecture is notoriously heavy. They require hundreds of iterative steps, each passing through a massive neural network, making them slow and memory-intensive for edge devices.

Post-Training Quantization (PTQ) is a popular optimization technique: it compresses the model by converting high-precision numbers (32-bit floats) into low-precision ones (like 4-bit or 8-bit integers) without needing to retrain the whole model from scratch. However, diffusion models present unique quantization challenges.

The authors identify a major gap in current approaches: existing PTQ methods treat all "calibration data" (the small set of images used to calibrate the quantization) as equally important. In reality, a diffusion model performs vastly different tasks at different timesteps. Early steps focus on high-level structure, while later steps focus on fine-grained denoising. Because the data distributions and gradients vary so much across these steps, a "one-size-fits-all" quantization approach leads to gradient conflict. Optimizing the quantized model for one timestep might actively degrade its performance at another, creating a representational tug-of-war that harms final image quality.

Proposed Method: Gradient-Aligned Calibration

To resolve this, the authors propose a Gradient-Aligned Calibration framework. Instead of treating every calibration sample equally, they frame the quantization process as a bi-level optimization problem:

  1. The Inner Loop: The model's quantized weights are calibrated using a weighted set of training samples.
  2. The Outer Loop (Meta-Learning): The system learns the optimal sample-wise weights.

The goal is to find weights that prioritize samples whose gradients "align" across different timesteps. If a sample produces a gradient that contradicts the needs of other timesteps, its importance weight is reduced.

To make this computationally feasible, the authors developed a proxy objective. Directly optimizing the bi-level problem would normally require calculating incredibly slow and memory-heavy third-order derivatives. Their algorithm uses a clever surrogate that achieves the same gradient alignment without the massive computational overhead.

Key Insights and Ideas

  • The Divergence of Timesteps: Through preliminary analysis, the authors proved that gradients from later denoising stages diverge significantly from earlier ones. This confirms that "gradient conflict" is a primary reason why standard PTQ fails at very low bit-widths.
Gradient dissimilarity and timestep-wise loss
  • Alignment as a Signal: The core insight is that sample importance shouldn't just be about "difficulty." Instead, a sample is "important" if it helps the model find a quantization state that works for all timesteps simultaneously.
  • Efficiency in Training: While their method adds a meta-learning step, it only increases the calibration time by about an hour (on LSUN-Bedrooms) compared to previous state-of-the-art methods, remaining vastly faster than full fine-tuning.

Key Results

The researchers evaluated their method on three standard benchmarks: CIFAR-10 (32x32), LSUN-Bedrooms (256x256), and ImageNet (256x256). The method consistently outperformed state-of-the-art PTQ techniques like Q-Diffusion and TFMQ-DM across all datasets, especially in aggressive quantization settings.

Quantitative results on LSUN-Bedrooms and ImageNet
  • ImageNet (W4/A32): The proposed method achieved an FID score of 10.17, significantly better than TFMQ-DM's 10.50 (lower FID indicates images closer to the real distribution).
  • Extreme Low-Bit Settings: In a very challenging 3-bit weight / 6-bit activation (W3/A6) setup on ImageNet, their method reached an FID of 10.65, crushing the previous best of 15.90.
  • Visual Fidelity: Qualitative results demonstrate that while other 4-bit methods often introduce graininess or color shifts, the gradient-aligned approach produces images nearly indistinguishable from the full-precision (32-bit) original.

Limitations and Future Work

  • Computational Overhead: Although more efficient than full retraining, the meta-learning phase still requires more GPU hours than the simplest, unweighted PTQ methods.
  • Timestep Grouping: For simplicity, the authors grouped timesteps into 5 blocks. While effective, there might be more sophisticated ways to dynamically group timesteps based on the model's architecture.
  • Scope: The paper focuses on uniform weight and activation quantization. It does not explore "mixed-precision" (assigning different bit-widths to different layers), which could be a promising future direction to combine with their weighting strategy.

Summary updated

BibTeX
@inproceedings{hoang2026gradient,
  author = {Dung Anh Hoang and Cuong Pham and Trung Le and Jianfei Cai and Thanh-Toan Do},
  title = {{Gradient-Aligned Calibration for Post-Training Quantization of Diffusion Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=CtFSOlrjth},
}
Figure