When Better Features Mean Greater Risks: The Performance-Privacy Trade-Off in Contrastive Learning

Ruining Sun, Hongsheng Hu, Wei Luo, Zhaoxi Zhang, Yanjun Zhang, Haizhuan Yuan, Leo Yu ZhangAsiaCCS 2025 · DOI

TL;DR

This paper investigates the trade-off between model performance and privacy in contrastive learning frameworks. They demonstrate that as contrastive learning models become more sophisticated, leading to better feature extraction, they also become more vulnerable to membership inference attacks. To address this, they propose LpLA, a novel and efficient attack method that leverages the statistical distribution of feature vector magnitudes.

What Problem Does This Paper Address?

Deep learning models, particularly those trained using self-supervised learning (SSL) methods like contrastive learning, have shown remarkable success in extracting powerful features from unlabeled data. These pre-trained encoders are crucial for various downstream tasks. However, this advancement raises significant privacy concerns. A key threat is Membership Inference Attacks (MIAs), where an adversary tries to determine if a specific data point was part of the model's training set. While MIAs have been studied for classification models, their effectiveness and mechanisms in contrastive learning encoders are less understood. This paper aims to systematically evaluate this performance-privacy trade-off and propose a new attack method tailored for these models.

Methods

The authors propose an evaluation framework with two main components:

  1. Utility Measurement: This part assesses the encoder's performance on downstream tasks, using K-NN clustering accuracy as a proxy for feature extraction capability.
  2. Privacy Measurement: This part uses various membership inference attack methods to quantify the privacy leakage risk of the encoder.

They benchmark existing MIA methods like EncoderMI, SD-MI, and Feature-based MI (Fe-MI). The core novelty lies in their proposed attack, the Embedding Lp-Norm Likelihood Attack (LpLA). LpLA operates in three stages:

  1. Feature Extraction: Collects feature vectors for known member and randomly generated non-member samples.
  2. Likelihood Estimation: Assumes the p-norm (magnitude) of feature vectors for members and non-members follows distinct Gaussian distributions and estimates their parameters.
  3. Membership Inference: Uses Bayes' theorem to calculate the posterior probability of a sample belonging to the training set based on its p-norm value.

Datasets

The experiments were conducted using three commonly used datasets for MIA research:

  • CIFAR-10: 10 classes, 32x32 images.
  • CIFAR-100: 100 classes, 32x32 images.
  • Tiny-ImageNet: 200 classes, 64x64 images.

The authors used a portion of these datasets for training the target models and for constructing attack datasets, with separate sets for testing.

Key Insights and Ideas

  • Performance-Privacy Trade-off is Real: As contrastive learning frameworks and backbone architectures become more complex and improve feature extraction (higher utility), they simultaneously increase the risk of privacy leakage.
  • Feature Vectors Hold Rich Information: Contrary to some prior assumptions that feature vectors from encoders lack direct semantic information, this study shows they contain sufficient information for effective MIAs, even without complex transformations.
  • Magnitude Matters: The magnitude (p-norm) of feature vectors exhibits a significant difference between samples that were part of the training set and those that were not. This difference is a strong signal for membership inference.
  • LpLA's Efficiency: The proposed LpLA attack bypasses the need for training complex binary classifiers, making it computationally lighter and requiring fewer samples and queries compared to existing methods.

Key Results

  • Increased Complexity, Increased Risk: Across different MoCo versions (v1 to v3) and backbone architectures (ResNet, ViT), increasing model sophistication consistently led to higher membership inference accuracy for all tested attacks. For instance, with MoCo-v3, MIA accuracy significantly increased compared to MoCo-v1.
  • Fe-MI's Competitiveness: The Feature-based MI (Fe-MI) attack, which directly uses feature vectors, performed comparably to or even better than similarity-based attacks in many scenarios, especially with MoCo-v3.
  • LpLA's Effectiveness: LpLA achieved competitive attack performance, often matching or exceeding existing methods, particularly in more advanced MoCo frameworks (v2 and v3).
  • Robustness Under Constraints: LpLA demonstrated superior robustness compared to other attacks when the adversary had limited ground-truth member samples or a restricted number of API queries. For example, in scenarios with limited queries, LpLA maintained effective attack performance while others faltered.
  • Optimal p-norm: The study found that the L2-norm (Euclidean distance) generally provided the best results for LpLA, though other norms also showed effectiveness. L0-norm was suboptimal.

Limitations and Future Work

The authors acknowledge the following limitations:

  • Defense Mechanisms: The resilience of LpLA against existing defense mechanisms like differential privacy or adversarial regularization was not examined.
  • Domain Specificity: Experiments were limited to image datasets. The applicability of LpLA to text or audio modalities remains to be explored.

Future work suggested includes investigating the impact of defenses on the performance-privacy trade-off and extending the research to other data modalities.

Summary updated

BibTeX
@inproceedings{sun2025when,
  author = {Ruining Sun and Hongsheng Hu and Wei Luo and Zhaoxi Zhang and Yanjun Zhang and Haizhuan Yuan and Leo Yu Zhang},
  title = {{When Better Features Mean Greater Risks: The Performance-Privacy Trade-Off in Contrastive Learning}},
  booktitle = {AsiaCCS},
  year = {2025},
  doi = {10.1145/3708821.3733915},
}
Figure