# Towards Understanding Cross and Self-Attention in Stable Diffusion for Text-Guided Image Editing

Source: [Towards Understanding Cross and Self-Attention in Stable Diffusion for Text-Guided Image Editing](<https://www.sota2.com/research/paper/68fa72621e209131cea561c6>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2026-01-04T04:49:20.996Z

Authors: Bingyan Liu, Chengyu Wang, Tingfeng Cao, Kui Jia, Jun Huang

Published: 2024-03-06T03:32:56.000Z

## Abstract

Deep Text-to-Image Synthesis (TIS) models such as Stable Diffusion have recently gained significant popularity for creative Text-to-image generation. Yet, for domain-specific scenarios, tuning-free Text-guided Image Editing (TIE) is of greater importance for application developers, which modify objects or object properties in images by manipulating feature components in attention layers during the generation process. However, little is known about what semantic meanings these attention layers have learned and which parts of the attention maps contribute to the success of image editing. In this paper, we conduct an in-depth probing analysis and demonstrate that cross-attention maps in Stable Diffusion often contain object attribution information that can result in editing failures. In contrast, self-attention maps play a crucial role in preserving the geometric and shape details of the source image during the transformation to the target image. Our analysis offers valuable insights into understanding cross and self-attention maps in diffusion models. Moreover, based on our findings, we simplify popular image editing methods and propose a more straightforward yet more stable and efficient tuning-free procedure that only modifies self-attention maps of the specified attention layers during the denoising process. Experimental results show that our simplified method consistently surpasses the performance of popular approaches on multiple datasets.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Text-to-Image Editing on ImageNet-R TI2I (fake)](<https://www.sota2.com/research/sota/text-to-image-editing-on-imagenet-r-ti2i-fake.md>): Text-to-Image Editing; ImageNet-R TI2I (fake); CS Score: 29.79.

- [Image Editing on Car-fake-edit](<https://www.sota2.com/research/sota/image-editing-on-car-fake-edit.md>): Image Editing; Car-fake-edit; CS: 26.02.

- [Image Editing on Car-real-edit](<https://www.sota2.com/research/sota/image-editing-on-car-real-edit.md>): Image Editing; Car-real-edit; CS: 0.2485.

- [Image Editing on ImageNet fake-edit](<https://www.sota2.com/research/sota/image-editing-on-imagenet-fake-edit.md>): Image Editing; ImageNet fake-edit; CS: 27.8.

- [Image Editing on ImageNetR-Fake (test)](<https://www.sota2.com/research/sota/image-editing-on-imagenetr-fake-test.md>): Image Editing; ImageNetR-Fake (test); Structural Distance: 44.6252.

- [Image Editing on ImageNet real-edit](<https://www.sota2.com/research/sota/image-editing-on-imagenet-real-edit.md>): Image Editing; ImageNet real-edit; CS Score: 29.05.

- [Text-to-Image Editing on Wild-TI2I](<https://www.sota2.com/research/sota/text-to-image-editing-on-wild-ti2i.md>): Text-to-Image Editing; Wild-TI2I; CP Score: 29.

- [Image Editing on IMBA 1.0 (test)](<https://www.sota2.com/research/sota/image-editing-on-imba-1-0-test.md>): Image Editing; IMBA 1.0 (test); Object Retention Score: 4.5.

- [Text-to-Image Editing on Wild-TI2I real](<https://www.sota2.com/research/sota/text-to-image-editing-on-wild-ti2i-real.md>): Text-to-Image Editing; Wild-TI2I real; CS: 29.04.

- [Text-to-Image Editing on Wild-TI2I fake](<https://www.sota2.com/research/sota/text-to-image-editing-on-wild-ti2i-fake.md>): Text-to-Image Editing; Wild-TI2I fake; CS Score: 27.88.

- [Image Editing on IMBA](<https://www.sota2.com/research/sota/image-editing-on-imba.md>): Image Editing; IMBA; CLIP Score: 29.02.

- [Image Editing on PIE-Bench (test)](<https://www.sota2.com/research/sota/image-editing-on-pie-bench-test.md>): Image Editing; PIE-Bench (test); PSNR: 18.759.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/2403.03431>)

[PDF](<https://arxiv.org/pdf/2403.03431.pdf>)

[Implementation](<https://github.com/alibaba/EasyNLP/tree/master/diffusion/FreePromptEditing>)
