Attributing Image Generative Models using Latent Fingerprints
Guangyu Nie, Changhoon Kim, Yezhou Yang, Yi Ren
Introduction
Generative models can now create synthetic content such as images and audio that are indistinguishable from those captured in nature (Karras et al., 2020; Rombach et al., 2022; Ramesh et al., 2022; Hawthorne et al., 2022). This poses a serious threat when used for malicious purposes, such as disinformation (Breland, 2019) and malicious impersonation (Satter, 2019). Such potential threats have slowed down the industrialization process of generative models, as conservative model inventors hesitate to release their source code (Yu et al., 2020). For example, in 2020, OpenAI refused to release the source code of their GPT-2 (Radford et al., 2019) model due to concerns over potential malicious use (Brockman et al., 2020). Additionally, the source code for DALL-E (Ramesh et al., 2021) and DALL-E 2 (Ramesh et al., 2022) has not been released for the same reason (Mishkin & Ahmad, 2022).
One potential solution is model attribution (Yu et al., 2018; Kim et al., 2021; Yu et al., 2020), where the model distributor tweaks each user-end model to generate content with model-specific fingerprints. In practice, we consider a scenario where the model distributor or regulator maintains a database of user-specific keys corresponding to each user’s downloaded model. In the event of a malicious attempt, the regulator can identify the user responsible for the attempt by using attribution.
The generation quality of measures the difference between and the data distribution used for learning , e.g., the Fréchet Inception Distance (FID) score (Heusel et al., 2017) for images. Inception score (IS) (Salimans et al., 2016) is also measured for as additional generation quality metrics. Fingerprint secrecy is measured by the mean structural similarity index measure (SSIM) of individual images drawn from . Compared with generation quality, this metric focuses on how obvious fingerprints are rather than how well two content distributions match. Lastly, the fingerprint capacity is .
Existing model attribution methods exhibit a significant tradeoff between attribution accuracy, generation quality, and secrecy, particularly when countermeasures against deattribution attempts, e.g., image postprocesses, are considered. For example, Kim et al. (2021) use shallow fingerprints for image generators in the form of where is an unfingerprinted model and show that s have to significantly alter the original contents to achieve good attribution accuracy against image blurring, causing an unfavorable drop in generation quality and secrecy (Fig. 1(a)).
Contributions. (1) We propose a novel fingerprinting strategy that directly embeds the fingerprints into pretrained generative model, as a mean to achieve responsible white-box model distribution. (2) We prove and empirically verify that there exists an intrinsic tradeoff between attribution accuracy and generation quality. This tradeoff is affected by fingerprint variables including the choice of the fingerprinting space, the fingerprint strength, and its capacity. Parametric studies on these variables for StyleGAN2 (SG2) and a Latent Diffusion Model(LDM) lead to improved accuracy-quality tradeoff from the previous SOTA. In addition, our method requires negligible computation compared with previous SOTA, rendering it more applicable to popular large-scale models, including latent diffusion ones. (3) We show that using a postprocess-specific LPIPS metric for model attribution leads to further improved attribution accuracy against image postprocesses.
Related Work
Certifiable model attribution through shallow fingerprints. Kim et al. (2021) propose shallow fingerprints and linear classifiers for attribution. These simplifications allow the derivation of sufficient conditions of to achieve certifiable attribution of . Since the fingerprints are added as noises rather than semantic changes coherent with the generated contents, increased noise strength becomes necessary to maintain attribution accuracy under postprocesses. While this paper does not provide attribution certification for latent fingerprint, we discuss the technical feasibility and challenges in achieving this goal.
GAN inversion. The model attribution problem can be formulated as a GAN inversion problem. A learning-based inversion (Perarnau et al., 2016; Bau et al., 2019) optimizes parameters of the encoder network which map an image to latent code . On the other hand, optimization-based inversion (Abdal et al., 2019; Huh et al., 2020) solve for latent code that minimizes distance metric between a given image and generated image . The learning-based method is computationally more efficient in the inference stage compared to optimization-based method. However, optimization-based GAN inversion achieves a superior quality of latent interpretation, which can be referred to as the quality-time tradeoff (Xia et al., 2022). In our method, we utilized the optimization-based inversion, as faithful latent interpretation is critical in our application. To further enforce faithful latent interpretation, we incorporate existing techniques, e.g., parallel search, to solve this non-convex problem, but uniquely exploit the fact that fingerprints are small latent perturbations to enable analysis on the accuracy-quality tradeoff.
Methods
where and is induced by . Then, the user can generate fingerprinted images, . The choice of and affects the attribution accuracy and generalization performance, which we analyze in Sec. 3.2.
Attribution.To decode user-specific key from the image , we formulate an optimization problem:
While is norm for analysis in Sec.3.2, here we minimize LPIPS (Zhang et al., 2018) which measures the perceptual difference between two images. Through experiments, we discovered that attribution accuracy can be improved by constraining . Here the upper and lower bounds of are chosen based on the empirical limits observed from . In practice, we introduce a penalty on with large enough Lagrange multipliers and solve the resulting unconstrained problem. To avoid convergence to unfavorable local solutions, we also employ parallel search with n initial guesses of drawn through Latin hypercube sampling (LHS).
2 Accuracy-quality tradeoff
such that if and , the fingerprint estimation problem
has an error .
Remarks: (1) Similar to the classic design of the experiment, one can reduce by maximizing , which sets columns of as the eigenvectors associated with the largest eigenvalues of . However, is neither computable because is unknown during the estimation, nor is it tractable because is large in practice. To this end, we propose to use the covariance of , denoted by , to replace in experiments. In Appendix C, we support this approximation empirically by showing that and (the non-fingerprinted mean Gram matrix) are qualitatively similar in that the principal components of both matrices offer disentangled semantic dimensions. (2) Let the th largest eigenvalue of be . By setting columns of as the eigenvectors of associated with the largest eigenvalues, and by noting that is accurate only when all of its elements match with ((1)), the worst-case estimation error is governed by . This means that higher key capacity, i.e., larger , leads to worse attribution accuracy. (3) From the proposition, if and are complementary sets of eigenvectors of . In practice this decoupling between and cannot be achieved due to the assumptions and approximations we made.
For any and , and , such that if and for all , then and with probability at least .
Remarks: Recall that for improving attribution accuracy, a practical approach is to choose as eigenvectors associated with the largest eigenvalues of . Notices that with the approximated distribution with and , . On the other hand, from Proposition 3.2, generation quality improves if we minimize by choosing according to the smallest eigenvalues of . In addition, smaller key capacity () and lower strength () also improve the generation quality. Propositions 3.1 and 3.2 together reveal the intrinsic accuracy-quality tradeoff.
Experiments
In this section, we present empirical evidence of the accuracy-quality tradeoff and show an improved tradeoff from the previous SOTA by using latent fingerprints. Experiments are conducted for both with and without a combination of postprocesses including (image noising, blurring, and JPEG compression, and their combination).
Models, data, and metrics. We conduct experiments on SG2 (Karras et al., 2020) and LDM (Rombach et al., 2022) models trained on various datasets including FFHQ (Karras et al., 2019), AFHQ-Cat, and AFHQ-Dog (Choi et al., 2020). Generation quality is measured by the Frechet Inception distance (FID) (Heusel et al., 2017) and inception score (IS) (Salimans et al., 2016), attribution accuracy by (1), and fingerprint secrecy by SSIM.
Latent fingerprint dimensions. To approximate , we drew 10K samples from for SG2, which has a semantic latent space dimensionality of 512, and 50K samples from for LDM, which has a semantic latent space dimensionality of 12,288. We define fingerprint dimensions as a subset eigenvectors of associated with consecutive eigenvalues: , where is the full set of principal components of sorted by their variances in the descending order while and represent the starting and ending indices of the subset.
Attribution. To compute the empirical accuracy (Eq. (1)), we use 1K samples drawn from for each fingerprint , and use 1K fingerprints where each bit is drawn independently from a Bernoulli distribution with . In Table 1, we show that both constraints on and parallel search with 20 initial guesses improve the empirical attribution accuracy across models and datasets. Notably, constrained estimation is essential for the successful attribution of LDMs. In these experiments, is chosen as the eigenvectors associated with the 64 smallest eigenvalues of as a worst-case scenario for attribution accuracy.
2 Attribution performance without postprocessing
We present generation quality results in Table 1. Since the least variant principal components are used as fingerprints, generation quality (FID) and fingerprint secrecy (SSIM) are preserved.
The results suggest that the attribution accuracy, generation quality, capacity (), and fingerprint secrecy are all acceptable using the proposed method. Fig. 2 visualizes and compares latent fingerprints generated from small vs. large eigenvalues of . Fingerprints corresponding to small eigenvalues are non-semantic, while those to large eigenvalues create semantic changes. We will later show that semantic yet subtle (perceptually insignificant) fingerprints are necessary to counter image postprocesses.
Accuracy-quality tradeoff. Table 2 summarizes the tradeoff when we vary the choice of and the fingerprint strength while fixing the fingerprint length to 64. Then in Table 3 we sweep while keeping as PCs associated with smallest eigenvalues of and . The experiments are conducted on SG2 and LDM on the FFHQ dataset. The empirical results in Table 2 are consistent with our analysis: Accuracy decreases while generation quality improves when is moved from major to minor principal components. For fingerprint strength, however, we observe that the positive effect of strength on the accuracy, as predicted by Proposition 3.1, is only limited to small . This is because larger causes pixel values to go out of bounds, causing loss of information. In Table 3, we summarize the attribution accuracy, FID, and SSIM score under 32- to 128-bit keys. Accuracy and generation quality, in particular the latter, are both affected by as predicted.
3 Fingerprint performance with postprocessing
We now consider more realistic scenarios where generated images are postprocessed, either maliciously as an attempt to remove the fingerprints or unintentionally, before they are attributed. Under this setting, our method achieves better accuracy-quality tradeoff than shallow fingerprinting under two realistic settings: (1) when noising and JPEG compression are used as unknown postprocesses, and (2) when the set of postprocesses, rather than the ones that are actually chosen, is known.
Postprocesses. To keep our solution realistic, we solve the attribution problem by assuming that the potential postprocesses are unknown:
where is a postprocess function, and is a given image from which the fingerprint is to be estimated. We assume that does not change the image in a semantically meaningful way, because otherwise the value of the image for either an attacker or a benign user will be lost. Since our method adds semantically meaningful perturbations to the images, we expect such latent fingerprints to be more robust to postprocesses than shallow ones (Kim et al., 2021) added directly to images and will lead to improved attribution accuracy. To test this hypothesis, we consider four types of postprocesses: Noising, Blurring, JPEG, and Combo. Noising adds a Gaussian white noise of standard deviation randomly sample from [0, 0.1]. Blurring uses a randomly selected Gaussian kernel size from and a standard deviation of [0.5, 1.0, 1.5, 2.0]. We randomly sample the JPEG quality from . These parameters are chosen to be mild so that images do not lose their semantic contents. And Combo randomly chooses a subset of the three through a binomial distribution with and uses the same postprocess parameters.
Modified LPIPS metric. In addition to testing the worst-case scenario where postprocesses are completely unknown, we also consider cases where they are known. While this is unrealistic for individual postprocesses, it is worth investigating when we assume that the set of postprocesses, rather than the ones that are actually chosen, is known. Within this scenario, we show that modifying LPIPS according to the postprocess improves the attribution accuracy. To explain, LPIPS is originally trained on a so-called “two alternative forced choice” (2AFC) dataset. Each data point of 2AFC contains three images: a reference, , and , where and are distorted in different ways based on the reference. A human evaluator then ranks and by their similarity to the reference. Here we propose the following modification to the dataset for training postprocess-specific metrics: Similar to 2AFC, for each data point, we draw a reference image from the default generative model to be fingerprinted and define as the fingerprinted version of . is then a postprocessed version of given a specific (or random combinations for Combo). To match with the setting of 2AFC, we sample 64 64 patches from , , and as training samples. We then rank patches from as being more similar to those of than . With this setting, the resulting LPIPS metric becomes more sensitive to fingerprints than mild postprocesses. The detailed training of the modified LPIPS follows the vgg-lin configuration in (Zhang et al., 2018). It should be noted that, unlike previous SOTA where shallow fingerprint (Kim et al., 2021) or encoder-decoder models (Yu et al., 2020) are retrained based on the known attacks, our fingerprinting mechanism, and therefore generalization performance, are agnostic to postprocesses.
Accuracy-quality tradeoff. We summarize fingerprint performance metrics on SG2 and FFHQ in Table 4. The attribution accuracies reported here are estimated using the strongest parameters of each attack. For Combo, we use sequentially apply Blurring+Noising+JPEG as a deterministic worst-case attack. To estimate attribution accuracy, we solved the estimation problem in (4.3) where postprocesses are applied. The proposed method: We choose as a subset of 32 consecutive eigenvectors of starting from the 1th, 17th, and 33th eigenvectors, denoted respectively by PC[0:32], PC[16:48], and PC[32:64] in the table. fingerprinting strength is set to 3. Attribution results from both a standard and a postprocess-specific LPIPS metric are reported in the UK (unknown) and KN (known) columns, respectively. Accuracies for our method are computed based on 100 random fingerprint samples from , each with 100 random generations. The baseline: We compare with a shallow fingerprinting method from (Kim et al., 2021) (denoted by BL). When the postprocesses are known, BL performs postprocess-specific computation to derive shallow fingerprints that are optimally robust against the known postprocess. Results in UK and KN columns for BL are respectively without and with the postprocess-specific fingerprint computation. BL accuracies are computed based on 10 fingerprints, each with 100 random generations.
It is worth noting that the shallow fingerprinting method is not as scalable as ours (See Appendix: D, and increasing the key capacity decreases the overall attribution accuracy (see (Kim et al., 2021)). Also, recall that the key length affects attribution accuracy (Proposition 1). Therefore, we conduct a fairer comparison to highlight the advantage of our method. Here we choose a subset of fingerprints (256 fingerprints) and report performance in Table 5, where accuracies are computed using the same settings as before. Visual comparisons between our method () and the baseline can be found in Fig. 3: To maintain attribution accuracy, high-strength shallow fingerprints, in the form of color patches, are needed around eyes and noses, and significantly lower the generation quality. In comparison, our method uses semantic changes that are robust to postprocesses. The choice of semantic dimensions, however, needs to be carefully chosen for the fingerprint to be perceptually subtle.
Fingerprint secrecy. The secrecy of the fingerprint is evaluated through the SSIM which is designed to measure the similarity between two images by taking into account three components: loss of correlation, luminance distortion, and contrast distortion (Wang et al., 2004). To facilitate a more equitable comparison between our methodology and the baseline, we select a subset of fingerprints presented in Table 5 for evaluation. As shown in Table 5, the robustly fingerprinted model for exhibits superior fingerprint secrecy compared to the baseline, while simultaneously outperforming it in attribution accuracy. Besides these quantitative measures, our approach also demonstrates a qualitative advantage in terms of secrecy when compared to the baseline (see Fig. 3). This is largely attributed to the fact that subtle semantic variations across images are more challenging to visually detect and thus being removed compared to typical artifacts introduced by shallow fingerprinting.
Conclusion
This paper investigated latent fingerprint as a solution to enable the attribution of generative models. Our solution achieved a better tradeoff between attribution accuracy and generation quality than the previous SOTA that uses shallow fingerprints, and also has extremely low computational cost compared to SOTA methods that require encoder-decoder training with high data complexity, rendering our method more scalable to attributing large models with high-dimensional latent spaces. Limitations and future directions: (1) There is currently a lack of certification on attribution accuracy due to the nonlinear nature of both the fingerprinting and the fingerprint estimation processes. Formally, by considering both the generation and estimation processes as discrete-time dynamics, such certification would require forward reachability analysis of fingerprinted contents and backward reachability analysis of the fingerprint, e.g., convex approximation of the support of and . It is worth investigating whether existing neural net certification methods can be applied. (2) Our method extracts fingerprints from the training data. Even with feature decomposition, the amount of features that can be used as fingerprints is limited. Thus the accuracy-quality tradeoff is governed by the data. It would be interesting to see if auxiliary datasets can help to learn novel and perceptually insignificant fingerprints that are robust against postprocesses, e.g., background patterns.
Acknowledgment
This work is partially supported by the National Science Foundation under Grant No. 2038666 and No. 2101052 and by an Amazon AWS Machine Learning Research Award (MLRA). Any opinions, findings, and conclusions expressed in this material are those of the author(s) and do not reflect the views of the funding entities.
References
Appendix A Proof of Propositions
Proposition 1. such that if and , the fingerprint estimation problem
Let , we have
Ignoring higher-order terms and , we then have
For any , there exists , such that if and ,
Removing terms independent from to reformulate (3) as
A.2 Proposition 2
Proposition 2. For any and , there exists and , such that if and for all , and with probability at least .
We start with . From Taylor’s expansion and using the independence between and , we have
Let . With orthonormal and binary-coded , we have
Then combining (11), (5), (6), (7), we have with probability at least
For covariances, let . We have
For , using the same treatment for the residual, we have for any and , there exists , such that if for all , the following upper bound applies with at least probability :
For the lower bound, we have .
For , we first denote by the th row of , its covariance matrix, and the maximum eigenvalue of . Then with binary-coded , we have
Then let (resp. ) be the th element of (resp. ), and be the th diagonal element of . Using (11), we have the following bound on the trace of the covariance between and :
Lastly, by ignoring terms and borrowing the same , , and , we have with probability at least :
Therefore, with probability at least
Appendix B Convergence on α𝛼\alpha
In the proofs, we assume that is small and constant. Here we show empirical estimation results on SG2 and on FFHQ, AFHQ-DOG, AFHQ-CAT datasets. The results in Fig. 4(a) are averaged over 100 random and 100 random , and uses parallel search on during the estimation.
Since computing for large models is intractable, here we train a SG2 on MNIST to estimate . Fig. 4(b) summarizes perturbed images from a randomly chosen reference along principal components of and . Note that both have quickly diminishing eigenvalues. Therefore most components other than the few major ones lead to imperceptible changes in the image space.
Appendix D Computational Complexity and Efficiency Comparison of Proposed and Baseline Methods
To comprehensively evaluate the computational costs of the proposed and baseline methods, we analyzed them from two perspectives: fingerprint generation and attribution. Our proposed method demonstrates a significant increase in efficiency compared to existing methods with regards to fingerprint generation. However, current methods, such as those proposed in (Kim et al., 2021), often necessitate a considerable amount of time for fine-tuning the model before generating a fingerprinted image. For instance, the baseline method requires approximately one hour to fine-tune the model for each individual user. For a key capacity of users, it would take an estimated hours to train on an NVIDIA V100 GPU. In contrast, our proposed method does not require the model to be fine-tuned, and only requires Principal Component Analysis (PCA) to be performed on the latent space of each pre-trained model to identify the editing direction. This process takes approximately three seconds for a key capacity of .
Regarding attribution time, the baseline approach performs attribution through a pre-trained network, resulting in low computation cost during inference. On the other hand, the proposed method uses optimization techniques to perform attribution, resulting in a longer computation time. Specifically, the average attribution time for the baseline method is approximately two seconds, while the proposed method takes approximately 126 seconds on average for 1k optimization trials (in parallel) using an NVIDIA V100 GPU.
It is important to acknowledge that there exists a trade-off between computational costs during generation and attribution. The choice of which aspect is more critical may depend on the specific application requirements.
Appendix E Ablation Study
In this section, we estimated attribution accuracy based on various attack parameters with multiple editing directions (see Tab.6,7,8,9). The image quality evaluation is available in Tab.10 and more visualizations can be found in Fig.5.