Reconstructing Training Data From Real-World Models Trained with Transfer Learning

## Abstract

Abstract Current methods for reconstructing training data from trained classifiers are restricted to very small models, limited training set sizes, and low-resolution images. Such restrictions hinder their applicability to real-world scenarios. In this paper, we present a novel approach enabling data reconstruction in realistic settings for models trained on high-resolution images. Our method adapts the reconstruction scheme of Haim et al. ( 2022 ) to real-world scenarios – specifically, targeting models trained via transfer learning over image embeddings of large pre-trained models like DINO-ViT and CLIP. Our work employs data reconstruction in the embedding space rather than in the image space, showcasing its applicability beyond visual data. Moreover, we introduce a novel clustering-based method to identify good reconstructions from thousands of candidates. This significantly improves on previous works that relied on knowledge of the training set to identify good reconstructed images. Our findings shed light on a potential privacy risk for data leakage from models trained using transfer learning.

### 1 Introduction

Understanding when training data can be reconstructed from trained neural networks is an intriguing question that attracted significant interest in recent years. Successful reconstruction of training samples has been demonstrated for both generative models (Carlini et al., , ) and classification settings (Haim et al., ). Exploring this question may help understand the extent to which neural networks memorize training data and their vulnerability to privacy attacks and data leakage.

Existing results on training data reconstruction from neural network classifiers focus on restricted and unrealistic settings. These methods require very small training datasets, which strongly limit their ability to generalize. Additionally, they are constrained to low-resolution images, such as CIFAR or MNIST images, and simple models like multilayered perceptrons (MLPs) or small CNNs.

We aim to overcome these limitations in a transfer-learning setting. Transfer Learning leverages knowledge gained from solving one problem to address a related problem, often by transferring learned representations from large pre-trained models (known as *Foundation Models*) to tasks with limited training data. In the context of deep learning, transfer learning is commonly implemented by fine-tuning the final layers of pre-trained models or training small MLPs on their output embeddings, known as deep features (Oquab et al., ).
This approach often achieves
high generalization even for learning tasks with small training sets, while also requiring less computing power. Thus, transfer learning is very common in practice.

In this work, we demonstrate reconstruction of training samples in more realistic scenarios. Specifically, we reconstruct high-resolution images from models that achieve good test performance, within a transfer learning framework. Our approach involves training an MLP on the embeddings of common pre-trained transformer-based foundation models, such as CLIP (Radford et al., ) or DINO-ViT (Caron et al., ) (see Fig. 1). Our findings have implications for privacy, particularly when transfer learning is being used on sensitive training data, such as medical data. Consequently, preventing data leakage in transfer learning necessitates the development of appropriate defenses.

Additionally, our work addresses a key limitation of prior reconstruction works: their reliance on training images for identifying good reconstructions from thousands of candidates.
While this approach demonstrated that training images are embedded within the model’s parameters, it’s unrealistic for attackers to have access to the training data. To overcome this, we introduce a novel clustering-based approach to effectively identify reconstructed training samples, eliminating the need for prior knowledge of the training set. This marks a significant step towards establishing reconstruction techniques as real-world privacy attacks.

Our Contributions:

- •
We demonstrate reconstruction of high-resolution training images from models trained in a transfer learning approach, a significant advancement from previous reconstruction methods that were limited to small images and models with low generalization.
- •
We demonstrate, for the first time, reconstruction of non-visual data (feature vectors of intermediate layers).
- •
We introduce a novel clustering-based approach for effectively identifying training samples without a-priori knowledge of training images, a significant step towards a more realistic privacy attack.

Figure: Figure 1: Reconstructed Data from a binary classifier trained on $100$ DINO-VIT embeddings
Refer to caption: x1.png

### 2 Prior Work

##### Data Reconstruction Attacks.

Reconstruction attacks attempt to recover the data samples on which a model is trained, posing a serious threat to privacy. Earlier examples of such attacks include activation maximization (model-inversion) (Fredrikson et al., ; Yang et al., ), although they are limited to only a few training samples in each class. Reconstruction in a federated learning setup (Zhu et al., ; He et al., ; Hitaj et al., ; Geiping et al., ; Huang et al., ; Wen et al., ) where the attacker assumes knowledge of samples’ gradients. Other works studied reconstruction attacks on generative models like LLMs (Carlini et al., , ; Nasr et al., ) and diffusion-based image generators (Somepalli et al., ; Carlini et al., ). Our work is based on the reconstruction method from Haim et al. (), which relies only on knowledge of the parameters of the trained model, and is based on theoretical results of the implicit bias in neural networks (Lyu and Li, ; Ji and Telgarsky, ). This work was generalized to multi-class setting (Buzaglo et al., ) and to the NTK regime (Loo et al., ).

##### Transfer Learning.

Deep transfer learning, a common technique across various tasks (see surveys: (Tan et al., ; Zhuang et al., ; Iman et al., )), leverages pre-trained models from large datasets to address challenges faced by smaller, domain-specific datasets (e.g., in the medical domain (Kim et al., )). While convolutional neural networks (CNNs) have been the go-to approach for transfer learning (Oquab et al., ; Yosinski et al., ), recent research suggests that vision transformers (ViTs) may offer stronger learned representations for downstream tasks (Caron et al., ; He et al., ). For example, ViT (Dosovitskiy et al., ), pre-trained on ImageNet (Deng et al., ), provides robust general visual features.
Beyond supervised pre-training, self-supervised learning methods like DINO (Caron et al., ; Oquab et al., ) learn informative image representations without requiring labeled data, allowing the model to capture strong image features suitable for further downstream tasks. Additionally, CLIP (Radford et al., ) has emerged as a powerful technique, leveraging a massive dataset of paired text-image examples and contrastive loss to learn semantically meaningful image representations.

Figure: Figure 2: Overview of our training and data reconstruction scheme.
Refer to caption: x2.png

### 3 Method

Our goal is to reconstruct training samples (images) from a classifier that was trained on the corresponding embedding vectors of a large pre-trained model in a transfer learning manner.

The classifier training is illustrated in Fig. 2a. Formally, given an image classification task $D_{s}=\{(\mathbf{s}_{i},y_{i})\}_{i=1}^{n}\subseteq{\mathbb{R}}^{d_{s}}\times
\{1,\ldots,C\}$,
where $d_{s}$ is the dimension of the input image(^1^11Typically $d_{s}={3\times h\times w}$, where $h$ and $w$ are the height and width of the image, respectively.) and $C$ is the number of classes, we employ a large pre-trained model $\mathcal{F}:{\mathbb{R}}^{d_{s}}\to{\mathbb{R}}^{d}$ (e.g., DINO) to transfer each image $\mathbf{s}_{i}$ to its corresponding deep feature embedding $\mathbf{x}_{i}=\mathcal{F}(\mathbf{s}_{i})\in{\mathbb{R}}^{d}$, where $d$ is the dimension of the feature embedding vector (the output of $\mathcal{F}$). We then train a model $\phi(\cdot,{\bm{\theta}}):{\mathbb{R}}^{d}\to{\mathbb{R}}^{C}$ to classify the embedding dataset $D_{x}=(\mathbf{x}_{i},y_{i})_{i=1}^{n}\subseteq{\mathbb{R}}^{d}\times\{1,
\ldots,C\}$, where ${\bm{\theta}}\in{\mathbb{R}}^{p}$ is a vectorization of the trained parameters. Typically, $\phi$ is a single hidden-layer multilayer perceptron (MLP). Also note that $\mathcal{F}$ is kept fixed during the training of $\phi$. The overall trained image classifier is $\phi(\mathcal{F}(\mathbf{s}))$.

Our reconstruction approach is illustrated in Fig. 2b and presented in detail below. Given the trained classifier $\phi$ and the pre-trained model $\mathcal{F}$, our goal is to reconstruct training samples $\mathbf{s}_{i}$ from the training set $D_{s}$. The reconstruction scheme comprises two parts:

- 1.
Reconstructing embedding vectors from the training set of the classifier $\phi$.
- 2.
Mapping the reconstructed embedding vectors back into the image domain. Namely, computing $\mathcal{F}^{-1}$ (e.g., by “inverting” the pre-trained model $\mathcal{F}$).

