Saved in:
Bibliographic Details
Main Authors: Staniszewski, Łukasz, Cywiński, Bartosz, Boenisch, Franziska, Deja, Kamil, Dziedzic, Adam
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2502.09935
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914359583703040
author Staniszewski, Łukasz
Cywiński, Bartosz
Boenisch, Franziska
Deja, Kamil
Dziedzic, Adam
author_facet Staniszewski, Łukasz
Cywiński, Bartosz
Boenisch, Franziska
Deja, Kamil
Dziedzic, Adam
contents 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/.
format Preprint
id arxiv_https___arxiv_org_abs_2502_09935
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Precise Parameter Localization for Textual Generation in Diffusion Models
Staniszewski, Łukasz
Cywiński, Bartosz
Boenisch, Franziska
Deja, Kamil
Dziedzic, Adam
Computer Vision and Pattern Recognition
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/.
title Precise Parameter Localization for Textual Generation in Diffusion Models
topic Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2502.09935