Jing Liu, Bohan Zhuang, Luping Liu, Yefei He, Weijia Wu, Hong Zhou
We lifted 3 functions out of this paper's own repositories and ran 2 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.
| Repository | Role | Ran |
|---|---|---|
| ziplab/PTQD | canonical | 1 of 1 |
| ziplab/ptqd | — | 1 of 2 |
| Function | Status | Where it lives |
|---|---|---|
| UniformAffineQuantizer | Ran | ziplab/ptqd/quant_scripts/brecq_adaptive_rounding.py pointer only (licence: NONE) · get_code("05184feec76de7f5") |
| get_train_samples | Ran | ziplab/PTQD/quant_scripts/quantize_ldm_brecq.py pointer only (licence: NONE) · get_code("8dc011d26607845d") |
| AdaRoundQuantizer | Not yet run | ziplab/ptqd/quant_scripts/brecq_adaptive_rounding.py pointer only (licence: NONE) · get_code("1af0188a0d201eaf") |
Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.
Diffusion models have recently dominated image synthesis and other related generative tasks. However, the iterative denoising process is expensive in computations at inference time, making diffusion models less practical for low-latency and scalable real-world applications. Post-training quantization of diffusion models can significantly reduce the model size and accelerate the sampling process without requiring any re-training. Nonetheless, applying existing post-training quantization methods directly to low-bit diffusion models can significantly impair the quality of generated samples. Specifically, for each denoising step, quantization noise leads to deviations in the estimated mean and mismatches with the predetermined variance schedule. Moreover, as the sampling process proceeds, the quantization noise may accumulate, resulting in a low signal-to-noise ratio (SNR) during the later denoising steps. To address these challenges, we propose a unified formulation for the quantization noise and diffusion perturbed noise in the quantized denoising process. Specifically, we first disentangle the quantization noise into its correlated and residual uncorrelated parts regarding its full-precision counterpart. The correlated part can be easily corrected by estimating the correlation coefficient. For the uncorrelated part, we subtract the bias from the quantized results to correct the mean deviation and calibrate the denoising variance schedule to absorb the excess variance resulting from quantization. Moreover, we introduce a mixed-precision scheme for selecting the optimal bitwidth for each denoising step, which prioritizes lower bitwidths to expedite early denoising steps, while ensuring that higher bitwidths maintain a high signal-to-noise ratio (SNR) in the later steps. Extensive experiments demonstrate that our method outperforms previous post-training quantized diffusion models in generating high-quality samples, with only a 0.06 increase in FID score compared to full-precision LDM-4 on ImageNet 256 × 256, while saving 19.9× bit operations. Code is available at https://github.com/ziplab/PTQD.
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2305.10657")
get_code_for_paper("2305.10657")
have("2305.10657")
Connect an agent — have() is free.