Reconstructing Training Data From Real World Models Trained with Transfer Learning

Yakir Oz, Gilad Yehudai, Gal Vardi, Itai Antebi, Michal Irani, Niv Haim · DOI

Recent research has significantly escalated the threat landscape for privacy in machine learning. While previous studies demonstrated that "toy" models trained on low-resolution datasets could leak training data, a new paper appearing on arXiv reveals that this vulnerability extends to high-resolution, real-world models trained via transfer learning. This work shatters the common assumption that freezing a foundation model's backbone provides a layer of privacy for sensitive downstream data.

The Transfer Learning Privacy Fallacy

Modern AI development rarely starts from scratch. Instead, developers typically employ Transfer Learning: they take a massive "Foundation Model" (such as CLIP or DINO), freeze its weights, and train a small "head" (usually a few fully connected layers) on a specific, often private, dataset.

The prevailing belief was that this setup protected the training samples because an adversary only has access to the weights of the small "head," not the complex internal representations of the backbone. However, this research demonstrates that the head contains sufficient information to reconstruct the high-resolution inputs fed into the backbone.

Overview of the transfer learning training process (a) and the proposed training-data reconstruction pipeline (b).

Breaking the Black Box: The Three-Stage Attack

The researchers developed a sophisticated three-stage pipeline to perform these reconstructions without any prior knowledge of the original dataset:

  1. Reconstructing Embeddings: By leveraging the "implicit bias" of gradient flow, the authors treat the model weights as an optimization problem. They generate thousands of candidate embedding vectors that could have produced the observed weights $\theta$. This exploits the fact that parameters in a model trained with cross-entropy loss converge toward a weighted sum of the gradients of the training samples.
  2. Mapping to Image Space (Inversion): Once candidate embeddings (feature vectors) are obtained, they must be converted back into images. For DINO-based models, the authors used a Deep Image Prior (DIP) approach, optimizing a separate network to produce an image whose embedding matches the candidate. They found that using cosine similarity as a loss function was critical for success, as reconstructed embeddings often differ in scale from the originals. For CLIP, they utilized a diffusion-based decoder (UnCLIP).
  3. Clustering for Identification: A major challenge in previous attacks was the need for the original data to identify "good" reconstructions among thousands of candidates. The authors introduced a clustering-based method, discovering that successful reconstructions naturally cluster together in the embedding space. By inverting only the centers of the largest clusters, they can perform a "blind" attack.

Empirical Evidence Across Foundation Models

The study moved beyond simple benchmarks to realistic, high-resolution (224x224) datasets: Food-101 and iNaturalist. The attack was tested against several popular backbones, including ViT, DINO-ViT, DINOv2, and CLIP.

Reconstruction results across different foundation models and datasets. For each pair, the top row (red border) shows the original images and the bottom row shows the reconstructions.

As shown in the results, the authors successfully recovered recognizable, high-fidelity images across all tested architectures. While some backbones like DINOv2 proved more difficult to invert than others, the underlying vulnerability remained consistent.

Key Insights and Implications

  • Reconstructability vs. Generalization: The authors found that vulnerability to reconstruction is not a symptom of overfitting. Models become susceptible very early in the training process, often before reaching peak test accuracy.
  • Scaling Laws: While reconstruction improves as the ratio of parameters to samples increases, the attack remains effective even for datasets containing up to 2,000 samples.
  • Efficiency: The clustering method is a "game-changer," reducing the number of required (and computationally expensive) image inversions by two orders of magnitude.
  • Limitations and Defenses: The attack struggles against "Linear Probing" (training only a single linear layer) due to the limited parameter count. While weight decay offers some resistance, it does not prevent reconstruction entirely and can negatively impact model performance.

Conclusion

This work demonstrates that transfer learning, despite its efficiency and popularity, does not inherently provide data privacy. The "head" of a model acts as a significant leak, allowing for the high-fidelity reconstruction of sensitive training data. As foundation models become the bedrock of AI development, creating backbones that are inherently "hard to invert" without losing representational power remains a critical area for future research.

Summary updated

BibTeX
@misc{oz2024reconstructing,
  author = {Yakir Oz and Gilad Yehudai and Gal Vardi and Itai Antebi and Michal Irani and Niv Haim},
  title = {{Reconstructing Training Data From Real World Models Trained with Transfer Learning}},
  year = {2024},
  eprint = {2407.15845},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.15845},
}
Figure