Abstract
Traditional machine learning often views memorization as a symptom of overfitting. However, in the context of Self-Supervised Learning (SSL), the role of memorization has remained poorly understood due to the lack of labels. This paper introduces SSLMem, a formal framework to quantify memorization in SSL. Our findings suggest that memorizing atypical data points is not a failure of the model, but a critical component for achieving high performance on downstream tasks.
Introduction
Self-Supervised Learning (SSL) has revolutionized representation learning by leveraging vast amounts of unlabeled data. By learning to align different augmentations (views) of the same image, SSL models develop robust features. Despite their success, a fundamental question persists: do these models memorize their training data, and if so, does it help or hinder generalization? In supervised learning, memorization is often linked to privacy leaks and overfitting on outliers. In SSL, the lack of ground-truth labels makes traditional memorization metrics inapplicable, leaving a gap in our understanding of how these models learn.
The SSLMem Framework
To address this, we propose SSLMem, which defines memorization through the lens of representation alignment. The core idea is that if a model has memorized a specific image $x$, it should be significantly better at aligning two different augmentations of $x$ (e.g., a crop and a color jitter) than a model that never saw $x$ during training.
The memorization score is calculated using a leave-one-out approach:
- Train an encoder $f$ on a dataset $D$ containing $x$.
- Train an encoder $g$ on $D \setminus \{x\}$.
- The score is the difference in alignment performance for $x$ between $f$ and $g$.
To scale this to large datasets, we approximate the leave-one-out process by partitioning the training data into disjoint subsets.
Key Insights: The Role of Atypicality
Our analysis reveals that SSL models primarily memorize "atypical" examples—data points that are outliers or possess unusual features within their class distribution.
As shown in Figure 1, examples with high SSLMem scores are often distorted or oddly shaped, making them "hard" for the model to align unless they are explicitly encountered during training. Interestingly, while standard training metrics might plateau, SSLMem scores continue to rise, indicating that the model spends its final training stages refining its understanding of these long-tail examples.
Memorization as a Driver for Generalization
The most significant finding of this work is that memorization is functionally beneficial. We tested this by removing the top 10% of most-memorized samples from the training set. This led to a substantial drop in performance on downstream tasks like semantic segmentation and depth estimation—far greater than the drop caused by removing 10% of samples at random.
This suggests that the features learned by memorizing "hard" cases (like those in Figure 3) are crucial for the model's ability to generalize to new, unseen distributions.
Results and Trade-offs
- Algorithm Comparison: High-performing SSL methods like DINO and SimCLR exhibit higher average memorization scores than Masked Autoencoders (MAE). For instance, on CIFAR-10, SimCLR achieved a score of ~0.339 (77.12% accuracy) compared to MAE's ~0.307 (67.40% accuracy).
- Privacy vs. Utility: We found a stark trade-off when applying Differential Privacy (DP-SGD). While DP-SGD successfully reduced memorization scores (from 0.307 to 0.107), it caused a catastrophic drop in utility, with accuracy falling from ~69% to ~33%. This confirms that the very mechanism that enables generalization—memorizing atypical data—is what privacy techniques aim to suppress.
Conclusion
SSLMem provides the first formal tool to quantify memorization in label-free environments. Our results challenge the conventional wisdom that memorization is purely detrimental. Instead, in self-supervised regimes, memorizing the "long tail" of the data distribution is essential for building representations that generalize effectively to downstream tasks. Future research must focus on balancing this utility with the inherent privacy risks of data memorization.
Summary updated