#### 3.1 Reconstructing Embedding Vectors from ϕ italic-ϕ \phi italic_ϕ

Given a classifier $\phi:{\mathbb{R}}^{d}\to{\mathbb{R}}^{c}$ trained on an embedding training-set $D_{x}=\{(\mathbf{x}_{i},y_{i})\}_{i=1}^{n}$, we apply the reconstruction scheme of (Haim et al., ; Buzaglo et al., ) to obtain $\{\hat{\mathbf{x}}_{i}\}_{i=1}^{m}$, which are $m$ “candidates” for reconstructed samples from the original training set $D_{x}$. In this section we provide a brief overview of the reconstruction scheme of (Haim et al., ; Buzaglo et al., ) (for elaboration see Sec. 3 in Haim et al. ()):

##### Implicit Bias of Gradient Flow:

Lyu and Li (); Ji and Telgarsky () show that given a homogeneous(^2^22W.r.t the parameters ${\bm{\theta}}$. Namely $\forall c>0:\phi(\cdot,c{\bm{\theta}})=c^{L}\phi(\cdot,{\bm{\theta}})$ for some $L$.) neural network $\phi(\cdot,{\bm{\theta}})$ trained using gradient flow with a binary cross-entropy loss on a binary classification dataset $\{(\mathbf{x}_{i},y_{i})\}_{i=1}^{n}\subseteq{\mathbb{R}}^{d}\times\{\pm 1\}$, its parameters ${\bm{\theta}}$ converge to a KKT point of the maximum margin problem. In particular, there exist $\lambda_{i}\geq 0$ for every $i\in[n]$ such that the parameters of the trained network ${\bm{\theta}}$ satisfy the following equation:

$$ ${\bm{\theta}}=\sum_{i=1}^{n}\lambda_{i}y_{i}\nabla_{\bm{\theta}}(\phi(\mathbf{ x}_{i},{\bm{\theta}}))~{}.$ (1) $$

##### Data Reconstruction Scheme:

Given such a trained model $\phi$ with trained (and fixed) parameters ${\bm{\theta}}$, the crux of the reconstruction scheme is to find a set of $\{\mathbf{x}_{i},\lambda_{i},y_{i}\}$ that satisfy Eq. 1. This is done by minimizing the following loss function:

$$ $L_{\text{rec}}(\hat{\mathbf{x}}_{1},\dots,\hat{\mathbf{x}}_{m},\lambda_{1}, \dots,\lambda_{m}):=\left\|{\bm{\theta}}-\sum_{i=1}^{m}\lambda_{i}y_{i}\nabla_ {\bm{\theta}}(\phi(\hat{\mathbf{x}}_{i},{{\bm{\theta}}}))\right\|_{2}^{2}~{},$ (2) $$

Where the optimization variables $\{\hat{\mathbf{x}}_{i},\lambda_{i}\}$ are initialized at random from $\lambda_{i}\sim\mathcal{U}(0,1)$ and $\hat{\mathbf{x}}_{i}\sim\mathcal{N}(0,\sigma)$ ($\sigma$ is a hyperparameter). This generates $m$ vectors $\{\hat{\mathbf{x}}_{i}\}_{i=1}^{m}$ that we consider as “candidates” for reconstructed samples from the original training set of the classifier $\phi$. The number of candidates $m$ should be “large enough” (e.g., $m\geq 2n$, and see discussion in Haim et al. ()). The $y_{i}$ are assigned in a balanced manner (i.e., $y_{1},\ldots,y_{m/2}=1$ and $y_{1+m/2},\ldots,y_{m}=-1$). Lastly, Buzaglo et al. () extended this scheme to multi-class classification problems.

The data reconstruction scheme is conducted multiple times for different choices of hyperparameters (e.g., learning rate and $\sigma$). For each trained model, we run about $50$-$100$ reconstruction runs with $m=500$, resulting in about $25$k-$50$k candidates. See Section B.2 for full details.

#### 3.2 Mapping Embedding Vectors 𝐱 ^ i subscript ^ 𝐱 𝑖 \hat{\mathbf{x}}_{i} over^ start_ARG bold_x end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to the Image Domain 𝐬 ^ i subscript ^ 𝐬 𝑖 \hat{\mathbf{s}}_{i} over^ start_ARG bold_s end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT

Unlike previous works on data reconstruction that directly reconstruct training images, our method reconstructs embedding vectors. To evaluate the effectiveness of our reconstructed candidates, we must first map them back to the image domain. In this section we describe how we achieve training images from image-embeddings. Namely, given reconstructed image-embeddings $\hat{\mathbf{x}}_{i}$, our goal is to compute $\hat{\mathbf{s}}_{i}=\mathcal{F}^{-1}(\hat{\mathbf{x}}_{i})$. To this end we apply model-inversion methods and in particular, the method proposed in Tumanyan et al. ().

Given a vector $\hat{\mathbf{x}}_{i}$ (an output candidate from the reconstruction optimization in Section 3.1), we search for an input image $\hat{\mathbf{s}}_{i}$ to $\mathcal{F}$ that maximizes the cosine-similarity between $\mathcal{F}(\hat{\mathbf{s}}_{i})$ and $\hat{\mathbf{x}_{i}}$. Formally:

$$ $\hat{\mathbf{s}}_{i}=\mathcal{F}^{-1}(\hat{\mathbf{x}}_{i})=\underset{\nu}{ \text{argmax}}\frac{\mathcal{F}(\nu)\cdot\hat{\mathbf{x}}_{i}}{\|\mathcal{F}( \nu)\|\|\hat{\mathbf{x}}_{i}\|}~{}.$ (3) $$

We further apply a Deep-Image Prior (DIP) (Ulyanov et al., ) to the input of $\mathcal{F}$. I.e., $\nu=g(\textbf{z})$ where $g$ is a CNN U-Net model applied to a random input z sampled from Gaussian distribution. The only optimization variables of the inversion method are the parameters of $g$. See Appendix B.3 further explanation and full implementation details.

By applying model-inversion to DINO embeddings,
Tumanyan et al. () demonstrated that the [CLS]  token contains a significant amount of information about the visual appearance of the original image from which it was computed. Even though their work was done in the context of image to image style transfer, their results inspired our work and motivated us to apply their approach in the context of reconstructing training image samples.

A significant modification to Tumanyan et al. () in our work is by employing a cosine-similarity loss instead of their proposed MSE loss. We find that using MSE loss (i.e., $\mathcal{F}^{-1}(\hat{\mathbf{x}})={\text{argmin}}_{\nu}\|\mathcal{F}(\nu)-
\hat{\mathbf{x}}_{i}\|^{2}$) is highly sensitive to even small changes in the scale of $\hat{\mathbf{x}}$. The scales of $\hat{\mathbf{x}}$ can be very different from the unknown $\mathbf{x}=\mathcal{F}(\mathbf{s})$. Using cosine similarity alleviates this issue while simultaneously achieving similar quality for the inverted image result (see also Section A.1).

The above-mentioned technique is used for mapping embeddings to images for most transformers that we consider in our work. However, this technique did not produce good results when applied to CLIP (Radford et al., ). Therefore, to map CLIP image embeddings to the image domain, we employ a diffusion-based generator conditioned on CLIP embeddings by Lee et al. () (similar in spirit to the more popular DALL-E2 (Ramesh et al., ); see also Section A.6 and Section B.4).

#### 3.3 Selecting Reconstructed Embeddings to be Inverted

Applying the model-inversion described in Section 3.2 to a large pretrained model is computationally intensive. Inverting a single embedding vector takes about $30$ minutes on an NVIDIA-V100-32GB GPU. Therefore, it is not feasible to invert all $25$k-$50$k output candidates of Section 3.1.

To determine which reconstructed candidates to invert, we pair each training embedding $\mathbf{x}_{i}$ with its nearest reconstructed candidate $\hat{\mathbf{x}}_{j}$ (measured by cosine similarity) and select the top $40$ vectors with the highest similarity for inversion. This approach proves effective in practice, yielding images with high visual similarity to the original training images, as demonstrated in the results (e.g., Fig. 1).

