Table of Contents
Fetching ...

High Fidelity Visualization of What Your Self-Supervised Representation Knows About

Florian Bordes, Randall Balestriero, Pascal Vincent

TL;DR

SSL representations are difficult to interpret beyond downstream tasks; this work introduces Representation-Conditioned Diffusion Model (RCDM) to visualize SSL representations in data space by generating high-fidelity, representation-faithful images. The study compares backbone versus projector representations, revealing nuanced invariances, robustness to perturbations, and latent structure enabling targeted image manipulation. It demonstrates RCDM across in-distribution, OOD conditioning, and interpolation, highlighting differences between SSL and supervised representations. This approach provides a practical, qualitative tool to augment quantitative SSL evaluations and to better understand what information SSL models retain.

Abstract

Discovering what is learned by neural networks remains a challenge. In self-supervised learning, classification is the most common task used to evaluate how good a representation is. However, relying only on such downstream task can limit our understanding of what information is retained in the representation of a given input. In this work, we showcase the use of a Representation Conditional Diffusion Model (RCDM) to visualize in data space the representations learned by self-supervised models. The use of RCDM is motivated by its ability to generate high-quality samples -- on par with state-of-the-art generative models -- while ensuring that the representations of those samples are faithful i.e. close to the one used for conditioning. By using RCDM to analyze self-supervised models, we are able to clearly show visually that i) SSL (backbone) representation are not invariant to the data augmentations they were trained with -- thus debunking an often restated but mistaken belief; ii) SSL post-projector embeddings appear indeed invariant to these data augmentation, along with many other data symmetries; iii) SSL representations appear more robust to small adversarial perturbation of their inputs than representations trained in a supervised manner; and iv) that SSL-trained representations exhibit an inherent structure that can be explored thanks to RCDM visualization and enables image manipulation.

High Fidelity Visualization of What Your Self-Supervised Representation Knows About

TL;DR

SSL representations are difficult to interpret beyond downstream tasks; this work introduces Representation-Conditioned Diffusion Model (RCDM) to visualize SSL representations in data space by generating high-fidelity, representation-faithful images. The study compares backbone versus projector representations, revealing nuanced invariances, robustness to perturbations, and latent structure enabling targeted image manipulation. It demonstrates RCDM across in-distribution, OOD conditioning, and interpolation, highlighting differences between SSL and supervised representations. This approach provides a practical, qualitative tool to augment quantitative SSL evaluations and to better understand what information SSL models retain.

Abstract

Discovering what is learned by neural networks remains a challenge. In self-supervised learning, classification is the most common task used to evaluate how good a representation is. However, relying only on such downstream task can limit our understanding of what information is retained in the representation of a given input. In this work, we showcase the use of a Representation Conditional Diffusion Model (RCDM) to visualize in data space the representations learned by self-supervised models. The use of RCDM is motivated by its ability to generate high-quality samples -- on par with state-of-the-art generative models -- while ensuring that the representations of those samples are faithful i.e. close to the one used for conditioning. By using RCDM to analyze self-supervised models, we are able to clearly show visually that i) SSL (backbone) representation are not invariant to the data augmentations they were trained with -- thus debunking an often restated but mistaken belief; ii) SSL post-projector embeddings appear indeed invariant to these data augmentation, along with many other data symmetries; iii) SSL representations appear more robust to small adversarial perturbation of their inputs than representations trained in a supervised manner; and iv) that SSL-trained representations exhibit an inherent structure that can be explored thanks to RCDM visualization and enables image manipulation.
Paper Structure (21 sections, 1 equation, 43 figures, 1 table)

This paper contains 21 sections, 1 equation, 43 figures, 1 table.

