Training-Free Style and Content Transfer by Leveraging U-Net Skip Connections in Stable Diffusion
Ludovica Schaerf, Andrea Alfarano, Fabrizio Silvestri, Leonardo Impett
TL;DR
The paper investigates the underexplored role of U-Net skip connections in Stable Diffusion and introduces SkipInject, a training-free approach that leverages the $l=4$ and $l=5$ skip paths to control content and style separately. They demonstrate that the residuals from the third encoder block primarily encode spatial structure, enabling content transfer when injected into another image, while style information flows through the main decoding path. SkipInject provides text-guided editing and style transfer with strong content preservation and structure fidelity, achieving state-of-the-art or on-par performance across benchmarks, and it offers modulation techniques to dial editing intensity and background influence. The work highlights the practical significance of skip connections for controllable diffusion-based editing and points to future extensions, such as handling two-image style transfer for broader applications.
Abstract
Recent advances in diffusion models for image generation have led to detailed examinations of several components within the U-Net architecture for image editing. While previous studies have focused on the bottleneck layer (h-space), cross-attention, self-attention, and decoding layers, the overall role of the skip connections of the U-Net itself has not been specifically addressed. We conduct thorough analyses on the role of the skip connections and find that the residual connections passed by the third encoder block carry most of the spatial information of the reconstructed image, splitting the content from the style, passed by the remaining stream in the opposed decoding layer. We show that injecting the representations from this block can be used for text-based editing, precise modifications, and style transfer. We compare our method, SkipInject, to state-of-the-art style transfer and image editing methods and demonstrate that our method obtains the best content alignment and optimal structural preservation tradeoff.
