Abstract
Despite the remarkable progress in image style transfer, formulating style in the context of art is inherently subjective and challenging. In contrast to existing methods, this study shows that vanilla diffusion models can directly extract style information and seamlessly integrate the generative prior into the content image without retraining. Specifically, we adopt dual denoising paths to represent content/style references in latent space and then guide the content image denoising process with style latent codes. We further reveal that the cross-attention mechanism in latent diffusion models tends to blend the content and style images, resulting in stylized outputs that deviate from the original content image. To overcome this limitation, we introduce a cross-attention reweighting strategy. Through theoretical analysis and experiments, we demonstrate the effectiveness and superiority of the diffusion-based zero-shot style transfer via attention reweighting, Z-STAR.
Introduction
Image style transfer—the art of applying the texture and "feel" of one image to the structure of another—has evolved from simple color matching to complex neural transformations. However, two major hurdles remain: the training bottleneck and the content-style tug-of-war. Many state-of-the-art diffusion-based methods require training a specific "style embedding" for every new style image, which can take 20 minutes or more per style. Furthermore, standard attention mechanisms in diffusion models often struggle to find a middle ground, either over-stylizing and destroying content identity or failing to capture artistic nuances.
Z-STAR (Z*) addresses these challenges as a novel zero-shot style transfer method that leverages the generative power of pre-trained diffusion models without requiring any retraining or fine-tuning. By introducing a specialized Cross-attention Reweighting strategy, it successfully balances intricate artistic style expression with the preservation of the original content's structure.
Methods
Z-STAR operates entirely within the latent space of a pre-trained Stable Diffusion model. The core workflow involves several key components:
Dual Denoising Paths
The algorithm maintains two parallel paths—one for the content reference and one for the style reference. It uses DDIM inversion to map these images into the latent space of a pre-trained Stable Diffusion v1.5 model.
Cross-attention Reweighting
This is the paper's primary innovation. In a standard Transformer block, a "Query" (Q) looks for information in "Keys" (K) and "Values" (V). Usually, style transfer uses the content image for Q and the style image for K and V. The authors found that this "naive" approach often ignores the content's structure. They proposed a reweighted attention matrix that considers both the style features and the content's own self-attention features simultaneously. By integrating a scaling factor ($\lambda$) inside the Softmax function, the model can effectively "silence" style features that don't align with the content's geometry, ensuring the output looks like the original subject but painted in the new style.
Strategic Injection
Style isn't forced into every layer or every step. Through ablation studies, the authors found that injecting style into the high-resolution decoder layers (specifically layers 10-15) during the middle-to-late stages of denoising (steps 5-30) yields the most natural results.
Results and Discussion
Z-STAR produces stylized images with more vivid brushstrokes and better-preserved facial identities than previous diffusion methods. For example, it maintains a subject's facial features while applying thick, Van Gogh-esque impasto strokes or anime-inspired aesthetics.
Efficiency and User Preference
Unlike methods like InST or VCT, which require ~20 minutes of optimization per style, Z-STAR is inference-only, providing results as fast as a standard diffusion generation. In a user study with 55 participants and 1,760 total votes, Z-STAR was preferred over all other methods in terms of "overall effect" and "content preservation."
Conclusion
The authors demonstrate that vanilla diffusion models already "know" how to transfer style because they have learned the distribution of billions of images. Z-STAR provides a better way to "query" this internal knowledge without the need for costly retraining. While memory constraints and automated regional control remain areas for future work, Z-STAR sets a new standard for efficient, high-fidelity zero-shot style transfer.
Summary updated