Do SSL Models Have Déjà Vu? A Case of Unintended Memorization in Self-supervised Learning

Casey Meehan, Florian Bordes, Pascal Vincent, Kamalika Chaudhuri, Chuan Guo

Introduction

Self-supervised learning (SSL) has revolutionized computer vision by enabling models to learn from vast amounts of unlabeled data. By finding associations between different parts of the same image—such as a patch of grass belonging with a cow—these models develop robust visual representations. However, recent research reveals a concerning phenomenon: instead of learning general visual concepts (e.g., "grass is often near cows"), SSL models often "memorize" specific training samples. This phenomenon, termed déjà vu memorization, occurs when a model can recall and visually reconstruct a specific foreground object based solely on a background patch (like sky or water) from a training image.

The Problem: Privacy and Evaluation Gaps

Unintended memorization in SSL presents two primary challenges:

  1. Privacy Risks: If a model memorizes a specific individual's face in association with a unique background, an adversary could potentially extract private information from the model's internal representations.
  2. The Evaluation Gap: Standard performance metrics, such as linear probing, often fail to detect this form of overfitting. This leads to a false sense of security regarding a model's generalization capabilities, as researchers may believe their models are learning general features when they are actually relying on specific sample recall.

Methodology: Distinguishing Correlation from Memorization

To quantify this effect, the researchers developed a systematic framework to distinguish between general correlation (knowledge shared across models) and specific memorization (knowledge unique to the training set).

The Target vs. Reference Setup

The researchers split a dataset into two disjoint sets, A and B. They then trained two separate models: $SSL_A$ (the target) and $SSL_B$ (the reference).

The Periphery Crop Test

To test for memorization, the team extracted a "periphery crop"—a background patch containing none of the foreground object—from an image in set A. This patch was fed into both models. If $SSL_A$ could identify the missing foreground object while $SSL_B$ could not, the information was deemed to be memorized by $SSL_A$ during training.

Visual Reconstruction (RCDM)

To provide visual proof, the researchers utilized a conditional generative model (RCDM) to decode the models' internal embeddings back into images. This allowed them to see exactly what the model "recalled" when presented with a blank background patch.

Key Insights

The Invisible Overfit

Perhaps the most surprising finding is that as SSL models train for more epochs (up to 1000), their "déjà vu score" continues to climb. Even while standard test performance remains stable or improves, the model becomes increasingly "leaky," memorizing more specific training samples over time.

Algorithm Sensitivity

Not all SSL objectives are equally prone to memorization. The study found that non-contrastive methods, such as VICReg and Barlow Twins, are significantly more susceptible to déjà vu memorization than contrastive methods like SimCLR or BYOL. Furthermore, while "guillotine regularization" (removing the final projector layers) reduces memorization, the model's backbone still retains significant specific image data.

Scale and Specificity

Larger models with more parameters exhibit higher levels of memorization, suggesting that privacy risks may grow as the industry scales toward larger foundation models. Additionally, the reconstructions are remarkably specific; for instance, a model might correctly reconstruct a specific subspecies of animal (e.g., an American Badger vs. a European Badger) based only on the background of the original training image.

Key Results

  • Quantifiable Risk: For VICReg, at least 10% of the training set was found to be explicitly memorized.
  • Adversarial Success: Using a simple confidence heuristic, an adversary can identify memorized samples with nearly 95% accuracy.
  • Model Size Correlation: There is a direct correlation between model capacity and the degree of unintended memorization.

Limitations and Future Work

While the study proves the existence of déjà vu memorization, the underlying mathematical reason why certain SSL objectives (like those with specific invariance loss $\lambda$) are more prone to it remains a subject for future study. Current mitigation strategies often involve a trade-off between privacy and downstream performance. The next challenge for the field is developing "privacy-preserving" SSL objectives that maintain high accuracy without sacrificing data security. Additionally, further research is needed to characterize which types of images—such as rare or high-contrast samples—are most vulnerable to being memorized.

Summary updated

BibTeX
@inproceedings{meehan2023do,
  author = {Casey Meehan and Florian Bordes and Pascal Vincent and Kamalika Chaudhuri and Chuan Guo},
  title = {{Do SSL Models Have Déjà Vu? A Case of Unintended Memorization in Self-supervised Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=lkBygTc0SI},
}
Figure