Figures (43)

  • Figure 1: a) In-distribution conditional image generation. An image from ImageNet validation set (first column) is used to compute the representation output by a trained SSL model (Dino backbone). The representation is used as conditioning for the diffusion model. Resulting samples are shown in the subsequent columns (see Fig. \ref{['fig:samples_256']}). We observe that our conditional diffusion model produces samples that are very close to the original image. b) Out of distribution (OOD) conditioning. How well does RCDM generalize when conditioned on representations given by images from a different distribution? (here a WikiMedia Commons image, see Fig. \ref{['fig:samples_256_ood']} for more). Even with an OOD conditioning, the images produced by RCDM match some characteristics of the original image (which highlights that RCDM is not merely overfitting on ImageNet). c) Interpolation between two images from ImageNet validation data. We apply a linear interpolation between the SSL representation of the images in the first column and the representation of the images in the last column. We use the interpolated vector as conditioning for our model, that produces the samples that are showed in columns 2 to 6. Fig. \ref{['fig:dog_cup']} in appendix shows more sampled interpolation paths.
  • Figure 2: What is encoded inside various representations? First to fourth rows show RCDM samples conditioned on the usual resnet50 backbone representation (size 2048) while fifth to eigth rows show samples conditionned on the projector/head representation of various ssl models. (Note that a separate RCDM generative model was trained specifically for each representation). Common/stable aspects among a set of generated images reveal what is encoded in the conditioning representation. Aspects that vary show what is not encoded in the representation. We clearly see that the projector representation only keeps global information and not its context, contrary to the backbone representation. This indicates that invariances in SSL models are mostly achieved in the projector representation, not the backbone. Furthermore, it also confirms the linear classification results of Table a) which show that backbone representation are better for classifications since they contain more information about an input than the ones at the projector level. Additional comparisons provided in Fig. \ref{['fig:samples_things_in_water']}.
  • Figure 3: Using our conditional generative model to gain insight about the invariance (or covariance) of representations with respect to several data augmentations. On an original image (top left) we apply specific transformations (visible in the first column). For each transformed image, we compute the 2048-dimensional representation of a ResNet50 backbone trained with either Dino, SimCLR, or a fully supervised training. We then condition their corresponding RCDM on that representation to sample 3 images. We see that despite their invariant training criteria, the 2048 dimensional SSL representations appear to retain information on object scale, grayscale vs color, and color palette of the background, much like the supervised-trained representation. They do appear insensitive to vertical shifts. We also see that supervised representation constrain the appearance much less. Refer to Fig. \ref{['fig:compare_chickens']} in Appendix for a comparison with using the lower dimensional projector-head embedding as the conditioning representation.
  • Figure 4: Using RCDM to visualize the robustness of differently-trained representations to adversarial attacks. We use Fast Gradient Sign to attack a given image (top-left corner) on different models with various values for the attack coefficient epsilon. In the first row, we only show the adversarial images obtained from a supervised encoder: refer to Fig. \ref{['fig:manip_adv']} in the Appendix to see the (similar looking) adversarial examples obtained for each model. In the following rows we show, for differently trained models, the RCDM "stochastic reconstructions" of the adversarially attacked images, from their ResNet-50 backbone representation. For an adversarial attack on a purely supervised model (second row), RCDM reconstructs an animal that belongs to another class, a lion in this case. Third and forth rows show what we obtain with ResNet50 that was pretrained with SimCLR or Swav in SSL fasion, with only their linear softmax output layer trained in a supervised manner. In contrast to the supervised model, with the SSL-trained models, RCDM stably reconstructs dogs from the representation of adversarially attacked inputs, even with quite larger values for epsilon. Images classified incorrectly by a trained linear probe are highlight with a red square.
  • Figure 5: Visualization of direct manipulations in the representation space of a ResNet-50 backbone trained with SimCLR. In this experiment, we find the most common non-zero dimensions among the neighborhood (in representation space) of the image used as conditioning (top-left clothed dog). In the second row, we set these dimensions to zero and use RCDM to decode the thus masked representation. We see that RCDM produces a variety of clothes (but no dog): all information about the background and the dog has been removed. In the third and forth row, instead of setting these dimensions to zero, we set them to the value they have in the representation of the unclothed-dog image on the left. As we can see, the generated dog gets various clothes which were not present in the original image. Additional examples provided in Figure \ref{['fig:manip_ssl_background']}, \ref{['fig:manip_ssl_inv_background']}.
  • ...and 38 more figures