并非所有提示词都平等:基于提示词的文本到图像扩散模型剪枝
Not All Prompts Are Made Equal: Prompt-based Pruning of Text-to-Image Diffusion Models
AI总结:
针对文本到图像扩散模型剪枝中静态方法忽略提示词容量差异、动态方法阻碍批处理并行性的问题,提出自适应提示词定制剪枝(APTP),通过提示词路由器和架构代码实现提示词感知剪枝,在SD V2.1上验证其优于基线且能发现挑战性提示词。
摘要:
文本到图像(T2I)扩散模型已展现出令人印象深刻的图像生成能力。然而,其计算强度使得资源受限的组织在针对内部目标数据微调T2I模型后,难以部署这些模型。虽然剪枝技术为降低T2I模型的计算负担提供了潜在解决方案,但静态剪枝方法对所有输入提示词使用相同的剪枝模型,忽略了不同提示词的不同容量需求。动态剪枝通过为每个提示词使用单独的子网络来解决这一问题,但它阻碍了GPU上的批处理并行性。为克服这些限制,我们引入自适应提示词定制剪枝(APTP),这是一种为T2I扩散模型设计的新型基于提示词的剪枝方法。我们方法的核心是一个提示词路由器模型,它在给定提示词的总期望计算预算下,学习确定输入文本提示词所需的容量,并将其路由到一个架构代码。每个架构代码代表一个为分配给它的提示词定制的专用模型,代码数量是一个超参数。我们使用对比学习训练提示词路由器和架构代码,确保相似的提示词被映射到相近的代码。此外,我们采用最优传输来防止代码坍缩为单一代码。我们通过在CC3M和COCO作为目标数据集的情况下剪枝Stable Diffusion(SD)V2.1来证明APTP的有效性。APTP在FID、CLIP和CMMD分数方面优于单模型剪枝基线。我们对APTP学习到的簇的分析表明,这些簇在语义上是有意义的。我们还表明,APTP能够自动发现SD之前凭经验发现的具有挑战性的提示词,例如生成文本图像的提示词,并将它们分配给更高容量的代码。
英文摘要:
Text-to-image (T2I) diffusion models have demonstrated impressive image generation capabilities. Still, their computational intensity prohibits resource-constrained organizations from deploying T2I models after fine-tuning them on their internal target data. While pruning techniques offer a potential solution to reduce the computational burden of T2I models, static pruning methods use the same pruned model for all input prompts, overlooking the varying capacity requirements of different prompts. Dynamic pruning addresses this issue by utilizing a separate sub-network for each prompt, but it prevents batch parallelism on GPUs. To overcome these limitations, we introduce Adaptive Prompt-Tailored Pruning (APTP), a novel prompt-based pruning method designed for T2I diffusion models. Central to our approach is a prompt router model, which learns to determine the required capacity for an input text prompt and routes it to an architecture code, given a total desired compute budget for prompts. Each architecture code represents a specialized model tailored to the prompts assigned to it, and the number of codes is a hyperparameter. We train the prompt router and architecture codes using contrastive learning, ensuring that similar prompts are mapped to nearby codes. Further, we employ optimal transport to prevent the codes from collapsing into a single one. We demonstrate APTP's effectiveness by pruning Stable Diffusion (SD) V2.1 using CC3M and COCO as target datasets. APTP outperforms the single-model pruning baselines in terms of FID, CLIP, and CMMD scores. Our analysis of the clusters learned by APTP reveals they are semantically meaningful. We also show that APTP can automatically discover previously empirically found challenging prompts for SD, e.g. prompts for generating text images, assigning them to higher capacity codes.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。