MixDQ:基于度量解耦混合精度量化的内存高效少步文本到图像扩散模型
MixDQ: Memory-Efficient Few-Step Text-to-Image Diffusion Models with Metric-Decoupled Mixed Precision Quantization
AI总结:
针对少步扩散模型量化中难以兼顾图像质量与文本对齐的问题,提出混合精度量化框架MixDQ,通过BOS感知量化、度量解耦敏感性分析与整数规划比特分配,在W8A8下无损性能,实现3-4倍模型大小与内存降低及1.45倍延迟加速。
摘要:
扩散模型已实现显著的视觉生成质量。然而,其庞大的计算和内存开销给其在资源受限的移动设备甚至桌面GPU上的应用带来了挑战。近期的少步扩散模型通过减少去噪步骤降低了推理时间,但其内存消耗依然过高。训练后量化(PTQ)用低比特整数值(INT4/8)替代高比特宽度的FP表示,是降低内存开销的有效且高效的技术。然而,应用于少步扩散模型时,现有量化方法在同时保持图像质量和文本对齐方面面临挑战。为解决此问题,我们提出了一种混合精度量化框架——MixDQ。首先,我们为高敏感度的文本嵌入量化设计了专门的BOS感知量化方法。然后,我们进行度量解耦的敏感性分析以测量每层的敏感度。最后,我们开发了一种基于整数规划的方法来执行比特宽度分配。当现有量化方法在W8A8上表现不佳时,MixDQ能够在W8A8下实现无性能损失,并在W4A8下产生可忽略的视觉退化。与FP16相比,我们将模型大小和内存开销降低了3-4倍,并实现了1.45倍的延迟加速。
英文摘要:
Diffusion models have achieved significant visual generation quality. However, their significant computational and memory costs pose challenge for their application on resource-constrained mobile devices or even desktop GPUs. Recent few-step diffusion models reduces the inference time by reducing the denoising steps. However, their memory consumptions are still excessive. The Post Training Quantization (PTQ) replaces high bit-width FP representation with low-bit integer values (INT4/8) , which is an effective and efficient technique to reduce the memory cost. However, when applying to few-step diffusion models, existing quantization methods face challenges in preserving both the image quality and text alignment. To address this issue, we propose an mixed-precision quantization framework - MixDQ. Firstly, We design specialized BOS-aware quantization method for highly sensitive text embedding quantization. Then, we conduct metric-decoupled sensitivity analysis to measure the sensitivity of each layer. Finally, we develop an integer-programming-based method to conduct bit-width allocation. While existing quantization methods fall short at W8A8, MixDQ could achieve W8A8 without performance loss, and W4A8 with negligible visual degradation. Compared with FP16, we achieve 3-4x reduction in model size and memory cost, and 1.45x latency speedup.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。