Attention Distillation: A Unified Approach to Visual Characteristics Transfer
Yang Zhou, Xu Gao, Zichong Chen, Hui Huang
TL;DR
This work tackles transferring visual characteristics from a reference image to new content within latent-diffusion models. It introduces Attention Distillation (AD), a loss that aligns self-attention-based representations between target and reference via $\mathcal{L}_{AD}$ and complements it with a content loss, enabling both optimization-based and sampling-based (AD-guided) synthesis. The approach is extended with an improved VAE decoding strategy and a diffusion-sampling mechanism that uses gradient-based AD guidance, achieving style transfer, appearance transfer, texture synthesis, and style-conditioned text-to-image generation with broad compatibility (e.g., ControlNet). Empirical results across multiple tasks show superior fidelity to references, better structural preservation, and accelerated synthesis compared to state-of-the-art baselines, making AD a flexible, unified framework for example-based image synthesis.
Abstract
Recent advances in generative diffusion models have shown a notable inherent understanding of image style and semantics. In this paper, we leverage the self-attention features from pretrained diffusion networks to transfer the visual characteristics from a reference to generated images. Unlike previous work that uses these features as plug-and-play attributes, we propose a novel attention distillation loss calculated between the ideal and current stylization results, based on which we optimize the synthesized image via backpropagation in latent space. Next, we propose an improved Classifier Guidance that integrates attention distillation loss into the denoising sampling process, further accelerating the synthesis and enabling a broad range of image generation applications. Extensive experiments have demonstrated the extraordinary performance of our approach in transferring the examples' style, appearance, and texture to new images in synthesis. Code is available at https://github.com/xugao97/AttentionDistillation.
