Alignment Calibration: Machine Unlearning for Contrastive Learning under Auditing

Yihan Wang, Yiwei Lu, Guojun Zhang, Franziska Boenisch, Adam Dziedzic, Yaoliang Yu, Xiao-Shan Gao

TL;DR

Contrastive learning powers modern foundation encoders like CLIP and MoCo, but removing unauthorized training data from these models without retraining from scratch remains an open challenge. This paper establishes the Machine Unlearning for Contrastive Learning (MUC) framework and introduces Alignment Calibration (AC), a method that accurately approximates full model retraining in minutes while giving data owners reliable, visual black-box auditing tools to verify that their data was erased.

What Problem Does This Paper Address?

Large self-supervised and multimodal models (e.g., SimCLR, MoCo, CLIP) rely heavily on web-scraped data, which frequently captures copyrighted assets, private personal information, or illicit imagery. When data owners demand data removal, model owners cannot easily retrain from scratch due to massive compute costs.

While machine unlearning is studied in supervised classification and generative models, contrastive representation learning presents two distinct obstacles:

  1. Poor baseline approximations: Standard unlearning heuristics (e.g., fine-tuning, gradient ascent, weight sparsity) struggle to emulate retrained contrastive encoders.
  2. The auditing dilemma: Individual data owners only have black-box query access to encoder embeddings. The conventional metric for verification—the Forgetting Score (FS), which measures drop in positive pair similarity—suffers from extreme variance. For example, exact retraining on MoCo yields a mean FS of $\mu = 0.025$ with a standard deviation of $\sigma = 0.081$ ($3.24\times \mu$). An individual auditing just a few samples will frequently see zero or negative forgetting, leading them to falsely believe their data was never deleted.

Methods

The authors introduce Alignment Calibration (AC) to optimize unlearning from both the model owner's and data owner's perspectives:

  • Positive Alignment Calibration: To induce targeted forgetting on the unlearn set ($\mathcal{D}_\text{unlearn}$), AC explicitly minimizes the cosine similarity between positive pairs (different augmentations or matched text-image pairs).
  • Negative Alignment Calibration: To make unlearning easily auditable for black-box users, AC increases the similarity across negative pairs within the unlearn set. This magnifies representational shifts without corrupting the broader latent space.
  • Performance Preserving Term: To prevent representation collapse and retain downstream accuracy on $\mathcal{D}_\text{retain}$, AC preserves the contrastive denominator (the log-sum-exp term over the full data distribution).

$$\mathcal{L} := -\alpha \mathbb{E}_{p_u^\times}[s(x^g, y^g)] + \beta \mathbb{E}_{p_u^+}[s(x^g, y^g)] + \gamma \mathbb{E}_{p_u}\left[\log \mathbb{E}_{p_d}[\exp(s(x^g, y^g))]\right]$$

  • Visual Auditing Matrices: Data owners construct an Alignment Matrix (AM) and Alignment Gap Matrix (AGM) ($AM_\text{pre} - AM_\text{post}$) on their batch of samples. Instead of relying on a single noisy scalar, users inspect heatmaps where unlearning is clearly visible across diagonal (positive) and off-diagonal (negative) elements.

Datasets

The authors evaluated MUC on unimodal and multimodal benchmarks:

  • CIFAR-10 & CIFAR-100: Evaluated with SimCLR and MoCo (ResNet-18 backbone) under 10% and 50% random training data removal settings.
  • MS-COCO: 118,287 images and 591,753 paired captions, evaluated using CLIP with 10% of image-text pairs randomly removed.

Key Insights and Ideas

  • Retraining has an auditing flaw: Exact retraining—the theoretical gold standard of unlearning—is inherently noisy at the sample level. Building unlearning objectives that account for auditing reliability is just as important as matching parameter distributions.
  • Negative pairs are the missing lever: Standard contrastive loss pulls positives together and pushes negatives apart. By intentionally reversing positive alignment and adjusting negative alignment among unlearned samples, AC produces clear visual contrast in representation matrices without degrading downstream linear probing accuracy.

Key Results

  • Closest Approximation to Retraining: On CIFAR-10 with MoCo (10% unlearn), AC achieved an average performance gap across 5 evaluation metrics (EMIA, RA, TA, UA, CMIA) of only 0.92% relative to retraining from scratch, outperforming NegGrad (1.53%), Fine-Tuning (1.74%), and Gradient Ascent (2.57%).
  • Massive Speedups: Retraining MoCo on CIFAR-10 required 109.5 minutes, whereas AC required just 1.87 minutes (~58× faster).
  • Multimodal Scalability: On MS-COCO with CLIP, AC achieved the lowest average cosine similarity gap to retraining (1.56% vs. 2.28% for NegGrad and 4.35% for Fine-Tuning).
  • Auditing Verification: On small subsets (e.g., 8 images), AGM heatmaps generated by AC showed clear, unambiguous visual contrast patterns, whereas baselines produced negligible shifts.

Limitations and Future Work

  • Scope of Unlearning: The work focuses entirely on unlearning during the self-supervised pre-training phase, assessing downstream performance via frozen-feature linear probing. Full fine-tuning downstream workflows remain unexplored.
  • Hyperparameter Sensitivity: The calibration weights ($\alpha, \beta, \gamma$) require tuning based on the unlearning fraction (e.g., 10% vs. 50%).
  • Model Scale: Experiments were constrained to lightweight backbones (ResNet-18) and medium-scale multimodal models; assessing billion-parameter vision-language foundation models is an open direction.

Summary updated

BibTeX
@article{wang2025alignment,
  author = {Yihan Wang and Yiwei Lu and Guojun Zhang and Franziska Boenisch and Adam Dziedzic and Yaoliang Yu and Xiao-Shan Gao},
  title = {{Alignment Calibration: Machine Unlearning for Contrastive Learning under Auditing}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=F9pjSDvuM9},
}
Figure