CLEAR:类卷积线性化加速预训练扩散Transformer
CLEAR: Conv-Like Linearization Revs Pre-Trained Diffusion Transformers Up
AI总结:
本文提出CLEAR类卷积局部注意力策略,通过限制特征交互窗口将预训练扩散Transformer的注意力复杂度降至线性,在保持生成质量的同时大幅减少计算量并加速高分辨率图像生成。
摘要:
扩散Transformer(DiT)已成为图像生成的主导架构。然而,负责建模token间关系的注意力机制具有二次复杂度,导致生成高分辨率图像时产生显著延迟。为解决此问题,本文旨在设计一种线性注意力机制,将预训练DiT的复杂度降至线性。我们从全面总结现有高效注意力机制开始探索,并确定了成功实现预训练DiT线性化的四个关键因素:局部性、公式一致性、高秩注意力图和特征完整性。基于这些见解,我们引入了一种称为CLEAR的类卷积局部注意力策略,将特征交互限制在每个查询token周围的局部窗口内,从而实现线性复杂度。实验表明,仅需在10K自生成样本上微调注意力层10K次迭代,即可有效将预训练DiT的知识迁移至具有线性复杂度的学生模型,产生与教师模型相当的结果。同时,在生成8K分辨率图像时,它减少了99.5%的注意力计算量,并将生成速度提升6.3倍。此外,我们研究了蒸馏注意力层中的优良特性,如跨各种模型和插件的零样本泛化能力,以及对多GPU并行推理的更好支持。
英文摘要:
Diffusion Transformers (DiT) have become a leading architecture in image generation. However, the quadratic complexity of attention mechanisms, which are responsible for modeling token-wise relationships, results in significant latency when generating high-resolution images. To address this issue, we aim at a linear attention mechanism in this paper that reduces the complexity of pre-trained DiTs to linear. We begin our exploration with a comprehensive summary of existing efficient attention mechanisms and identify four key factors crucial for successful linearization of pre-trained DiTs: locality, formulation consistency, high-rank attention maps, and feature integrity. Based on these insights, we introduce a convolution-like local attention strategy termed CLEAR, which limits feature interactions to a local window around each query token, and thus achieves linear complexity. Our experiments indicate that, by fine-tuning the attention layer on merely 10K self-generated samples for 10K iterations, we can effectively transfer knowledge from a pre-trained DiT to a student model with linear complexity, yielding results comparable to the teacher model. Simultaneously, it reduces attention computations by 99.5% and accelerates generation by 6.3 times for generating 8K-resolution images. Furthermore, we investigate favorable properties in the distilled attention layers, such as zero-shot generalization cross various models and plugins, and improved support for multi-GPU parallel inference. Models and codes are available here: https://github.com/Huage001/CLEAR.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。