While diffusion models are renowned for generating stunning images, they also harbor a "secret" expertise: a profound understanding of how different images relate to one another. This paper introduces DIffusion FeaTures (DIFT), a remarkably simple method to extract pixel-level correspondences from pre-trained diffusion networks without any extra training, fine-tuning, or labels. DIFT significantly outperforms established self-supervised models like DINO and OpenCLIP, proving that the act of learning to "de-noise" an image forces a generative model to learn a deep, semantic understanding of the visual world.
The Challenge of Image Correspondence
Establishing "correspondence"—identifying that a specific pixel in one image represents the exact same object part (like a cat’s left ear) in another image—is a cornerstone of computer vision. It is essential for downstream tasks like 3D reconstruction, object tracking, and advanced image editing.
While humans can easily match parts across different viewpoints, lighting conditions, or even different species (e.g., matching a dog’s eye to a cat’s eye), computer vision systems historically struggle with this. Traditionally, solving this required either massive datasets of manually labeled image pairs or specialized self-supervised "contrastive" learning. The authors of this paper ask a provocative question: Do generative models, which are trained simply to create images, implicitly learn these correspondences as a byproduct of their training?
The DIFT Extraction Strategy
The authors propose a surprisingly simple extraction strategy to answer this question. They use off-the-shelf, pre-trained diffusion models (such as Stable Diffusion) and treat the internal activations of the model’s U-Net architecture as feature descriptors.
The core "trick" lies in handling the noise. Because diffusion models are trained to de-noise images, they expect noisy inputs. To extract features from a real image, the authors follow a three-step process:
- Add Noise: They perform a single step of the forward diffusion process to move the real image into the "noisy" distribution that the model understands.
- Extract Activations: They pass this noisy image through the U-Net and capture the intermediate feature maps.
- Match: To find a correspondence between two images, they simply compare these extracted feature vectors using a standard nearest-neighbor search (cosine similarity).
Crucially, this method requires zero fine-tuning and zero supervision. The ability to match features is a purely "emergent" property of the pre-trained generative model.
Key Insights: Why Does Diffusion Work So Well?
- The "Editing" Intuition: The authors argue that to perform complex generative tasks—like "turn this dog into a cat while keeping the pose"—a model must implicitly know where the dog's constituent parts are. This intuition led them to look for correspondence inside the U-Net.
- The Role of Time ($t$): In diffusion models, the timestep $t$ represents the noise level. The authors discovered a beautiful hierarchy: larger $t$ (more noise) yields high-level semantic features (e.g., matching a wing to a wing across different bird species), while smaller $t$ (less noise) yields low-level geometric features (e.g., matching a specific corner or texture).
- Generative vs. Contrastive: Unlike models like DINO, which are trained to see images as global "blobs" of similarity, diffusion models are trained to reconstruct images pixel-by-pixel. This fundamental difference leads to much more precise, "dense" features that are vastly superior for fine-grained matching.
- Cross-Domain Mastery: Because Stable Diffusion has seen everything from oil paintings to sketches during its massive pre-training phase, DIFT can match a photo of a cat to a cartoon of a cat far better than models trained exclusively on natural photos.
Performance and Results
The researchers evaluated DIFT across a wide variety of tasks and benchmarks, yielding impressive results:
- Semantic Correspondence: On the challenging SPair-71k benchmark (focused on matching different instances of a category), DIFT from Stable Diffusion outperformed DINO by 19 accuracy points and OpenCLIP by 14 points. It even beat state-of-the-art supervised models on 9 out of 18 categories.
- Zero-Shot Video Tracking: Despite never seeing a video during training, DIFT outperformed models specifically trained on video data for label propagation tasks on the DAVIS-2017 dataset.
- Geometric Precision: On the HPatches dataset, DIFT achieved results competitive with specialized geometric descriptors like SuperPoint, despite having no explicit geometric training.
Limitations and Future Directions
While powerful, DIFT is not without its drawbacks. Extracting these features requires a pass through a large U-Net, which is computationally heavier and slower than using a lightweight Vision Transformer (ViT) backbone like DINO. Additionally, because the method involves adding random noise, the resulting features can vary slightly. The authors mitigate this stochasticity by averaging features from multiple noisy versions, but this further increases the computational cost.
Finally, for text-conditioned models like Stable Diffusion, the features are slightly influenced by the text prompt used. While a generic prompt like "a photo of a [class]" works well, future work could explore more optimal ways to "prompt" the model for even better feature extraction, or investigate sophisticated methods to fuse information across the entire diffusion process rather than relying on a single layer and timestep.
Summary updated