StyleKeeper: Prevent Content Leakage using Negative Visual Query Guidance
Jaeseok Jeong, Junho Kim, Gayoung Lee, Yunjey Choi, Youngjung Uh
TL;DR
This work tackles content leakage in visual style prompting for text-to-image diffusion models by introducing StyleKeeper, a training-free framework that combines classifier-free guidance with swapped self-attention, negative visual query guidance, stochastic encoding of real images, and color calibration. The method selectively swaps high-level upblock self-attention, uses a KV-injected score to separate style from content, and employs NVQG to suppress unwanted visual content, achieving faithful text-driven content while reflecting reference style. Real-image prompts are supported via stochastic encoding and color calibration to maintain style fidelity without costly inversions. Empirical results across diverse prompts and baselines show improved style similarity, preserved content fidelity, and reduced content leakage, with demonstrated compatibility with ControlNet and other I2I editing approaches, highlighting practical implications for flexible, training-free visual style control.
Abstract
In the domain of text-to-image generation, diffusion models have emerged as powerful tools. Recently, studies on visual prompting, where images are used as prompts, have enabled more precise control over style and content. However, existing methods often suffer from content leakage, where undesired elements of the visual style prompt are transferred along with the intended style. To address this issue, we 1) extend classifier-free guidance (CFG) to utilize swapping self-attention and propose 2) negative visual query guidance (NVQG) to reduce the transfer of unwanted contents. NVQG employs negative score by intentionally simulating content leakage scenarios that swap queries instead of key and values of self-attention layers from visual style prompts. This simple yet effective method significantly reduces content leakage. Furthermore, we provide careful solutions for using a real image as visual style prompts. Through extensive evaluation across various styles and text prompts, our method demonstrates superiority over existing approaches, reflecting the style of the references, and ensuring that resulting images match the text prompts. Our code is available \href{https://github.com/naver-ai/StyleKeeper}{here}.
