[论文解读] EfficientDM: Efficient Quantization-Aware Fine-Tuning of Low-Bit Diffusion Models
EfficientDM 提出了一种无需数据、量化感知且参数高效的微调框架,适用于低比特扩散模型,其性能达到量化训练(QAT)水平,同时具备权重量化微调(PTQ)的效率。通过引入一种量化感知的 LoRA 变体(QALoRA)、感知尺度的优化方法以及时间感知的自适应步长量化,该方法实现了适配器与模型权重的联合量化,在 4 位精度下将 ImageNet 256×256 的 sFID 降低 1.56 个点,同时将量化时间减少 16.2 倍,相比 QAT 方法显著提升效率。
Diffusion models have demonstrated remarkable capabilities in image synthesis and related generative tasks. Nevertheless, their practicality for real-world applications is constrained by substantial computational costs and latency issues. Quantization is a dominant way to compress and accelerate diffusion models, where post-training quantization (PTQ) and quantization-aware training (QAT) are two main approaches, each bearing its own properties. While PTQ exhibits efficiency in terms of both time and data usage, it may lead to diminished performance in low bit-width. On the other hand, QAT can alleviate performance degradation but comes with substantial demands on computational and data resources. In this paper, we introduce a data-free and parameter-efficient fine-tuning framework for low-bit diffusion models, dubbed EfficientDM, to achieve QAT-level performance with PTQ-like efficiency. Specifically, we propose a quantization-aware variant of the low-rank adapter (QALoRA) that can be merged with model weights and jointly quantized to low bit-width. The fine-tuning process distills the denoising capabilities of the full-precision model into its quantized counterpart, eliminating the requirement for training data. We also introduce scale-aware optimization and temporal learned step-size quantization to further enhance performance. Extensive experimental results demonstrate that our method significantly outperforms previous PTQ-based diffusion models while maintaining similar time and data efficiency. Specifically, there is only a 0.05 sFID increase when quantizing both weights and activations of LDM-4 to 4-bit on ImageNet 256x256. Compared to QAT-based methods, our EfficientDM also boasts a 16.2x faster quantization speed with comparable generation quality. Code is available at \href{https://github.com/ThisisBillhe/EfficientDM}{this hrl}.
研究动机与目标
- 为解决扩散模型低比特量化中的效率-质量权衡问题,其中 PTQ 性能不足,而 QAT 对数据和计算资源需求过高。
- 消除量化过程中对原始训练数据的依赖,使模型能在资源受限设备上实现实际部署。
- 在权重与激活均为 4 位精度下保持高生成质量,而此前的 PTQ 方法无法维持去噪能力。
- 在实现 QAT 水平性能的同时,兼具 PTQ 的时间与数据效率,使低比特扩散模型在真实场景中更具可行性。
提出的方法
- 提出 QALoRA,一种量化感知的低秩适配器变体,可与模型权重联合量化,支持高效且低比特的推理。
- 采用无数据蒸馏框架,通过最小化全精度模型与量化模型之间噪声预测的均方误差,消除对训练数据的依赖。
- 应用感知尺度的优化策略,自适应调整各层的梯度尺度,提升在不同量化尺度下低比特设置中的优化效率。
- 提出时间感知的自适应步长量化(TLSQ),以应对去噪过程中激活分布的变化,增强推理阶段的鲁棒性。
- 将 QALoRA 权重与量化模型融合,实现参数高效的微调,且不增加额外存储或计算开销。
- 采用两阶段训练流程:首先通过 QALoRA 将全精度模型的知识蒸馏到量化模型中,随后利用 TLSQ 和感知尺度优化进行精细化调整。
实验结果
研究问题
- RQ1是否存在一种无数据微调方法,可在不访问原始训练数据集的前提下,实现低比特扩散模型量化中 QAT 水平的性能?
- RQ2如何设计量化感知的低秩适配器,使其能与模型权重联合量化,同时在 4 位精度下保持性能?
- RQ3在低比特设置中,针对网络各层间存在不同量化尺度的情况,哪些优化策略能有效缓解性能下降?
- RQ4在去噪步骤中对量化参数进行时间自适应调整,是否能提升低比特扩散模型的鲁棒性与生成质量?
- RQ5是否可能在 4 位精度下实现接近全精度的生成质量,同时相比 QAT 显著降低时间和内存开销?
主要发现
- 在 4 位精度(W/A)下,EfficientDM 在 ImageNet 256×256 上实现了 7.75 的 sFID,仅比全精度基线高出 0.05,优于以往 PTQ 方法在该位宽下无法有效去噪的表现。
- 与基于 QAT 的方法相比,该方法将量化时间减少了 16.2 倍,在 ImageNet 256×256 上仅需 3.05 GPU 小时,而 QAT 需要 54.5 GPU 小时。
- 在 CIFAR-10 上,EfficientDM 实现了 10.48 的 FID,仅用 0.97 GPU 小时,性能与 QAT(FID 7.30)相当,且比 QAT 快 16.8 倍,比 PTQ 快 1.1 倍。
- 感知尺度优化将 FID 从 QALoRA 单独使用时的 24.18 降低至 13.23,证明其在处理不同量化尺度的层间优化中具有显著有效性。
- TLSQ 进一部将 FID 从 13.23 降低至 7.75,表明针对不同去噪步骤的自适应量化可有效应对激活分布偏移,从而提升性能。
- 在 ImageNet 256×256 上,EfficientDM 仅消耗 19.8GB GPU 显存,远低于 QAT 在 RTX 3090 上的显存溢出(OOM)问题,且无需依赖数据,使其在实际部署中更具可行性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。