CoCoDiff: Correspondence-Consistent Diffusion Model for Fine-grained Style Transfer

Wenbo Nie, Zixiang Li, Renshuai Tao, Bin Wu, Yunchao Wei, Yao Zhao

TL;DR

CoCoDiff is a training-free style transfer framework that achieves high-fidelity results by mining the "hidden" semantic alignment already present in pretrained latent diffusion models. By establishing dense, pixel-level correspondences between content and style images and refining them through a cycle-consistent optimization loop, it ensures that stylistic elements are applied to semantically matching regions while strictly preserving the original image's structure.

What Problem Does This Paper Address?

Neural Style Transfer (NST) aims to apply the artistic "look" of a style image to the "structure" of a content image. While recent diffusion-based methods produce stunning textures, they often struggle with semantic consistency.

For example, if you want to turn a photo of a car into a Van Gogh painting, a global style transfer might accidentally apply the texture of a "starry sky" to the car's wheels. Ideally, the model should recognize that the "car" in the content image should be stylized using features from "similar objects" or textures in the style image. Existing methods either treat diffusion models as black boxes (applying style globally) or require expensive additional training. CoCoDiff addresses this "semantic gap" by finding a way to perform fine-grained, region-aware stylization without any extra training or supervision.

Methods

The authors propose two primary modules that work together within the Latent Diffusion Model (LDM) framework:

CoCoDiff Architecture featuring FFM and FIC modules
  1. Fine-grained Feature Matching (FFM): The researchers discovered that intermediate features within a pretrained U-Net (the backbone of Stable Diffusion) contain rich semantic cues. They perform a two-dimensional grid search across different timesteps and network layers to find the "sweet spot" where features best represent semantic structure. Using these features, they construct a dense correspondence map via cosine similarity, essentially telling the model: "this pixel in the content image is semantically similar to that pixel in the style image."
  2. Fitting Cycle and Iterative Control (FIC): To refine the results, CoCoDiff uses a "closed-loop" refinement process. It iteratively updates the generated image, using a cycle-consistency mechanism to ensure the style and content remain aligned. This process is guided by:
  3. Perceptual/Style Losses: Using Sobel operators for edge preservation and Gram matrices for texture fidelity.
  4. Feature Injection: Modifying the self-attention maps during the denoising process to steer the generation based on the previously calculated correspondence map.
  5. Tone Harmonization: Applying Adaptive Instance Normalization (AdaIN) to the latent variables to ensure the global color palette matches the style reference.

Datasets

The authors evaluated CoCoDiff using:

  • MS-COCO: Used as the primary source for content images.
  • WikiArt: Used for style references, covering 13 distinct artistic styles (e.g., Ghibli, Impressionism, Sketch, Watercolor).
  • SPair-71k: A benchmark for semantic correspondence, used specifically to validate the quality of the feature matching module.

Key Insights and Ideas

  • Diffusion Models are Secretly Semantic Matchmakers: One of the most interesting findings is that we don't need to train new "alignment" modules. The internal representations of a standard diffusion model already "know" how to relate a car in one image to a car in another; we just need a principled way (like the FFM module) to extract that information.
  • The Power of Cycle-Consistency: Direct matching between a photo and a painting is hard because their low-level features (colors, edges) are so different. By using an iterative "fitting cycle," the model can progressively bridge the gap, making the semantic matching much more accurate as the generation proceeds.
  • Training-Free is the Future: By avoiding fine-tuning or extra "adapter" layers, CoCoDiff remains lightweight and highly adaptable to different versions of Stable Diffusion (the paper demonstrates success on v1.4, v1.5, v2.1, and even SDXL).

Key Results

Visual comparison of CoCoDiff against state-of-the-art style transfer methods
  • Quantitative Superiority: CoCoDiff achieved state-of-the-art (SOTA) scores across multiple metrics. On the MS-COCO/WikiArt benchmark, it hit an FID of 18.432 and an LPIPS of 0.549, outperforming nine other representative methods including StyleID and StyTR-2.
  • Structural Integrity: The CFSD score (0.609), which measures content preservation, was significantly better than most competitors, proving that the model doesn't "hallucinate" new structures while applying style.
  • User Preference: In a study with 25 participants, CoCoDiff was preferred nearly 3x more often (0.492 average preference rate) than the next best method (StyleID at 0.174).
  • Visual Quality: Qualitative results show much sharper object boundaries and more "logical" style application (e.g., matching the texture of waves in a painting specifically to the water in a photo).

Limitations and Future Work

While CoCoDiff is robust, the authors note a few areas for improvement:

  • Model Scaling: While it works with SDXL, the stability of fine-grained alignment decreases slightly on larger models, suggesting that hyperparameters like attention temperature ($\gamma$) need more automated tuning for different architectures.
  • Computational Overhead: Although "low-cost" because it requires no training, the iterative optimization process is naturally slower than "one-shot" feed-forward style transfer methods.
  • Guidance Modalities: Currently, the model relies on image-to-image correspondence. Future work could explore integrating more complex text-guided or multi-modal semantic constraints.

Summary updated

BibTeX
@inproceedings{nie2026cocodiff,
  author = {Wenbo Nie and Zixiang Li and Renshuai Tao and Bin WU and Yunchao Wei and Yao Zhao},
  title = {{CoCoDiff: Correspondence-Consistent Diffusion Model for Fine-grained Style Transfer}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=eRSuwB78LH},
}
Figure