Skip to main content
QUICK REVIEW

[Paper Review] Dynamic Prompt Learning: Addressing Cross-Attention Leakage for Text-Based Image Editing

Kai Wang, Fei Yang|arXiv (Cornell University)|Sep 27, 2023
Generative Adversarial Networks and Image SynthesisComputer Science14 citations
TL;DR

DPL learns dynamic noun tokens per timestamp to reduce cross-attention leakage, enabling precise editing of targeted objects while preserving background and distractor regions in diffusion-based image editing.

ABSTRACT

Large-scale text-to-image generative models have been a ground-breaking development in generative AI, with diffusion models showing their astounding ability to synthesize convincing images following an input text prompt. The goal of image editing research is to give users control over the generated images by modifying the text prompt. Current image editing techniques are susceptible to unintended modifications of regions outside the targeted area, such as on the background or on distractor objects which have some semantic or visual relationship with the targeted object. According to our experimental findings, inaccurate cross-attention maps are at the root of this problem. Based on this observation, we propose Dynamic Prompt Learning (DPL) to force cross-attention maps to focus on correct noun words in the text prompt. By updating the dynamic tokens for nouns in the textual input with the proposed leakage repairment losses, we achieve fine-grained image editing over particular objects while preventing undesired changes to other image regions. Our method DPL, based on the publicly available Stable Diffusion, is extensively evaluated on a wide range of images, and consistently obtains superior results both quantitatively (CLIP score, Structure-Dist) and qualitatively (on user-evaluation). We show improved prompt editing results for Word-Swap, Prompt Refinement, and Attention Re-weighting, especially for complex multi-object scenes.

Motivation & Objective

  • Motivate the problem of unintended changes in text-guided image editing due to cross-attention leakage.
  • Propose Dynamic Prompt Learning (DPL) to optimize noun-word embeddings per timestamp to localize edits.
  • Develop leakage-focused losses (background leakage, disjoint object attention, attention balancing) to refine cross-attention maps.
  • Leverage Null-Text Inversion and DDIM inversion to enable accurate editing of real images.
  • Demonstrate improved editing quality on multi-object real-image prompts using Stable Diffusion.

Proposed method

  • Transform noun words in the prompt into dynamic, timestamp-specific tokens.
  • Introduce three losses to constrain cross-attention: background leakage loss, disjoint object attention loss, and attention balancing loss.
  • Update the token embeddings per timestep via gradient-based optimization with gradual thresholds, ensuring attention maps localize to the intended object.
  • Use Null-Text Inversion to approximate the diffusion trajectory while preserving reconstruction fidelity.
  • Integrate DPL with P2P-style editing to evaluate word-swap and other prompt editing tasks on multi-object scenes.
  • Optionally derive background masks from self-attention clusters to further suppress leakage.

Experimental results

Research questions

  • RQ1Can dynamic, per-timestep token optimization improve cross-attention localization for multi-object editing?
  • RQ2Do leakage-focused losses (background, distractor, and attention-balancing) yield superior editing quality compared to baselines?
  • RQ3How does DPL perform on real multi-object images when combined with existing editing frameworks like P2P?

Key findings

  • DPL yields superior cross-attention maps and editing quality versus Null-Text inversion baselines, particularly in complex multi-object scenes.
  • Quantitative metrics show higher CLIP scores and lower Structure-Dist with DPL+P2P compared to NTI+P2P in multi-object edits.
  • Ablation studies indicate that combining all three losses (background leakage, disjoint object attention, and attention balancing) provides the best localization and editing results.
  • DPL improves Word-Swap and Prompt Refinement scenarios by reducing unintended changes to background and distractor objects.
  • User studies corroborate quantitative gains, with DPL+P2P preferred over NTI+P2P for multi-object edits.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.