arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.09935cs.CV
收藏

扩散模型中文本生成的精确参数定位

Precise Parameter Localization for Textual Generation in Diffusion Models

Warsaw University of Technology(华沙技术大学);CISPA Helmholtz Center for Information Security(信息安全赫尔姆霍茨中心);IDEAS NCBR

Łukasz Staniszewski, Bartosz Cywiński, Franziska Boenisch, Kamil Deja, Adam Dziedzic

AI总结:

通过局部化扩散模型中负责文本生成的注意力层,提升文本生成效率和性能,同时防止生成有毒文本。

摘要:

新颖的扩散模型能够生成具有高质量文本的逼真图像。令人惊讶的是,我们通过注意力激活块的拼接证明,只有少于1%的扩散模型参数,全部包含在注意力层中,会影响图像中文本内容的生成。基于这一观察,我们通过针对扩散模型的交叉注意力层和联合注意力层来提高文本生成的效率和性能。我们引入了几种受益于局部化负责文本内容生成的层的应用。我们首先展示仅对局部化层进行LoRA基于的微调可以进一步增强大型扩散模型的一般文本生成能力,同时保持扩散模型生成的质量和多样性。然后,我们展示了如何利用局部化层来编辑生成图像中的文本内容。最后,我们将这一想法扩展到防止生成有毒文本的实用场景中,而无需额外成本。与先前的工作不同,我们的局部化方法可以广泛应用于各种扩散模型架构,包括U-Net(例如SDXL和DeepFloyd IF)和基于变压器的(例如Stable Diffusion 3),利用多样的文本编码器(例如从CLIP到大型语言模型如T5)。项目页面可在https://t2i-text-loc.github.io/上找到。

英文摘要:

Novel diffusion models can synthesize photo-realistic images with integrated high-quality text. Surprisingly, we demonstrate through attention activation patching that only less than $1$% of diffusion models' parameters, all contained in attention layers, influence the generation of textual content within the images. Building on this observation, we improve textual generation efficiency and performance by targeting cross and joint attention layers of diffusion models. We introduce several applications that benefit from localizing the layers responsible for textual content generation. We first show that a LoRA-based fine-tuning solely of the localized layers enhances, even more, the general text-generation capabilities of large diffusion models while preserving the quality and diversity of the diffusion models' generations. Then, we demonstrate how we can use the localized layers to edit textual content in generated images. Finally, we extend this idea to the practical use case of preventing the generation of toxic text in a cost-free manner. In contrast to prior work, our localization approach is broadly applicable across various diffusion model architectures, including U-Net (e.g., SDXL and DeepFloyd IF) and transformer-based (e.g., Stable Diffusion 3), utilizing diverse text encoders (e.g., from CLIP to the large language models like T5). Project page available at https://t2i-text-loc.github.io/.

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

↑