PC-Edit: Prompt-Contrastive Region Discovery and Region-Guided Editing

Jian Zhang1, Zhijun Zhang1

1 School of Electronic and Information Engineering, South China University of Technology, Guangzhou, China 202411084134@mail.scut.edu.cn, auzjzhang@scut.edu.cn

Abstract

Replacing an object with one that differs in category or shape requires complete source removal, natural target formation unconstrained by the source silhouette, and preservation of unrelated content. Existing training-free editors often trade edit completeness for background preservation or localize edits from signals whose spatial response has already been obscured by later network transformations. PC-Edit is a prompt-contrastive framework for training-free MM-DiT editing. It contrasts image-token attention outputs under source and target prompts at the same latent state and timestep, capturing semantic differences directly where text-conditioned information is delivered to image tokens. The same contrast discovers a source-erasure region during inversion and tracks a target-emergence region during denoising. Their union suppresses source remnants while allowing the target to form naturally. PC-Edit further preserves unrelated content by immediately injecting cached source K/V features outside the discovered region within each sampling step. The method supports single- and multi-object addition and replacement without user-provided masks.

How it works

Pipeline

PC-Edit estimates the source-erasure mask during inversion, tracks the target-emergence mask during denoising, and injects source K/V outside their union to preserve unrelated content.

Qualitative examples

Demo Results

Addition. Qualitative comparison on object addition.
Replacement. Qualitative comparison on object replacement.