In practice, the original training embeddings are not available (and inverting all candidates is computationally prohibitive). In Section 5 we introduce a novel method to identify good reconstructions without relying on either ground-truth embeddings or exhaustive inversion.

### 4 Results

We demonstrate reconstructed training images from models trained in a transfer learning setup, on the embeddings of large pretrained models. We train several MLPs to solve learning tasks for various choices of training images and choices of the large pretrained backbones from which the image embeddings are computed.

##### Datasets.

Since we simulate a model that is trained in a transfer learning manner, it is reasonable to assume that such tasks involve images that were not necessarily included in the training sets on which the pretrained backbone was trained (typically, ImageNet (Deng et al., )). In our experiments we use images from Food-101 (Bossard et al., ) (most popular dishes from foodspotting website) and iNaturalist (Van Horn et al., ) (various animals/plants species) datasets. The resolution of the images vary between 250-500 pixels, but resized and center-cropped to $224\times 224$.

##### Pretrained Backbones ( ℱ ℱ \mathcal{F} caligraphic_F ) for Image Embeddings.

We select several Transformer-based foundation models that are popular choices for transfer learning in the visual domain:

- •
ViT (Dosovitskiy et al., ): vit-base-patch16-224 from TIMM Wightman ().
- •
DINO-ViT (Caron et al., ): dino-vitb16 from the official implementation(^3^33[https://github.com/facebookresearch/dino](https://github.com/facebookresearch/dino)).
- •
DINOv2 (Oquab et al., ): dinov2-vitb14-reg from the official implementation(^4^44[https://github.com/facebookresearch/dinov2](https://github.com/facebookresearch/dinov2)).
- •
CLIP-ViT (Radford et al., ): ViT-L/14 as provided by OpenAI’s CLIP repository (^5^55[https://github.com/openai/CLIP](https://github.com/openai/CLIP)).

The dimension of the output embeddings is consistent across all backbones $\mathcal{F}$, and equal to $d$=$768$.

##### Multilayer Perceptron ( ϕ italic-ϕ \phi italic_ϕ )

consists of a single hidden layer of dimension $500$ ($d$-$500$-$C$) that is optimized with gradient descent for $10$k epochs, weight-decay of $0.08$ or $0.16$ and learning rate $0.01$. All models achieve zero training error.

#### Reconstructing Training Data from ϕ ⁢ ( ℱ ) italic-ϕ ℱ \phi(\mathcal{F}) italic_ϕ ( caligraphic_F )

Figure: Figure 3: Training samples (red) and their best reconstructed candidate, from MLPs trained on embeddings of various backbone models for two datasets.
Refer to caption: x4.png

We train classifiers $\phi(\mathcal{F}(s))$ on two binary classification tasks:
(1) binary iNaturalist is fauna (bugs/snails/birds/alligators) vs. flora (fungi/flowers/trees/bush) and (2) binary Food101 is beef-carpaccio/bruschetta/caesar-salad/churros/cup-cakes vs. edamame/gnocchi/paella/pizza/tacos.
Each binary class mixes images from several classes of the original dataset (images are not mixed between different datasets). Each training set contains $100$ images ($50$ per class). The test sets contains $1000$/$1687$ images for iNaturalist/Food101 respectively. All models achieve test-accuracy above $95\%$ (except for DINO on Food101 with $85\%$ and see Fig. 28).

In Fig. 3 we show the results of reconstructing training samples from $8$ models (for two binary tasks and $4$ choices of $\mathcal{F}$). For each reconstructed image ($\hat{\mathbf{s}}=\mathcal{F}^{-1}(\hat{\mathbf{x}})$), we show the nearest image from the training set, in terms of cosine-similarity between the embeddings of both ($d_{cosine}(\hat{\mathbf{x}},\mathcal{F}(\mathbf{s}))$). The samples are ordered by their similarity (top-left to bottom-right).
As can be seen, many reconstructed images clearly have high semantic similarity to their corresponding nearest training images.

In Fig. 4 we show results for reconstructing training samples from models trained on multiclass tasks, using an extension to of the method described in Section 3.1, to multiclass (by Buzaglo et al. ()) and see also Section B.5. As can be seen our approach also extends to the multiclass setting.

The resemblance between images decreases as embedding similarity decreases. However, there’s often still a visible semantic resemblance between the reconstructed and training images. One limitation of our reconstruction method is the varying effectiveness of the inversion method across different backbones $\mathcal{F}$. DINO and ViT yield the highest quality reconstructed samples. DINOv2 proves harder to invert, resulting in lower reconstruction quality. With CLIP, we utilize UnCLIP(^6^66We use the UnCLIP implementation from [https://github.com/kakaobrain/karlo](https://github.com/kakaobrain/karlo)) to project embeddings into good natural images, maintaining semantic similarity even as reconstruction quality decreases (e.g., same class). See discussion in Section 6 for further details on the differences and limitations of inversion.

Figure: Figure 4: Reconstructions from a multiclass models trained $100$ images from Food101/iNaturalist with $C$=$10/4$ classes ($10/25$ images per class), with test-accuracy $84\%$/$96\%$ (on a/b respectively). Color-padded images are training images, where color represents different classes.
Refer to caption: x12.png

Fig. 5 shows each training sample’s reconstruction quality, measured by $d_{cosine}(\hat{\mathbf{x}},\mathcal{F}(\mathbf{s}))$, plotted against its proximity to the decision boundary, measured by the model’s output. There is a strong correlation between these quantities, aligning with the theory (Sec. 3.2/5.3 in Haim et al. ()): if the classifier’s parameters converge to the KKT solution of the maximum-margin problem, they only rely on data points on the classification margin (closest to the decision boundary). Such plots effectively summarize the reconstruction method’s results, and in our case, also show its success.

Figure: Figure 5: Numerical summary for all models whose reconstructed samples are shown in Figs. 3 and 4.
Refer to caption: x14.png

### 5 Identifying Good Reconstruction Without the Original Trainset

Figure: Figure 6: Clustering-Based Reconstruction. Inversion of clusters representatives (blue) compared to training samples whose embeddings are in the same cluster (in red).
Refer to caption: x16.png

In this section, we introduce a clustering-based approach to identify “good”(^7^77Determining that a reconstructed candidate is indeed the reconstruction of a specific training image is equivalent to finding a good visual metric between images. See discussion in Sec.3 in Buzaglo et al. ().) reconstructed candidates without relying on the original training data. This is an important step towards an effective privacy attack. Previous works (Haim et al., ; Buzaglo et al., ; Loo et al., ), including Section 3.3 in this work, rely on the original training images for demonstrating that training images are embedded in the model parameters. However, it is not applicable to real-world privacy attacks, as attackers don’t have access to the original training data.

When directly reconstructing training images, this issue can be mitigated by manual inspection of the thousands of output image candidates – a time-consuming but feasible approach. However, this approach is irrelevant when reconstructing image embeddings. The reconstructed embeddings must first be inverted into images, which is computationally expensive (inverting a single vector takes about 30 minutes on an NVIDIA-V100-32GB GPU, as detailed in Section 3.3). Inverting thousands of embeddings is simply infeasible.

This is where our proposed clustering approach comes in. We observe that reconstructed candidates whose inversions are visually similar to training samples tend to cluster together.
By applying clustering algorithms, we group similar candidates and only invert representative samples from the largest clusters.
This reduces the total number of inversions by two orders of magnitude (from thousands to tens) and eliminates reliance on training data for identifying good reconstructed samples.

We demonstrate this by using agglomerative clustering(^8^88[https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.fcluster.html](https://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.hierarchy.fcluster.html)) on $25$,$000$ candidates reconstructed from a Dino-ViT-based model trained on the Food101 dataset (same as in Fig. 3). We use cosine similarity as the distance metric with “average” linkage and $1$,$000$ clusters, from which we select the 45 largest ones (containing between 100 and 8,000 candidates each). Within each cluster, a representative is chosen by averaging all candidate embeddings. Finally, these representatives are inverted using the methods described in Section 3.2. Fig. 6 shows the results of inverting these cluster representatives (blue), along with a training sample whose embedding belongs to the same cluster (red). As can be seen, the clustering-based approach provides a very good method for reconstructing training samples without requiring the training data.

Figure: Figure 7: Impact of Num. Clusters on Reconstruction Quality (for CIFAR10 model with $n$=$500$)
Refer to caption: x17.png

The choice of the number of clusters (maxclust) significantly affect the results of our clustering-based approach. Since assessing this effect in our current image-embedding setup is computationally prohibitive, we evaluate our approach on $50$k reconstructed candidates from a model trained on $500$ CIFAR-10 images (same as in Haim et al. ()). For each maxclust, we select the representatives of the largest $150$ clusters by either averaging all cluster candidates (red) or selecting the nearest candidate to the cluster-mean (blue). We compare each representative to a training image in the same cluster (using SSIM) and count the numbers of good representatives (SSIM>$0.4$), the results are in Fig. 7.

Notably, beyond a certain small threshold, any maxclust yields a considerable amount of good reconstructed samples (see also Section A.7).

### 6 Limitations

Figure: Figure 8: Training samples (red), inversion of original embeddings (blue), and inversion of reconstructed embeddings.
Refer to caption: x18.png

In this work, we made design choices when training the models to align with realistic transfer learning practices. However, some choices led to better reconstruction results than others, revealing limitations of our method. Here we discuss these limitations, their impact on our results, and identify potential future research directions:

- •
The quality of reconstructed images relies heavily on the backbone model ($\mathcal{F}$) and the inversion method (Section 3.2). Fig. 8 shows the inverted original embeddings $\mathcal{F}^{-1}(\mathcal{F}(\mathbf{s}))$ (blue), which are the “best” we can achieve (independent of our reconstruction method). It also shows how some backbones are easier or harder to invert, as evident in the difference between $\mathcal{F}^{-1}(\mathcal{F}(\mathbf{s}))$ (blue) and the original image $\mathbf{s}$ (red), for different $\mathcal{F}$’s. It can also be seen that the inverted reconstructed embeddings $\mathcal{F}^{-1}(\hat{\mathbf{x}})$ are sometimes more similar to $\mathcal{F}^{-1}(\mathcal{F}(\mathbf{s}))$ than to $\mathbf{s}$, which may hint that the challenge lies in the inversion more than in the reconstruction part. Certainly, improving model inversion techniques is likely to enhance the quality of reconstructed samples.
- •
CNN-based backbones $\mathcal{F}$ (e.g., VGG (Simonyan and Zisserman, )) proved more challenging for inversion than Transformer-based backbones $\mathcal{F}$. Since Transformers are also being more frequently employed due to their better generalization, we decided to focus our work on them and leave CNN-based backbones for future research.
- •
Linear-Probing (i.e. train a single linear layer $\phi$) is common practice in transfer learning. However, current reconstruction methods, including ours, struggle to perform well on linear models. This may stem from the small number of parameters in linear models (see Section A.4).
- •
We use weight-decay regularization since it is a fairly common regularization technique. However, the reconstruction method is known to perform much worse on models that are trained without it (Buzaglo et al., ).
- •
We experimented with an embedding vector that is a concatenation of [CLS]  and the average of all other output tokens (of $\mathcal{F}$). This had minor effect on the results, see Section A.5 for details.
- •
Fine-tuning the entire model $\mathcal{F}$ (together with $\phi$) is resource-intensive and less common compared to training only on fixed embedding vectors. While we followed the latter approach, full fine-tuning can be an interesting future direction.

### 7 Conclusion

In this work, we extend previous data reconstruction methods to more realistic transfer learning scenarios. We demonstrate that certain models trained with transfer learning are susceptible to training set reconstruction attack. Given the widespread adoption of transfer learning, our results highlight potential privacy risks. By examining the limitations of our approach, we identify simple mitigation strategies, such as employing smaller or even linear models, increasing training set size
or training without weight-decay regularization. However, some of these mitigation (removing regularization or using smaller models) may also come at a cost to the generalization of the model. Furthermore, these techniques may not be effective against future advanced reconstruction attacks.
We aim for our work to inspire the development of new defense methods and emphasize the importance of research on data reconstruction attacks and defenses.

##### Acknowledgements.

We would like to thank Gon Buzaglo for proposing the initial idea of applying data reconstruction to models trained with transfer learning, which laid the foundation for this work. This project is funded by the European Union (ERC grant agreement No 101142115). GV is supported by a research grant from the Center for New Scientists at the Weizmann Institute of Science.

## Appendix

### Appendix A Additional Experiments

#### A.1 Importance of Cosine-Similarity for Inversion (as opposed to MSE)

Figure: Figure 9: Inverting DINO ($\mathcal{F}^{-1}(a\mathcal{F}(\mathbf{s}))$) with different scales $a$
Refer to caption: x26.png

In Fig. 9, we illustrate the significance of having the correct scale when inverting an embedding (using the inversion described in Section 3.2). For several images $\mathbf{s}$ (left-most column), we display the inversion of their embeddings $\mathcal{F}^{-1}(\mathcal{F}(\mathbf{s}))$ (second from left column) alongside other inversions of the same vector multiplied by varying scales, namely, $\mathcal{F}^{-1}(a\mathcal{F}(\mathbf{s}))$ for $a=\left[\frac{1}{10},\frac{1}{2},2,10\right]$. As clearly evident, inverting the same vector without knowing the "true" scale ($a=1.0$) would result in very different results, sometimes making them hard to recognize.

The original paper Tumanyan et al. [] uses MSE in its inversion scheme. However, the output candidates from the reconstruction method (described in Section 3.1) can have significantly different norms than their corresponding original training embedding.

Figure: Figure 10: Comparing (a) the norms of $\mathcal{F}({\mathbf{s}})$ (red) and its NN $\hat{\mathbf{x}}$ (blue), and (b) their ratios
Refer to caption: x27.png

To conduct a comparison, we employ a binary model trained on DINO embeddings of images from Food101, reconstructing candidates $\hat{\mathbf{x}}$ from this model. In Fig. 10a, for each training image $\mathbf{s}$ we compare the norm of its DINO embedding $\|\mathcal{F}(\mathbf{s})\|$ (red), to the norm of its nearest neighbour embedding $\|\hat{\mathbf{x}}\|$ (blue), where $\hat{\mathbf{x}}=\underset{\mathbf{x}}{\text{argmin}}~{}d_{cosine}(x,\mathcal{
F}(\mathbf{s}))$ (and the value of $d_{cosine}$ is the x-axis). In Fig. 10b we show the ratio between the two, highlighting that candidates can have very different norm compared to their corresponding training image. This variation in norms is a result of the reconstruction scheme that we use (Section 3.1), whose nature we don’t fully understand yet. However, using cosine-similarity loss in our inversion scheme eliminates this issue.

#### A.2 Cosine-Similarity as a proxy for Good Reconstructions

Determining whether a candidate is a reconstruction of an original sample is a difficult challenge. It is highly unlikely that the two will be exactly the same, which is why selecting an appropriate similarity measure is important. Unfortunately, there is no "best" metric for comparing two images, which is a known open problem in computer vision (see e.g., Zhang et al. []).

The task becomes even more complex when dealing with reconstructed embedding vectors, as in our work. Given our computational constraints, we must choose wisely which embeddings to invert, adding another layer of complexity to the comparison process. Throughout our work, we frequently employ cosine similarity as a metric for evaluating embedding similarities. However, whether this metric accurately reflects visual quality is unclear. We set out to explore this question empirically.

Previous work on data reconstruction [Haim et al., , Buzaglo et al., ] directly reconstruct training images, allowing us to a directly compare between cosine similarity and image similarity measures. Both works established SSIM [Wang et al., ] as a good visual metric for CIFAR10 images (see Appendix A.2 in Buzaglo et al. []), and defined SSIM$>0.4$ as a good threshold for declaring two images as sufficiently similar. In fact these works also use cosine similarity to find nearest neighbors between candidates and training images when normalized to $[-1,1]$, and only after shifting the images to [0,1] they use SSIM. Which means that they also implicitly assume that cosine-similarity is a good proxy for visual similarity.

In Fig. 11, we quantitatively evaluate this assumption using reconstructed images from a CIFAR10-trained model (as in Haim et al. []). The left panel is for simply reproducing the results of Haim et al. []. By looking at both middle and right panel, we see that CosSim=$0.75$ is a good cut-off for determining "good" reconstruction, since from this point there is a good correlation between the two metrics. This is also the reason that we use this threshold for determining good reconstruction in other experiments in the paper.

By further observing the middle panel: if SSIM$>0.4$ (horizontal black line) is considered a criterion for good image reconstruction, then cosine similarity (CosSim$>0.75$, vertical black line) may overlook some potentially high-quality reconstructions, indicating room for further improvement in our approach.

Figure: Figure 11: Comparing Cos-Sim to SSIM of training data (model trained on CIFAR10)
Refer to caption: x29.png

#### A.3 Does Training Data Reconstructability Require Overtraining?

Figure: Figure 12: Does Training Data Reconstructability Require Overtraining? – Seems Not.
Refer to caption: x30.png

We set to explore how "reconstructability" (i.e., how many good samples we can reconstruct from) depends on the number of training iterations. We note from empirical observations that reconstructability certainly improves with longer training, which should not be surprising because according to theory, the model converges more to the KKT solution.

But the key question is - does the model have to be "overtrained" before becoming reconstructable, or not? To define "overtrained", we observe how the generalization accuracy increases. Obviously, the longer we train, the better the model will be reconstructable. But is it reconstructable before the generalization accuracy saturates? (Or do we have to keep training long after that?)

In Fig. 12 we show the test accuracy per training iteration (red) for a model trained on DINO embeddings from the Food101 dataset. We also show reconstruction quality (blue) by counting the number of training samples whose cosine similarity to its nearest neighbor candidate was above $0.75$. As can be seen, reconstructability increases after about 1000 iterations and starts saturating at about 2000 iterations, where the test accuracy (even though quite high in the beginning), keeps increasing by more than 1.5% until 10k iterations.

The implication is that reconstructability is achieved in a reasonable time (measured by the time taken to achieve good generalization accuracy). This observation is important to assert the realism of our method as a viable privacy threat to models trained in a similar fashion.

#### A.4 Impact of Model Size and Training Set Size on Reconstructability

Figure: Figure 13: Effect of model size and dataset size on reconstructability.
Refer to caption: x31.png

Previous works Buzaglo et al. [] observed that the quality of reconstruction results is influenced by the size of the model (i.e., number of parameters) and the size of the training set. We conduct similar analysis for our models.

This relationship can be intuitively understood by considering  Eq. 2 as a system of equations to be inverted, where the number of equations corresponds to the number of parameters in the model, $\theta\in{\mathbb{R}}^{p}$, and the unknowns are the coefficients $\lambda_{i}\in{\mathbb{R}}$ and the reconstructed embeddings ${\mathbf{x}}_{i}\in{\mathbb{R}}^{d}$ for each training sample $i\in\{1,...,n\}$. The ratio $\frac{p}{n(d+1)}$ represents the number of model parameters relative to the total number of unknowns. As this ratio increases, i.e., when the model has more parameters compared to the number of unknowns, we hypothesize that the system of equations becomes more well-determined, leading to higher reconstructability.

This hypothesis is supported by the empirical results presented in Fig. 13, where we train $2$-layer MLPs with architecture $D$-$W$-$1$ on $N$ training samples from binary Food101. Each cell reports the number of good reconstructions (cosine similarity between training embedding and its nearest neighbor candidate $>0.75$), both in absolute terms and as a percentage relative to N. As shown, when the model has more parameters relative to the number of training examples (further left and higher up in the table), our method can extract more reconstructions from the model.

This figure also show that our method can be extended to larger datasets, up to $N$=$2000$ (and probably beyond).

#### A.5 Effect of Using [CLS] +MEAN vs [CLS] as Feature Vector

In our work we use the [CLS]  token as the feature vector for a given image. However, there may be other ways to use the outputs of transformer-based foundation models as feature vectors. As suggested in Caron et al. [] (linear probing section), one might use a concatenation of the [CLS]  token and the mean of the rest of the other output tokens ([CLS]+MEAN). In Fig. 14 we show reconstructed results for a model that was trained using such [CLS]+MEAN feature vector (using DINO on Food101). As seen, the extra information in the feature vector does not seem to have a significant effect on the total results of the reconstruction (as opposed to a possible assumption that extra information would result in higher reconstructability). While this is by no means an exhaustive evaluation of this design choice (using [CLS]+MEAN vs. just [CLS]), it does look like this may not change the results of the reconstruction too much.

Figure: Figure 14: Reconstruction from a DINO model trained on [CLS]+MEAN embedding vector (original training image in red)
Refer to caption: x32.png

#### A.6 Model Inversion for CLIP vs UnCLIP Decoder

As described in Section 3.2, for inverting CLIP embeddings, we use an UnCLIP decoder instead of the model inversion approach used for other backbone models (ViT/DINO/DINOv2). The main reason behind this choice is that the same inversion method did not seem to provide satisfactory results for CLIP. In Fig. 15, we show output images of inverted embeddings using the approach from Tumanyan et al. [] (with the modifications described in our paper). The results do not produce comparable quality to using the UnCLIP decoder.

Figure: Figure 15: Model-Inversion reconstructions from a model trained on CLIP embeddings
Refer to caption: x33.png

#### A.7 Further Insights on Clustering-based Reconstruction ( Section 5 )

Figure: Figure 16: Extended Results for the figure in Section 5
Refer to caption: x35.png

In Fig. 16, we show extended results of the inset Figure in Section 5, displaying the same graph up to larger maxclust values (red and blue solid lines), together with similar results that count the number of “good” reconstructions with CosSim $>0.75$ (dashed blue and red lines).

The reason for the decrease in the number of good reconstructions as the number of clusters increases, is that we only consider the largest $150$ clusters (per partition of the candidates, as determined by maxclust). Consequently, when there are too many clusters, the probability that the largest ones correspond to a cluster of a training sample decreases (for $50$k clusters, this becomes totally random). Note that the largest number of clusters in the graph is slightly smaller than 50k, and there exist several clusters with 2-3 candidates.

Another insight from this graph is that averaging several candidates together results in better candidates, an observation also made by Haim et al. []. In our work, we don’t use such candidate averaging (except for the clustering experiments), but this may lead to improved results. We leave this for future research.

We note that since the similarity measure between candidates is cosine similarity, this implicitly applies a spherical topography for comparing candidates. Therefore, it is not straightforward to compute the mean of several candidates. In our work, we use the simple arithmetic mean, which empirically seems to work well. We considered computing the Fréchet mean, i.e., the mean of the candidates that lies on the sphere, but could not find a working implementation for this. This may also be an interesting direction for future research.

For completeness, we show how the reconstructed samples look for the choice of the "peak" SSIM from Fig. 16, which occurs at 3294 clusters. These are shown in Fig. 17.

Figure: Figure 17: Reconstructed candidates of CIFAR10 model, obtained with our clustering-based approach for the "peak" value in Fig. 16 ($3294$)
Refer to caption: x36.png

#### A.8 Comparison to Activation Maximization

Figure: Figure 18: Reconstructions using activation maximization on the input to $\phi$
Refer to caption: x37.png

Figure: Figure 19: Reconstructions using activation maximization on the input to $\mathcal{F}$
Refer to caption: x38.png

We compare our reconstruction results to a popular baseline for reconstructing data from trained model. It is called “model inversion” in the context of privacy[Fredrikson et al., ] or “activation maximization” in the context of visualization techniques [Mahendran and Vedaldi, ] (we prefer the term activation maximization as it is more accurate). We are searching for inputs to the model that achieve high activations for the model’s outputs that correspond to each class. We consider two options in our case:

The first, by performing activation maximization on the inputs to $\phi$:

$$ $\underset{\mathbf{x}}{\text{argmin}}\ \mathcal{L}\left(\Phi(\mathbf{x}),\ y\right)$ $$

This results in multiple candidates $\{\mathbf{x}\}$ that minimize the loss function (binary cross-entropy) w.r.t to the classes $y\in\{-1,1\}$. We then search for candidates that are nearest neighbours of original training embeddings, and invert them to images by computing $\mathcal{F}^{-1}(\mathbf{x})$ (this is the same pipeline as we use for the reconstructed candidates of our approach). The results of this approach can be seen in Fig. 18.

The second approach, is to optimize over the inputs to $\mathcal{F}$ (instead of the inputs to $\phi$) in the same manner that is described in Section B.3:

$$ $\mathbf{x}=g_{\nu}(z)~{}~{}~{}s.t.~{}~{}\nu=\underset{\nu}{\text{argmin}}\ \mathcal{L}\left(\phi\left(\mathcal{F}\left(g_{\nu}(z)\right)\right),y\right)$ $$

Where $g$ is the U-Net model with parameters $\nu$. This is equivalent to performing the inversion method as described in Section B.3, but feeding the output of $\mathcal{F}$ into the trained $\phi$ and then into the loss $\mathcal{L}$, with a given $y\in\{-1,1\}$ (instead of comparing the output of $\mathcal{F}$ to a given embedding vector). Note that as described in Section B.3, the only optimization variables are the parameters of the Deep-Image Prior $g$ (denoted as $\nu$ in the equation above). The results of this approach are shown in Fig. 19.

As evident from the results, while activation maximization techniques manage to reconstruct some interesting outputs, that are somewhat semantically related to the training classes, the results of both methods are inferior to the results of our proposed approach.

#### A.9 GT Inversion

Here are the full results (on all reconstructed candidates) of the results shown in Fig. 8.

Figure: Figure 20: ViT on Food101: Training Image (red), Inversion of Original Embedding (blue) and Inversion of Reconstructed Embedding.
Refer to caption: extracted/5745947/figs/gt_inversion_full_png/vit_food.png

Figure: Figure 21: ViT on iNaturalist: Training Image (red), Inversion of Original Embedding (blue) and Inversion of Reconstructed Embedding.
Refer to caption: extracted/5745947/figs/gt_inversion_full_png/vit_inat.png

Figure: Figure 22: DINO on Food101: Training Image (red), Inversion of Original Embedding (blue) and Inversion of Reconstructed Embedding.
Refer to caption: extracted/5745947/figs/gt_inversion_full_png/dino_food.png

Figure: Figure 23: DINO on iNaturalist: Training Image (red), Inversion of Original Embedding (blue) and Inversion of Reconstructed Embedding.
Refer to caption: extracted/5745947/figs/gt_inversion_full_png/dino_inat.png

Figure: Figure 24: DINO2 on Food101: Training Image (red), Inversion of Original Embedding (blue) and Inversion of Reconstructed Embedding.
Refer to caption: extracted/5745947/figs/gt_inversion_full_png/dino2_food.png

Figure: Figure 25: DINO2 on iNaturalist: Training Image (red), Inversion of Original Embedding (blue) and Inversion of Reconstructed Embedding.
Refer to caption: extracted/5745947/figs/gt_inversion_full_png/dino2_inat.png

Figure: Figure 26: CLIP on Food101: Training Image (red), UnCLIP of Original Embedding (blue) and UnCLIP of Reconstructed Embedding.
Refer to caption: extracted/5745947/figs/gt_inversion_full_png/clip_food.png

Figure: Figure 27: CLIP on iNaturalist: Training Image (red), UnCLIP of Original Embedding (blue) and UnCLIP of Reconstructed Embedding.
Refer to caption: extracted/5745947/figs/gt_inversion_full_png/clip_inat.png

### Appendix B Implementation Details

Our code is implemented with PyTorch [Paszke et al., ] framework.

#### B.1 Data Preprocessing

We resize each image to a resolution of $224$ pixels (the smaller side of the image) and then apply a center crop to obtain a $224\times 224$ image. We then normalize the image per pixel following the normalization used in the original paper of each model, as shown in the table below:

| Model | Mean | Std |
| --- | --- | --- |
| DiNO, DiNOv2 | $[0.485,0.456,0.406]$ | $[0.229,0.224,0.225]$ |
| ViT | $[0.5,0.5,0.5]$ | $[0.5,0.5,0.5]$ |
| CLIP | $[0.481,0.458,0.408]$ | $[0.269,0.261,0.276]$ |

After feeding the images through the backbone $\mathcal{F}$ to obtain the image embeddings $\mathcal{F}(\mathbf{s}_{i})$, we normalize each embedding by subtracting the mean-embedding and dividing by the std. Formally: $\mathbf{x}_{i}=\frac{\mathcal{F}(\mathbf{s}_{i})-\mu}{\sigma}$, where $\mu=\frac{1}{n}\sum_{i=1}^{n}\mathcal{F}(\mathbf{s}_{i})$, and $\sigma=\sqrt{\frac{1}{n-1}\sum_{i=1}^{n}\left(\mathcal{F}(\mathbf{s}_{i})-\mu
\right)^{2}}$.

This is a fairly common approach when training on small datasets. $\mu$ and $\sigma$ can be thought as being part of the model $\phi$ as they are also applied for embeddings from outside the training set.

#### B.2 Reconstruction Hyperparameter Search

As mentioned in Section 3.1, we run the reconstruction optimization $100$ times with different choice of the $4$ hyperparameters of the reconstruction algorithm:

- 1.
Learning rate
- 2.
$\sigma$ – the initial s.t.d. of the initialization of the candidates
- 3.
$\lambda_{\text{min}}$ – together with the loss Eq. 2, the reconstruction includes another loss term to require $\lambda_{i}>\lambda_{\text{min}}$ (a consequence of the KKT conditions is that $\lambda_{i}>0$, but if $\lambda_{i}=0$ it has no relevance in the overall results, therefore a minimal value $\lambda_{\text{min}}$ is set.).
- 4.
$\alpha$ – Since the derivative of ReLU is piecewise constant and non-continuous, the backward function in each ReLU layer in the original model is replaced with the derivative of SoftRelu with parameter $\alpha$.

For full explanation of the hyperparameters, please refer to  Haim et al. []. Note that for $m=500$, running $100$ times would result in $50$k candidates.

The hyperparameter search is done via Weights&Biases [Biewald, ], with the following randomization (it is in the format of a W&B sweep):

#### B.3 Further Details about Inversion Section 3.2

We follow similar methodology to Tumanyan et al. [], using their code(^9^99[https://splice-vit.github.io/](https://splice-vit.github.io/)) and changing the reconstruction loss from MSE to Cosine-Similarity as mentioned in Section 3.2, and specifically Eq. 3 (see justifications in Section A.1).

The Deep-Image Prior model $g$ is a fully convolutional U-Net model [Ronneberger et al., ] (initialized at random with the default pytorch implementation). The optimization is run for $20$,$000$ iterations, where at each iteration the input to $g$ is $z+r$, where $z$ is initialized from $z\sim\mathcal{N}(\textbf{0}_{d_{s}},\mathbb{I}_{d_{s}\times d_{s}})$ and kept fixed throughout the optimization, and $r$ is sampled at each iteration as follows:

| iteration $i<10$,$000$: | $r\sim\mathcal{N}(\textbf{0}_{d_{s}},10\cdot\mathbb{I}_{d_{s}\times d_{s}})$ |
| --- | --- |
| iteration $10$,$000<i\leq 15$,$000$: | $r\sim\mathcal{N}(\textbf{0}_{d_{s}},~{}~{}2\cdot\mathbb{I}_{d_{s}\times d_{s}})$ |
| iteration $15$,$000<i\leq 20$,$000$: | $r\sim\mathcal{N}(\textbf{0}_{d_{s}},0.5\cdot\mathbb{I}_{d_{s}\times d_{s}})$ |

Note that the input to $g$ is of the same size of the input to $\mathcal{F}$, which is simply and image of dimensions $d_{s}=c\times h\times w$. At each iteration, the output of $g$ is fed to $\mathcal{F}$, and the output of $\mathcal{F}$ (which is an embedding vector of dimension $d=768$), is compared using cosine-similarity to the embedding vector that we want to invert. At the end of the step, the parameters of $g$ are changed to increase the cosine similarity between the embeddings.

#### B.4 Inversion with UnCLIP

While the method in Section B.3 is used for ViT, DINO and DINOv2, for CLIP we use a different method to invert, which is by using the UnCLIP implementation of Lee et al. []. Unlike the inversion in  Section B.3 that uses cosine-similarity, with UnCLIP, the embeddings (that go into to UnCLIP decoder) should have the right scale. For each CLIP embedding of a training image ($\mathbf{x}$), we search for its nearest neighbour candidate ($\hat{\mathbf{x}}$) with cosine similarity, but before feeding $\hat{\mathbf{x}}$ into the UnCLIP decoder, we re-scale it to have the same scale as $\mathbf{x}$, so that the input to the decoder is in fact $(\|\mathbf{x}\|/\|\hat{\mathbf{x}}\|)\hat{\mathbf{x}}$. Unfortunately we could not resolve this reliance on the training set (as is also done in previous reconstruction works, and discussed in the main paper), but we believe this may be mitigated by computing and using general statistics of the training set (instead of specific training samples). We leave this direction for future research.

#### B.5 Reconstruction in Multiclass Setup

The method in Section 3.1 was extended to multiclass settings by Buzaglo et al. []. In a nutshell, the reconstruction loss in Eq. 2 contains the gradient (w.r.t. ${\bm{\theta}}$) of $y_{i}\phi(\mathbf{x}_{i})$ which is the distance from the decision boundary. For multiclass model $\phi:{\mathbb{R}}^{d}\to{\mathbb{R}}^{C}$, the distance to the decision boundary is $\phi(\mathbf{x}_{i})_{y_{i}}-\text{max}_{j\neq y_{i}}\phi(\mathbf{x}_{i})_{j}$ . Replaced into the reconstruction loss in Eq. 2, we have:

$$ $L_{\text{rec}}(\hat{\mathbf{x}}_{1},\dots,\hat{\mathbf{x}}_{m},\lambda_{1}, \dots,\lambda_{m}):=\left\|{\bm{\theta}}-\sum_{i=1}^{m}\lambda_{i}\nabla_{\bm{ \theta}}\left[\phi(\hat{\mathbf{x}}_{i},{\bm{\theta}})_{y_{i}}-\underset{j\neq y _{i}}{\text{max}}\phi(\hat{\mathbf{x}}_{i},{\bm{\theta}})_{j}\right]\right\|_{ 2}^{2}$ $$

#### B.6 Choice of Weight Decay

Figure: Figure 28: Test-Accuracy for different choices of Weight-Decay Value. Red-X marks the specific run used for reconstruction in Fig. 3
Refer to caption: x39.png

When training our model, we apply weight decay regularization. However, determining the optimal weight decay (WD) value is not straightforward. To find a WD value, we conduct a search across different WD values and observe their impact on test accuracy. The reuslts are shown in Fig. 28. We notice that for most values, the test accuracy increases until approximately 0.1 and then decreases from about 0.3 (indicating that WD is too large). We select the WD from this range, either 0.08 or 0.16. A red-x marks the run which was selected for reconstruction (and whose results are shown in Fig. 3).

### Appendix C Datasets - Full Details

#### C.1 Image Resolution

Fig. 29 illustrates how images in the datasets we used may have different resolutions. To standardize the input, we use the pre-processing described in Section B.1.

Figure: Figure 29: Resolution frequency of the images in use from iNaturalist (a) and Food101 (b) datasets
Refer to caption: x40.png

#### C.2 Food-101 [Bossard et al., 2014 ]

The dataset comprises real images of the 101 most popular dishes from the foodspotting website.

##### Binary Tasks

We use the following classes:

- •
Class I: "beef carpaccio", "bruschetta", "caesar salad", "churros" and "cup cakes"
- •
Class II: "edamame", "gnocchi", "paella", "pizza" and "tacos"

For any choice of training samples amount, we randomly pick half from every such combined class in order to create our new dataset.

##### Multiclass Tasks

We use the following classes:

"beef carpaccio", "beet salad", "carrot cake", "cup cakes", "dumplings", "gnocchi", "guacamole", "nachos", "pizza" and "samosa"

Here the classes are not combined. For every choice of $N$ classes we choose the first $N$ out of the list above and randomly pick examples according to the training set size and in such a way that the newly formed dataset is balanced.

#### C.3 iNaturalist [Van Horn et al., 2018 ]

The dataset encompasses a total of 10,000 classes, each representing a distinct species.

##### Binary Tasks

Classes are combined in the same manner as for the Food101 dataset. All classes names below appear as they are in the dataset.

2.5em0pt

Fauna

02590_Animalia_Arthropoda_Insecta_Odonata_Macromiidae_Macromia_taeniolata
02510_Animalia_Arthropoda_Insecta_Odonata_Libellulidae_Libellula_forensis
02193_Animalia_Arthropoda_Insecta_Lepidoptera_Sphingidae_Eumorpha_vitis
02194_Animalia_Arthropoda_Insecta_Lepidoptera_Sphingidae_Hemaris_diffinis
00828_Animalia_Arthropoda_Insecta_Hymenoptera_Vespidae_Polistes_chinensis
00617_Animalia_Arthropoda_Insecta_Hemiptera_Pentatomidae_Dolycoris_baccarum
02597_Animalia_Arthropoda_Insecta_Orthoptera_Acrididae_Acrida_cinerea
05361_Animalia_Mollusca_Gastropoda_Stylommatophora_Philomycidae_Megapallifera_mutabilis
04863_Animalia_Chordata_Reptilia_Crocodylia_Crocodylidae_Crocodylus_niloticus
04487_Animalia_Chordata_Aves_Procellariiformes_Diomedeidae_Phoebastria_nigripes
04319_Animalia_Chordata_Aves_Passeriformes_Tyrannidae_Myiozetetes_cayanensis

Flora

05690_Fungi_Basidiomycota_Agaricomycetes_Polyporales_Polyporaceae_Trametes_coccinea
05697_Fungi_Basidiomycota_Agaricomycetes_Russulales_Auriscalpiaceae_Artomyces_pyxidatus
05982_Plantae_Tracheophyta_Liliopsida_Asparagales_Iridaceae_Olsynium_douglasii
05988_Plantae_Tracheophyta_Liliopsida_Asparagales_Iridaceae_Sparaxis_tricolor
06988_Plantae_Tracheophyta_Magnoliopsida_Asterales_Asteraceae_Silphium_laciniatum
06665_Plantae_Tracheophyta_Magnoliopsida_Asterales_Asteraceae_Calendula_arvensis
07032_Plantae_Tracheophyta_Magnoliopsida_Asterales_Asteraceae_Syncarpha_vestita
07999_Plantae_Tracheophyta_Magnoliopsida_Fabales_Fabaceae_Lupinus_arcticus
07863_Plantae_Tracheophyta_Magnoliopsida_Ericales_Primulaceae_Myrsine_australis
08855_Plantae_Tracheophyta_Magnoliopsida_Malpighiales_Rhizophoraceae_Rhizophora_mangle
09143_Plantae_Tracheophyta_Magnoliopsida_Ranunculales_Berberidaceae_Berberis_bealei
09974_Plantae_Tracheophyta_Polypodiopsida_Polypodiales_Pteridaceae_Cryptogramma_acrostichoides

##### Multiclass Tasks

2.5em0pt

1. Insects

02590_Animalia_Arthropoda_Insecta_Odonata_Macromiidae_Macromia_taeniolata
01947_Animalia_Arthropoda_Insecta_Lepidoptera_Nymphalidae_Phaedyma_columella
02194_Animalia_Arthropoda_Insecta_Lepidoptera_Sphingidae_Hemaris_diffinis
02195_Animalia_Arthropoda_Insecta_Lepidoptera_Sphingidae_Hemaris_fuciformis
02101_Animalia_Arthropoda_Insecta_Lepidoptera_Pieridae_Pontia_occidentalis
02138_Animalia_Arthropoda_Insecta_Lepidoptera_Riodinidae_Apodemia_virgulti

2. Aquatic Animals

02715_Animalia_Arthropoda_Malacostraca_Decapoda_Grapsidae_Grapsus_grapsus
02850_Animalia_Chordata_Actinopterygii_Perciformes_Lutjanidae_Ocyurus_chrysurus
02799_Animalia_Chordata_Actinopterygii_Perciformes_Centrarchidae_Ambloplites_rupestris
02755_Animalia_Arthropoda_Merostomata_Xiphosurida_Limulidae_Limulus_polyphemus
02704_Animalia_Arthropoda_Malacostraca_Decapoda_Cancridae_Cancer_borealis
02706_Animalia_Arthropoda_Malacostraca_Decapoda_Cancridae_Cancer_productus

3. Reptiles

04859_Animalia_Chordata_Reptilia_Crocodylia_Alligatoridae_Alligator_mississippiensis
04868_Animalia_Chordata_Reptilia_Squamata_Agamidae_Agama_picticauda
04862_Animalia_Chordata_Reptilia_Crocodylia_Crocodylidae_Crocodylus_moreletii
04865_Animalia_Chordata_Reptilia_Rhynchocephalia_Sphenodontidae_Sphenodon_punctatus
04954_Animalia_Chordata_Reptilia_Squamata_Colubridae_Pituophis_deppei

4. Birds

04487_Animalia_Chordata_Aves_Procellariiformes_Diomedeidae_Phoebastria_nigripes
04319_Animalia_Chordata_Aves_Passeriformes_Tyrannidae_Myiozetetes_cayanensis
04570_Animalia_Chordata_Aves_Suliformes_Phalacrocoracidae_Microcarbo_melanoleucos
04587_Animalia_Chordata_Aves_Suliformes_Sulidae_Sula_nebouxii
04561_Animalia_Chordata_Aves_Strigiformes_Strigidae_Surnia_ulula
04576_Animalia_Chordata_Aves_Suliformes_Phalacrocoracidae_Phalacrocorax_capensis

## Peer Reviews

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: - I am also wondering whether we have any baselines in this line of data inversion techniques
- a quick question, for diffusion-based generative models, wondering whether it is also a more realistic concern to reveal training data directly.
soundness: 4
strengths: [**Novelty**] 
- Working in embedding space instead of directly reconstructing images is an innovative approach, and makes it more scalable to different models on both visual and non-visual data
- the adoption of clustering and averaging technique is novel, which identifies high-quality reconstructions when training data is not available

[**Significance**] 
- it highlights the significant privacy risks associated with models trained with sensitive data in a transfer learning setup, in which high-resolution data reconstruction in real-world conditions emphasizes the critical need for privacy-preserving mechanisms with today's pre-trained models. 

[**Completeness & Clarity**]
- High-quality visualizations, including comparisons of reconstructed images to original data and plots that illustrate reconstruction metrics, add depth to the evaluation, making it easier to interpret the results.
- The writing is clear, which effectively lays out the motivation and approach, and well explains the limitations
summary: This paper explores optimization-based **data inversion** techniques from pre-trained models with transfer learning, in which we could reconstruct the training data simply given the pre-trained encoder and classifier itself. It extends the model-inversion techniques with improved designs like loss, generative decoder. The clustering-based approach further demonstrates the possibility of high-quality reconstructions to the original data. Experiments on two common datasets reveals the potential privacy risks associated with models trained on sensitive data.
weaknesses: - On significance, while I like the simple paradigm of solving x when f is known within f(x)=y, I kind feel that reconstructed data samples are not exactly matching with the actual training data, especially when the training data is not available. It is more close to averaged per-category data when training data is not available, the author might want to turn down their scope.
- Another thinking is that the current method may only work with classifiers-based model, for more more fine-grained training data reconstruction from segmentation model like SAM might be more desired. Also the reconstruction quality varies significantly with the choice of backbone model (DINO, CLIP, etc.), which affects the novelty of the clustering approach by making it model-dependent.
- As the author also mentioned, the inversion process used to map embeddings back to images is computationally expensive, which could hinder scalability

---

confidence: 3
contribution: 1
initial_rating: 3
presentation: 2
questions: See weakness
soundness: 2
strengths: 1. This paper is easy to follow.
2. I appreciate the comprehensive experiments performed to analyze the effectiveness of the proposed approach.
summary: This paper studies the training data reconstruction problem. Different from previous methods, this paper studies the data reconstruction from models trained in a transfer learning approach, and claims the first approach to reconstruct images from the latent features. The experimental section showcases comprehensive results to verify the efficacy of proposed method in different datasets and backbone networks.
weaknesses: 1. The technique contribution is limited. This paper aims to reconstruct images from latent features (embeddings), however, the key components used for this purpose are borrowed from previous works. Specifically, it use ‘’Reconstructing training data from trained neural networks’’ to reconstruct embeddings, followed by ‘’Splicing vit features for semantic appearance transfer’’ to convert embeddings into RGB images.
2. The resolution of reconstructed images are still low (224x224).
3. The experiment part contains results of this method, but without any comparison with other approaches.

---

confidence: 2
contribution: 2
initial_rating: 5
presentation: 3
questions: My confusion is the aforementioned weaknesses. If there are any misunderstandings, please point them out.
soundness: 3
strengths: 1. The writing is well done and clear.

2. They present the weaknesses and limitations of their method in detail.

3. The experiments consider various commonly used pre-trained feature extractors such as CLIP, demonstrating the effectiveness of their method.
summary: This paper demonstrates the reconstruction of high-resolution training images from models trained using a transfer learning approach, as well as the reconstruction of non-visual data. Moreover, it introduces a novel clustering-based approach for effectively identifying training samples without prior knowledge of the training images.
weaknesses: 1. The method is limited to specific cases where a fixed feature extractor and some MLP layers serve as the classifier. It cannot generalize to other more common transfer learning scenarios, such as fine-tuning an entire classifier or certain layers of a classifier.

2. The introduced method lacks innovation. Specifically, the core contributions of reconstructing embedding vectors in Section 3.1 and mapping embedding vectors in Section 3.2 to the image domain either originate from other works or involve only simple modifications, such as changing the MSE loss to the cosine similarity loss. Please clearly explain the novel aspects of the method introduced.

3. The format of Figure 9 is incorrect as it exceeds the page boundary.

---

confidence: 5
contribution: 2
initial_rating: 5
presentation: 2
questions: 1. What is the performance of the proposed method with more types of networks besides the transformer?

2. What is the reconstruction performance on images with higher resolution?

3. Can the authors provide more reliable quantitative metrics?
soundness: 2
strengths: The proposed method has show better performance compared with baselines, on the datasets of Food-101 and iNaturalist.
summary: This paper proposes a new method for training data reconstruction. Different from other works, this paper proposes to recover the image embedding first, and then employs a inversion network to reconstruct the images. Especially, this paper proposes to use the clustering-based approach for effectively identifying training samples. Experiments show the performance of the proposed method.
weaknesses: 1. The experiments are only conducted on the CLIP and DINO which has served as the common components for the image diffusion models. However, I think the proposed network should be suitable for various networks. I wonder the training data reconstruction with other basic networks, like ResNet. And the authors should explain why they focused on transformer-based models in the experimental section.

2. This paper claims to be suitable for the reconstruction of high-resolution images, while the experiments are only conducted on the datasets with low resolution like 224 (why 224x224 fits that definition of "high resolution" in this paper?). I wonder the performance with higher resolution like 512.

3. There is no quantitative metric to compare the reconstruction effects between the proposed method and baselines. For example, using the reconstructed images can lead to a model with the similar accuracy of the original model?

4. The presentation of this paper is not good. For example, the texts in Fig.9 has be out of the width constraint, which could be resized.

Meta-review: The paper conducts optimization-based data inversion from pre-trained models with transfer learning. The objective is to reconstruct the training data given the pre-trained encoder and classifiers using clustering techniques. The main contribution is in demonstrating the vulnerability to training-data reconstruction of models trained in a transfer learning manner using embeddings of widely-used backbone models.

Strengths:
- Operates in the embedding space, making it more scalable.
- The use of clustering is novel.
- Highlights privacy risks in models trained with sensitive data.
- Contains comprehensive experiments.

Weaknesses:
- The data reconstructed is the expected data rather than the original data, thus the scope should be adjusted.
- Limited usability due to the required encoder/classifier setup and limited verification on CLIP and DINO.
- Limited technical contribution as it uses existing techniques.

Given the limited technical contribution, the empirical contribution must be substantial and the discussions insightful to make them the main empirical contribution of the paper.  However, the paper has a limited empirical contribution and requires major experiments to fully addressed the concerns raised by the reviewers.  Thus, I recommend the rejection of the paper.

Decision: Reject