arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2503.06930cs.CV
收藏

扩散Transformer的分层时间步分组后训练量化

Post-Training Quantization for Diffusion Transformer via Hierarchical Timestep Grouping

Peking University(北京大学);Beijing University of Posts and Telecommunications(北京邮电大学)

Ning Ding, Jing Han, Yuchuan Tian, Chao Xu, Kai Han, Yehui Tang

AI总结:

针对扩散Transformer部署压力,提出分层时间步分组后训练量化框架,通过平滑异常值分布和聚类时间步,实现W8A8及W4A8量化,保持生成质量。

摘要:

扩散Transformer(DiT)现已成为构建图像生成模型的首选,因其强大的生成能力。与以往基于卷积的UNet模型不同,DiT完全由一系列Transformer块组成,这使得DiT在可扩展性方面表现出色,类似于大型语言模型。然而,不断增长的模型规模和多步采样范式给部署和推理带来了相当大的压力。在这项工作中,我们提出了一种专门针对扩散Transformer的后训练量化框架,以应对这些挑战。我们首先定位到DiT的量化困难主要源于依赖于时间的通道特定异常值。我们提出了一种时间步感知的移位和缩放策略,以平滑激活分布,从而减少量化误差。其次,基于相邻时间步的激活具有相似分布的观察,我们利用分层聚类方案将去噪时间步划分为多个组。我们进一步设计了一种重新参数化方案,将量化参数吸收到附近的模块中,以避免冗余计算。综合实验表明,我们的PTQ方法成功地将扩散Transformer量化为8位权重和8位激活(W8A8),并取得了最先进的FiD分数。我们的方法还可以进一步将DiT模型量化为4位权重和8位激活(W4A8),而不牺牲生成质量。

英文摘要:

Diffusion Transformer (DiT) has now become the preferred choice for building image generation models due to its great generation capability. Unlike previous convolution-based UNet models, DiT is purely composed of a stack of transformer blocks, which renders DiT excellent in scalability like large language models. However, the growing model size and multi-step sampling paradigm bring about considerable pressure on deployment and inference. In this work, we propose a post-training quantization framework tailored for Diffusion Transforms to tackle these challenges. We firstly locate that the quantization difficulty of DiT mainly originates from the time-dependent channel-specific outliers. We propose a timestep-aware shift-and-scale strategy to smooth the activation distribution to reduce the quantization error. Secondly, based on the observation that activations of adjacent timesteps have similar distributions, we utilize a hierarchical clustering scheme to divide the denoising timesteps into multiple groups. We further design a re-parameterization scheme which absorbs the quantization parameters into nearby module to avoid redundant computations. Comprehensive experiments demonstrate that out PTQ method successfully quantize the Diffusion Transformer into 8-bit weight and 8-bit activation (W8A8) with state-of-the-art FiD score. And our method can further quantize DiT model into 4-bit weight and 8-bit activation (W4A8) without sacrificing generation quality.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