Targeted Attack Improves Protection against Unauthorized Diffusion Customization

## Abstract

Abstract Diffusion models build a new milestone for image generation yet raising public concerns, for they can be fine-tuned on unauthorized images for customization. Protection based on adversarial attacks rises to encounter this unauthorized diffusion customization, by adding protective watermarks to images and poisoning diffusion models. However, current protection, leveraging untargeted attacks, does not appear to be effective enough. In this paper, we propose a simple yet effective improvement for the protection against unauthorized diffusion customization by introducing targeted attacks. We show that by carefully selecting the target, targeted attacks significantly outperform untargeted attacks in poisoning diffusion models and degrading the customization image quality. Extensive experiments validate the superiority of our method on two mainstream customization methods of diffusion models, compared to existing protections. To explain the surprising success of targeted attacks, we delve into the mechanism of attack-based protections and propose a hypothesis based on our observation, which enhances the comprehension of attack-based protections. To the best of our knowledge, we are the first to both reveal the vulnerability of diffusion models to targeted attacks and leverage targeted attacks to enhance protection against unauthorized diffusion customization. Our code is available on GitHub: https://github.com/psyker-team/mist-v2 . [Warning: This paper contains images that some readers may find disturbing.]

## 1 Introduction

Diffusion Models (Sohl-Dickstein et al., ; Song & Ermon, ; Ho et al., ; Song et al., ; Rombach et al., ) has achieved state-of-the-art performance in image synthesis. One distinct advantage of diffusion models is the capability of controlling and customizing the image generation via reference images (Meng et al., ), text description (Saharia et al., ), sketches (Zhang & Agrawala, ), styles (Ruiz et al., ; Zhang et al., ), and identities (Ye et al., ; Wang et al., ). However, this power is a double-edged sword, for it also makes possible the unauthorized diffusion customization, where malicious individuals seek interests from customizing diffusion models based on unauthorized images, e.g. copyright photos. This has long been a public concern that draws attention from the whole society (Fan et al., ; Chen et al., ; Wang et al., ). Countermeasures are needed to protect private images from being arbitrarily used for unauthorized diffusion customization.

Figure: Figure 1: Output images of two mainstream diffusion customization, SDEdit (top two rows) and LoRA (bottom two rows) under different protections with perturbation budget $4/255$. ACE and ACE+ are our targeted attack, while others are baselines based on untargeted attacks.
Refer to caption: extracted/5921025/figs/vis_main.png

Recognizing the need, researchers developed protections based on adversarial attacks on diffusion models (Salman et al., ; Liang et al., ; Shan et al., ; Van Le et al., ; Shan et al., ). These protections add tiny adversarial perturbations to images. Diffusion models customized on these perturbed images will be poisoned, and the generated images will suffer a degradation in quality. This makes unauthorized customization fail in producing usable images, thus penalizing such attempts. Applications based on these protections (Shan et al., ; Liang & Wu, ; Shan et al., ) have safeguarded private images in practice.

However, current protections are not strong enough to hold effective when the protection strength is limited, i.e. the adversarial perturbation budget is small, which is a practical need to maintain the visual effects of the protected images. Figure 1 demonstrates examples of customization images with existing protection. Under a small protection strength, existing protections appear to put patterns on only some locations of customization output images. The main content of the image remains intact. This raises concerns about the effectiveness of current protections and asks for stronger ones.

In this paper, we propose a stronger protection against unauthorized diffusion customization based on adversarial attacks. We notice that all state-of-the-art protections depend on untargeted attacks on diffusion models. We explore adapting the targeted attack for adversarial attacks on classifiers to the context of diffusion models. Specifically, the targeted attack minimizes the distance between model outputs and a pre-defined target. Since this attack creates score-function errors in a consistent direction, we denote this method by Attacking with Consistent score-function Errors (ACE). Empirically, we find that the selection of the target has great impacts on the performance of ACE. With properly selected targets, ACE can produce customization output images all covered by chaotic patterns (see the last two columns of Figure 1). Through extensive experiments, we validate that ACE outperforms all baselines in two mainstream diffusion customizations.

In addition, we delve into the mechanism of targeted and untargeted attacks on diffusion models. Based on our observation, we propose a hypothesis on how attack-based protections work to degrade diffusion customization, that customization diffusion models are degraded because they try to minimize the score-function error introduced by attacks. According to this hypothesis, we show that targeted attacks like ACE unifie the pattern of score-function errors in different protected images, thus reinforcing the bad pattern learned by diffusion models. This provides an intuitive explanation on why the targeted attack ACE outperforms all untargeted baselines.

The contributions of this paper are two-fold. First, we propose ACE, a novel protection method against unauthorized diffusion customization. ACE outperforms existing protections and sets a new milestone in poisoning diffusion models and degrading the image quality of diffusion customization. To the best of our knowledge, ACE is the first targeted-attack-based protection that outperforms untargeted-attack-based protections. Second, we propose a hypothesis on how attack-based protections work based on our observation. This will help future research comprehend and develop even stronger protections against unauthorized diffusion customization.

## 2 Background

Diffusion Models Diffusion Models (Sohl-Dickstein et al., ; Song & Ermon, ; Ho et al., ) are built on a forward and reverse process that map the noise and data distribution. The forward process perturbs the data progressively to approximate Gaussian noise. The reverse process exploits a parameterized score-function $s_{\theta}$ to generate data by denoising noise step-by-step. These two processes can be interpreted by a forward and a reverse SDE (Anderson, ; Song et al., ):

$$ $\displaystyle d\bm{x}$ $\displaystyle=\bm{f}(\bm{x},t)dt+g(t)d\bm{w}$ (1) $\displaystyle d\bm{x}$ $\displaystyle=[\bm{f}(\bm{x},t)-g^{2}(t)\nabla_{\bm{x}}\log p_{t}(\bm{x})]dt+g (t)d\bar{\bm{w}}$ $$

where $\bm{w}$ and $\bar{\bm{w}}$ are standard Wiener processes when time flows from 0 to $T$ and backwards, and $dt$ are infinitesimal timesteps (Song et al., ). Diffusion models are then trained by minimizing the score-function error, the difference between predicted score-function $s_{\theta}(x,t)$ by neural network $\theta$ and the ground truth score function $\nabla_{\bm{x}}\log p_{t}(\bm{x})$, since the score function is the only unknown term in Equation 1. The training objective is given by:

$$ $\displaystyle\min_{\theta}\mathbb{E}_{t}\mathbb{E}_{x(t)|x(0)}$ $\displaystyle\|\underbrace{s_{\theta}(x(t),t)-\nabla_{x(t)}\log p_{t}(x(t)|x(0 ))}_{\epsilon_{\theta}(x(t),t):\text{ score-function error}}\|^{2}_{2}$ (2) $$

Following all existing research on protections against unauthorized diffusion customization (Liang et al., ; Liang & Wu, ; Shan et al., ; ; Salman et al., ; Van Le et al., ; Xue et al., ), we mainly consider a specific kind of diffusion models, Latent Diffusion Model (LDM) (Rombach et al., ), in the context of unauthorized diffusion customization. LDM deploys its forward and reverse processes on a latent representation space $z=\mathcal{E}(x)$ given by an encoder $\mathcal{E}(\cdot)$, and instantiates $\bm{f}(\bm{x},t)$ and $g(t)$ as the linear schedule (Ho et al., ).

As in existing works, we only consider LDM because it is the basis for most mainstream (unauthorized) diffusion customization. Notably, there are various architecture variants for diffusion models nowadays, including IF and DALLE. However, neither of these architectures supports customizations, thus avoiding concerns of unauthorized customization. Hence, in the rest of this paper we focus on LDM and its customization.

Diffusion Customization Diffusion customization (or diffusion personalization (Zhang et al., )) refers to customizing the generated images by diffusion models according to the references from user inputs. These user inputs cover reference images (Meng et al., ), text description (Saharia et al., ), sketches (Zhang & Agrawala, ), styles (Ruiz et al., ; Zhang et al., ), and identities (Ruiz et al., ; Ye et al., ; Wang et al., ). Among these customization methods, LoRA+DreamBooth (Hu et al., ; Ruiz et al., ) and SDEdit (Meng et al., ) are two mainstream methods that cover most of the customization practice (See our brief survey in Appendix D). Hence, we follow the setup of existing works (Van Le et al., ; Liang et al., ; Xue et al., ) to focus on these two methods.

Adversarial Attacks & Protections against Unauthorized Diffusion Customization Adversarial attacks on Diffusion Models (Salman et al., ; Liang et al., ; Shan et al., ; Liang & Wu, ; Van Le et al., ; Zhao et al., ; Xue et al., ) have been used to protect private images against unauthorized diffusion customization. Specifically, these attacks add tiny adversarial perturbations to private images as protections. Diffusion models customized (fine-tuned (Hu et al., ; Ruiz et al., ) or referring to (Meng et al., )) the protected images will produce images of degraded quality in customized generation. This will penalize the attempt to customize diffusion models on unauthorized private images.

It is noticeable that all existing protections are based on untargeted attacks on diffusion models. Those untargeted objectives maximize the score-function error in Equation 2 by optimizing the image perturbation $\eta$ within the perturbation budget $\zeta$, which is formulated by Equation 3.

$$ $\displaystyle\max_{\eta}\mathbb{E}_{t}$ $\displaystyle\mathbb{E}_{z^{\prime}(t)|z^{\prime}(0)}\|\underbrace{s_{\theta}( z^{\prime}(t),t)-\nabla_{z^{\prime}(t)}\log p_{t}(z^{\prime}(t)|z^{\prime}(0)) }_{\epsilon_{\theta}(z^{\prime}(t),t):\text{ score-function error}}\|^{2}_{2}$ (3) $\displaystyle\text{where }z^{\prime}(0)=\mathcal{E}(x^{\prime}),x^{\prime}=x+ \eta,\eta\in[-\zeta,\zeta]$ $$

Here, $x$ is the clean image and $z^{\prime}(0)$ is the latent representation of $x^{\prime}$ with LDM encoder $\mathcal{E}(\cdot)$. Empirically, this untargeted attack does not yield satisfying effectiveness in degrading the quality of the customization image (see the examples in Figure 1). In this paper, we improve the protection effectiveness by introducing targeted attacks in Section 3 and provide qualitative analysis to explain our improvements in Section 5.

## 3 Targeted Attack as Protection against Unauthorized Diffusion Customization

Our intuition of introducing targeted attack is simple. We notice that there is an objective mismatch between protection against unauthorized diffusion customization and untargeted attacks on diffusion models (Equation 3). Specifically, protection seeks for degrading the image quality of diffusion customization, while untargeted attack’s goal is to minimize the log-likelihood of the protected image and make it not like a real image. However, images with bad quality are not necessary to have a low log-likelihood. Hence, a more straightforward approach to degrade the quality of the customization image is to directly make the protected image similar to a bad quality image. When referring to the protected image, diffusion customization will generate images similar to that bad-quality image. We implement this approach by introducing a targeted attack on protection (Section 3.1) and use a bad quality image as the target (Section 3.2).

### 3.1 Attacking with Consistent Errors

We start from comparing classical untargeted and targeted adversarial attacks (Goodfellow et al., ; Madry et al., ), where both work soundly in attacking classifiers:

$$ $\left\{\begin{aligned} &\max_{\eta}\|p_{\theta}(y|x^{\prime})-\bm{e}_{true}\|_ {2}^{2},\quad\quad\quad\quad&\text{(untargeted attack)}\\ &{\color[rgb]{1,.5,0}\min_{\eta}}\|p_{\theta}(y|x^{\prime})-{\color[rgb]{ 1,.5,0}\bm{e}_{target}}\|_{2}^{2},\quad\quad\quad\quad&\text{(targeted attack) }\end{aligned}\right.$ $$

Here, $\bm{e}_{true}$ and $\bm{e}_{target}$ are one-hot expressions of the ground-truth label $y_{true}$ and target label $y_{target}$. We notice that targeted attack simply 1) replace the ground truth in untargeted attack with a target and 2) flip maximization to minimization to reduce the distance between the adversarial label and the target label. Inspired by this comparison, we conduct a mirroring transformation on the untargeted attack, given by Equation 3, and transfer it to a targeted attack.

First, we replace the ground truth with a target. The ground truth in Equation 3 refers to the score function $\nabla_{z^{\prime}(t)}\log p_{t}(z^{\prime}(t)|z^{\prime}(0))$. We replace it with a pre-defined target $\mathcal{T}$. Second, we replace maximization with minimization to minimize the distance between the predicted score function $s_{\theta}(z^{\prime}(t),t)$ and the target $\mathcal{T}$. This yields a new targeted attack on diffusion models, shown as follows:

$$ $\left\{\begin{aligned} &\max_{\eta}\mathbb{E}_{t}\mathbb{E}_{z^{\prime}(t)|z^{ \prime}(0)}\|s_{\theta}(z^{\prime}(t),t)-\nabla_{z^{\prime}(t)}\log p_{t}(z^{ \prime}(t)|z^{\prime}(0))\|^{2}_{2},\quad\quad\quad\quad&\text{(untargeted attack)}\\ &{\color[rgb]{1,.5,0}\min_{\eta}}\mathbb{E}_{t}\mathbb{E}_{z^{\prime}(t)|z^{ \prime}(0)}\|s_{\theta}(z^{\prime}(t),t)-{\color[rgb]{1,.5,0}\mathcal{T}}\|^{2 }_{2},\quad\quad\quad\quad&\text{(targeted attack)}\end{aligned}\right.$ $$

For different protected images $x^{\prime}$, this targeted attack uses a consistent target $\mathcal{T}$ as the direction to optimize adversarial perturbations. Hence, we denote this novel targeted attack by Attacking with Consistent Errors (ACE).

$$ $\displaystyle\min_{\eta}\mathbb{E}_{t}\mathbb{E}_{z^{\prime}(t)|z^{\prime}(0)} \|s_{\theta}(z^{\prime}(t),t)-\bm{\mathcal{T}}\|^{2}_{2}$ (4) $\displaystyle\text{where }z^{\prime}(0)=\mathcal{E}(x^{\prime}),x^{\prime}=x+ \eta,\eta\in[-\zeta,\zeta]$ $$

Intuitively, ACE misleads the model to predict score function with the pattern of target $\mathcal{T}$ for the protected image $x^{\prime}$. When customized on $x^{\prime}$, diffusion models will learn the pattern of $\mathcal{T}$. Therefore, by placing a chaotic pattern in $\mathcal{T}$, we can then make diffusion models that are customized on the protected image learn the chaotic pattern and generate images with this pattern, thus degrading the performance of unauthorized diffusion customization.

In addition to ACE, we also consider an existing targeted attack objective introduced in Liang & Wu (), which is specific designed for LDM (Rombach et al., ), the point-of-interests diffusion model of unauthorized customization. This term directly minimizes the distance between a target $\mathcal{T}$ and the latent representation of the image $x^{\prime}$. Empirically, this objective is useful for encountering image reference diffusion customization such as SDEdit (Meng et al., ). We therefore weight this objective by $\alpha$ and combine it with ACE, which creates a new attack denoted by ACE+:

$$ $\displaystyle\min_{\eta}\mathbb{E}_{t}$ $\displaystyle\mathbb{E}_{z^{\prime}(t)|z^{\prime}(0)}\|s_{\theta}(z^{\prime}(t ),t)-\bm{\mathcal{T}}\|^{2}_{2}+\alpha\|z^{\prime}(0)-\bm{\mathcal{T}}\|^{2}_{2}$ (5) $\displaystyle\text{where }z^{\prime}(0)=\mathcal{E}(x^{\prime}),x^{\prime}=x+ \eta,\eta\in[-\zeta,\zeta]$ $$

### 3.2 Target Selection

As mentioned in Section 3.1, good protection effectiveness of ACE/ACE+ depends on a carefully-designed target $\mathcal{T}$. This target must be with chaotic patterns to human vision so that unauthorized diffusion customization will learn these chaotic patterns from the protected image and suffer performance degradation. Our next task is to design such targets with chaotic patterns.

Figure: Figure 2: Target $\bm{\mathcal{T}}$ (left) and its corresponding image (right)
Refer to caption: extracted/5921025/figs/target.png

Previous research suggests several aspects of a chaotic patterns from the perspective of human vision: 1) high contrast stripes (Wilkins, ), 2) Moire patterns (Amidror, ), and 3) overly busy patterns (Bell, ). Following these suggestions, we pick the latent representation of the target image used in Liang & Wu () as our basic target. This target has a high contrast of black and white and repeats a motif to create overly busy and Moire-like patterns, which fits the standard of chaotic patterns for human vision. Based on the basic target, we tune the contrast and the repeating number of the motif as hyperparameters. See Appendix B.4.1 for details. With the optimal contrast and repeating number, we determine the final target $\mathcal{T}$ as shown in Figure 2.

To cross-validate our insights in target selection, we additionally design a similar target following the above ideas of chaotic patterns. Specifically, we change the motif of the target in Figure 2 to another, improve its contrast to black and white, and repeat it in one image. This new target is shown in Figure 9. We denote ACE with this new target as ACE^∗ and evaluate ACE^∗ together with ACE and ACE+ in Section 4 as an ablation study.

### 3.3 Implementation as Protection against Unauthorized Customization

Our method combines the objective function in Equation 4/ 5 and the selected target $\mathcal{T}$. We also include fine-tuning steps in our method, following ASPL (Van Le et al., ) (5 steps for each iteration). As discussed in its original paper, this is the standard poisoning pipeline for adversarial attacks and brings simple performance gain for adversarial attacks on diffusion models, both untargeted and targeted. For the optimization of ACE/ACE+, we use the classic PGD algorithm (Madry et al., ), following existing protections. Putting everything together, we finalize our method in Algorithm 1. To use ACE/ACE+ as protection against unauthorized diffusion customization, one can input the clean image $x$ into Algorithm 1 and take the output image $x^{\prime}$ as the protected version of $x$. Other implementation details are given in Appendix A.

Note that ACE/ACE+ are the first targeted attack that outperform untargeted attack on diffusion models (see our experiments in Section 4). However, they are not the first targeted attack on diffusion models. While targeted attacks were considered by previous research (e.g. ASPL-T (Van Le et al., )), they failed in beating untargeted attacks. We discuss the reason in Appendix B.4.1.

Figure: Algorithm 1 Attacking with Consistent Errors (ACE)

## 4 Experiments

We compare ACE/ACE+/ACE^∗ to existing protections against unauthorized diffusion customization in two main diffusion customization methods, LoRA+DreamBooth (Hu et al., ; Ruiz et al., ) and SDEdit (Meng et al., ). We also evaluate our protection on DreamBooth, detailed in Appendix B.3. Our methods outperform baselines both in quantitative metrics and qualitative visualization (Section 4.2). We also conduct user studies in an artist community, which validates the superiority of our protections (Section 4.3). Furthermore, we test the transferability (Section 4.4) and robustness to purification (Section 4.5) of ACE/ACE+. We also
investigate the computational cost of our methods and baselines (Appendix B.1). Our ablation studies focus on the effect of the objective function, target selection (Appendix B.4.1), different text prompts (Appendix B.4.2) and perturbation magnitudes (Appendix B.4.3) to the protection effectiveness.

### 4.1 Experimental Setups

Experimental Setups on LoRA+DreamBooth LoRA+Dreambooth (Hu et al., ; Ruiz et al., ) (LoRA for simplicity) is the most widely used customization method for diffusion models, occupying a share of more than $90\%$ in the open-source customization platform. LoRA fine-tunes diffusion models with low-ranked adapters on dozens of reference images and generates images with similar contents or styles. Due to its power and convenience, LoRA is the main tool for customization of unauthorized diffusion.

In our experiments, we use LoRA to fine-tune the diffusion model on protected reference images. Fine-tuning is done with 20 protected images with the same content or style. We then generate 100 output images with the fine-tuned customization diffusion models and assess image quality with CLIP-IQA (Wang et al., ) (CLIP-IQA). A high CLIP-IQA score indicates low image quality and strong protection performance. We also follow (Van Le et al., ) to introduce two facial image quality metrics in our experiments on CelebA-HQ: Face Detection Failure Rate (FDFR) (Deng et al., ) and Identity Score Matching (ISM) (Deng et al., ). A strong protection expects a high FDFR by making the face detection (is there a face) failed and a low ISM by disrupting the facial identification (who is the face).

Experimental Setups on SDEdit SDEdit (Meng et al., ) is an image-to-image customization method that modifies the content or style of a single reference image while keeping the structural similarity, i.e. the layout of the reference image.

In our experiments, we use SDEdit to generate output images based on protected reference images. The strength of SDEdit is set as $0.3$. Successful protections destroy this structural similarity between the output image and its corresponding reference image. Hence, we adopt Multi-Scale SSIM (MS-SSIM) (Wang et al., ) and CLIP Image-to-Image Similarity (CLIP-SIM) (Wang et al., ), two measurements for image-to-image similarity. We include MS-SSIM for structural similarity and CLIP-SIM for semantic similarity. A strong protection is expected to have both metrics low.

Datasets & Backbone Model The experiment is conducted on CelebA-HQ (Karras et al., ) and Wikiart (Saleh & Elgammal, ). For CelebA-HQ, we select 100 images and each of 20 photos describe one identical person. For Wikiart, we select 100 paintings that each of 20 paintings come from the same artist. We use Stable Diffusion 1.5 as the backbone model for protections, since it is the most popular diffusion model in (unauthorized) diffusion customization. We also investigate the cross-model transferability of ACE/ACE+ with Stable Diffusion 1.4 and Stable Diffusion 2.1 in Section 4.3. As discussed in Section 2, we do not consider other diffusion models because they are either 1) close-sourced so that they do not support customization (e.g. DALLE3) or 2) lack of well implemented customization pipeline (e.g. DeepFloyd IF).

Hyperparameters The adversarial budget $\zeta$ is set as $4/255$. Note that this budget is smaller than those in existing literature, such as $8/255$ Liang et al. (); Van Le et al. () and $16/255$ Salman et al. (), for these large budgets will add perceptible noise to the image that hurt the image quality. Hence, we use a smaller budget to simulate the real-world application scenario. The step length and the number of step in PGD (Madry et al., ) are $5\times 10^{-3}$ and $50$. We adopt LoRA for fine-tuning steps in Algorithm 1. Other hyper-parameters are omitted to Appendix A.

Baselines We compare ACE/ACE+ with existing methods, including AdvDM (Liang et al., ), Encoder Attack and Diffusion Attack in PhotoGuard (Salman et al., ), and ASPL (Anti-DreamBooth) (Van Le et al., ).
Encoder Attack and Diffusion Attack in PhotoGuard (Salman et al., ) are denoted by PG and PG+, respectively.

**Table 1: Comparison of baseline protections and our protections on LoRA and SDEdit. ACE is our basic method in Equation 4. ACE+ combines ACE and an existing targeted attack (Equation 5). ACE* uses a target other than ACE/ACE+.**
|  | CelebA-HQ | WikiArt |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|  | SDEdit | LoRA | SDEdit | LoRA |  |  |  |  |
|  | MS-SSIM $\downarrow$ | CLIP-SIM $\downarrow$ | CLIP-IQA $\uparrow$ | FDFR $\uparrow$ | ISM $\downarrow$ | MS-SSIM $\downarrow$ | CLIP-SIM $\downarrow$ | CLIP-IQA $\uparrow$ |
| Clean | 0.88 | 93.38 | 20.66 | 0.02 | 0.69 | 0.62 | 89.77 | 22.88 |
| PG | 0.86 | 89.24 | 27.52 | 0.02 | 0.72 | 0.62 | 88.01 | 37.52 |
| PG+ | 0.82 | 91.00 | 22.91 | 0.04 | 0.71 | 0.57 | 89.80 | 32.62 |
| AdvDM | 0.81 | 83.41 | 24.53 | 0.04 | 0.71 | 0.30 | 85.29 | 34.03 |
| ASPL | 0.82 | 84.12 | 33.62 | 0.33 | 0.48 | 0.30 | 87.25 | 46.74 |
| ACE | 0.73 | 74.70 | 31.46 | 1.00 | N/A | 0.23 | 76.13 | 40.54 |
| ACE+ | 0.69 | 67.47 | 35.68 | 0.07 | 0.58 | 0.29 | 76.07 | 48.53 |
| ACE* | 0.76 | 72.52 | 32.76 | 0.75 | 0.47 | 0.13 | 73.92 | 76.50 |

### 4.2 Overall Result

We compare ACE/ACE+/ACE^∗ to existing protections against unauthorized diffusion customization. The overall results of the comparison are given in Table 1, where ACE/ACE+/ACE^∗ outperform all the baseline methods in degrading the image quality of SDEdit and LoRA. It is noticeable that ACE achieves a FDFR of 1.00(^1^11When FDFR is 1.00, ISM is not defined because no face is detected in all the output images). This means that $0\%$ of the customization images are recognized as face images with the protection of ACE. This is strong evidence that our protections significantly outperform existing methods. Moreover, ACE^∗ performs similarly or even better than ACE/ACE+, indicating that our strategy of target selection is successful and robust with the motif in the target varying. Among all baselines, ASPL has the strongest performance. As mentioned in Section 3.3, this is the credit of introducing fine-tuning in the protection.

In addition to quantitative evaluation, we visualize the customization output images under different protection. Figure 1 showcases output images of LoRA and SDEdit under the protection of baselines and ACE/ACE+. We visualize the output images of ACE^∗ as an ablation study in Figure 10. Notably, all baseline methods only add chaotic patterns to some parts of the output image. Diffusion customization still succeeds in generating images with correct contents and styles. In contrast, ACE/ACE+ covers the whole output image with high contrast and overly busy patterns, making the image completely unusable. This advantage distinguishes ACE/ACE+ from existing protection against unauthorized diffusion customization. More visualization is given in Appendix E.

**Table 2: Transferability results of ACE (top) and ACE+ (middle) and visualization of ACE’s output images (bottom). MS, CS, and CI stand for MS-SSIM, CLIP-SIM, and CLIP-IQA. Our methods maintain effective across different models by bringing different degradation to the output images.**
| Victim | SD1.4 | SD1.5 | SD2.1 |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Backbone | SDEdit | LoRA | SDEdit | LoRA | SDEdit | LoRA |  |  |  |
| MS $\downarrow$ | CS $\downarrow$ | CI $\uparrow$ | MS $\downarrow$ | CS $\downarrow$ | CI $\uparrow$ | MS $\downarrow$ | CS $\downarrow$ | CI $\uparrow$ |  |
| No attack | 0.85 | 91.71 | 20.32 | 0.85 | 91.16 | 19.22 | 0.80 | 79.00 | 16.78 |
| SD1.4 | 0.73 | 77.24 | 38.13 | 0.73 | 77.58 | 35.98 | 0.62 | 60.82 | 35.45 |
| SD1.5 | 0.73 | 77.29 | 36.65 | 0.73 | 77.50 | 32.11 | 0.72 | 60.10 | 45.05 |
| SD2.1 | 0.72 | 76.20 | 46.08 | 0.62 | 76.80 | 39.08 | 0.60 | 59.12 | 43.89 |
| Victim | SD1.4 | SD1.5 | SD2.1 |  |  |  |  |  |  |
| Backbone | SDEdit | LoRA | SDEdit | LoRA | SDEdit | LoRA |  |  |  |
| MS $\downarrow$ | CS $\downarrow$ | CI $\uparrow$ | MS $\downarrow$ | CS $\downarrow$ | CI $\uparrow$ | MS $\downarrow$ | CS $\downarrow$ | CI $\uparrow$ |  |
| No attack | 0.85 | 91.71 | 20.32 | 0.85 | 91.16 | 19.22 | 0.80 | 79.00 | 16.78 |
| SD1.4 | 0.67 | 66.83 | 40.69 | 0.67 | 66.40 | 31.53 | 0.58 | 56.41 | 67.96 |
| SD1.5 | 0.67 | 66.58 | 41.16 | 0.67 | 66.13 | 36.05 | 0.58 | 57.17 | 68.50 |
| SD2.1 | 0.67 | 66.33 | 41.80 | 0.67 | 57.17 | 41.96 | 0.58 | 57.27 | 73.59 |

### 4.3 User Study

Protections against unauthorized diffusion customization aim at making the output image of unauthorized customization unusable in graphic art industries. The gold standard for evaluating protection is user studies by graphic artists. Hence, we conduct a survey in an artist community on the comparative effectiveness of two most competitive protections: ASPL (Van Le et al., ), and ACE. Basically, our survey asks participants to pick the image with the worst quality out of two customization output images under the protection of ASPL, and ACE, respectively. The strongest protection should make the output image of the worst quality. We omit the details to Appendix D. The survey covers 1304 artists, whose result shows that ACE produces the worst customization output image among $55\%$ of the examples.

### 4.4 Transferability

Protections against unauthorized diffusion customization are based on white-box and model-dependent adversarial attacks. Hence, it is important to investigate the transferability of ACE/ACE+ over different diffusion models to validate their utility. We follow existing literature (Liang et al., ; Xue et al., ) to evaluate this transferability on three text-guided diffusion models: Stable Diffusion 1.4, Stable Diffusion 1.5, and Stable Diffusion 2.1. As mentioned in Section 2 and Section 4.1 and shown in Appendix D, we only consider these SD-family models because they cover most of unauthorized diffusion customization.

In this experiment, backbone means the model used to generate adversarial examples and victim means the model used in few-shot generation. We pick 100 images from CelebA-HQ, 20 in each of 5 groups, to generate adversarial examples on three backbone models and run SDEdit and LoRA with these adversarial examples on three victim models. The strength of SDEdit is set to 0.4 for visualizing the differences. Other experimental setups stay the same with Section 4.1. Table 2 shows that ACE/ACE+ can degrade diffusion customization even when the victim is different from the backbone. We omit the detailed explanation of the result to Appendix E.2.

**Table 3: Quantitative results and visualization of ACE under different purification methods. Most of purifications even degrade the image quality because they also erase semantic information of the reference image when purifying out protections.**
| Defense | NA | Gaussian | JPEG | Resizing | SR | DiffPure |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Param |  | $\sigma=4$ | $\sigma=8$ | $Q=20$ | $Q=70$ | 2x | 0.5x |  |  |
| CLIP-IQA $\uparrow$ (LoRA) | 25.51 | 17.24 | 28.39 | 38.13 | 29.01 | 26.10 | 32.91 | 39.63 | 49.25 |
| MS-SSIM $\downarrow$ (SDEdit) | 0.54 | 0.70 | 0.64 | 0.75 | 0.75 | 0.79 | 0.76 | 0.45 | 0.40 |

### 4.5 Robustness to purification

We investigate how ACE survives common denoising adversarial purification. We follow the setup in Liang et al. () to consider Gaussian (Zantedeschi et al., ), JPEG (Das et al., ), Resizing (Xie et al., ), SR (Mustafa et al., ), and DiffPure (Nie et al., ). The adversarial budget is set as 8/255 while other setups follow Section 4.1. Among these purification methods, Gaussian adds Gaussian noise with variance 4 and 8 to the image. Two JPEG qualities, 20 and 70, are tried. Resizing includes two setups: 2x up-scaling + recovering (2x) and 0.5x down-scaling + recovering (0.5x). Other details are omitted to Appendix B.2.

Table 3 posts the CLIP-IQA for LoRA and MS-SSIM for SDEdit for ACE under denoising-based purification. Gaussian is the most useful method in purifying ACE, while other methods are disable in countering ACE. Notably, as the state-of-the-art purfication method, DiffPure tends to remove too many details of the image so that the customization output image loses some basic semantics of the reference image. Although our protections could be removed by this powerful purifier, it also greatly degrades the performance of diffusion customization, where we achieve our goal in a different way.

## 5 Discussion: How can targeted attack beats untargeted attack?

Figure: Figure 3: Comparison between $\epsilon_{adv}$ and $\mathcal{B}_{spl}$ of ASPL and ACE. Blue-framed images are protected images that we use to compute $\epsilon_{adv}$. Red-framed images are clean images that we use to compute $\mathcal{B}_{spl}$. We visualize $\epsilon_{adv},\mathcal{B}_{spl}\in\mathbb{R}^{64\times 64\times 4}$ as images with 4 channels. Complementary colors mean two pixel are reverse to each other. There is visible pattern correlation between $\epsilon_{adv}$ and $\mathcal{B}_{spl}$ in ACE.
Refer to caption: extracted/5921025/figs/vis_comp_spl.png

While ACE/ACE+/ACE^∗ beat baselines in protecting private images from unauthorized diffusion customization empirically, it is non-trivial to explain our success. In this section, we discuss the process of fine-tuning diffusion models on protected images and provide one view of analysis on how these attack-based protections work and why ACE/ACE+/ACE^∗ outperform existing methods.

First, we introduce the notation of our analysis. We use $x$ and $x^{\prime}$ to denote the clean and protected image and $\theta$ and $\theta^{\prime}$ for the original diffusion model (without customization) and the diffusion model customized on protected image $x$. Then, we introduce two intermediates that help us analyze the mechanism of attack-based protections:

1) $\epsilon_{adv}$ is the score function error of the protected image $x^{\prime}$ in the original diffusion model $\theta$.

2) $\mathcal{B}_{spl}$ is the score-function error of clean image $x$ in the original diffusion model $\theta^{\prime}$.

$$ $\left\{\begin{aligned} &\epsilon_{adv}:=\mathbb{E}_{t}\mathbb{E}_{z^{\prime}(t )|z^{\prime}(0)}\|s_{\theta}(z^{\prime}(t),t)-\nabla_{z^{\prime}(t)}\log p_{t} (z^{\prime}(t)|z^{\prime}(0))\|^{2}_{2}\\ &\mathcal{B}_{spl}:=\mathbb{E}_{t}\mathbb{E}_{z(t)|z(0)}\|s_{\theta^{\prime}}( z(t),t)-\nabla_{z(t)}\log p_{t}(z(t)|z(0))\|^{2}_{2}\end{aligned}\right.$ $$

Intuitively, $\epsilon_{adv}$ reflects the difference between protected images and clean images from the perspective of the original diffusion model. $\mathcal{B}_{spl}$ reflects the error made by the customized diffusion model when predicting the score function of clean image.

To explain what happens when fine-tuning diffusion models on protected reference images, we visualize $\epsilon_{adv}$ and $\mathcal{B}_{spl}$ in ASPL and ACE, whose result is shown by Figure 3. Surprisingly, there is obvious reversal relationship between $\epsilon_{adv}$ and $\mathcal{B}_{spl}$ in ACE. The cosine similarity between $\epsilon_{adv}$ and $\mathcal{B}_{spl}$ in ACE is -0.3044. This indicates that what customized diffusion models learn from protected reference images is to output with a bias which reverses the score-function error of protected reference images.

Figure: Figure 4: Demonstration of three steps in Hypothesis 5.1. First, Attacking step increases $\epsilon_{adv}$ of protected images. Second, Finetuning step trains the diffusion model to $\epsilon_{adv}$ by a bias $\mathcal{B}_{spl}$, whose direction is reversal to $\epsilon_{adv}$. Third, customized diffusion models include $\mathcal{B}_{spl}$ in sampling so that their output images appear to have chaotic patterns. This hypothesis explains why $\epsilon_{adv}$ and $\mathcal{B}_{spl}$ of ACE are reverse to each other as shown in Figure 3.
Refer to caption: extracted/5921025/figs/evolving_distribution_heatmap.png

Base on this observation, we present a hypothesis on the mechanism of adversarial attacks on diffusion models, demonstrated by Figure 4

###### Hypothesis 5.1 (Mechanism of attack-based protection on diffusion models (informal)) .

First, attacks maximize the score-function error of protected images and introduce chaotic patterns to the error. Second, customized diffusion models are fine-tuned to minimize the score-function error of protected images, where a reversal bias is learned to overcome chaotic patterns in the error. Third, customized diffusion models also include the above reversal bias when generating customization images. This makes the customization output images come with reverse chaotic patterns.

Following this hypothesis, we can give an explanation to the success of ACE: ACE uses a unified target to guide the chaotic pattern in all protected images. Therefore, the customized diffusion model learns to minimize one fixed chaotic pattern in score-function error when fine-tuning on different protected images. This induces the model to learn a fixed bias to reverse the fixed chaotic pattern. This bias is then brought to the output image generated by the customized diffusion model, explaining why we see a unified chaotic pattern in the customization output image under ACE.

In contrast, untargeted attacks do not unify the chaotic pattern in different protected images. The customized diffusion model cannot minimize score-function errors of different protected images by learning to reverse one chaotic pattern. Hence, we cannot see unified chaotic pattern in the customization output image. Although untargeted attacks could produce stronger chaotic patterns specifically for different protected images, these patterns do not work jointly or even conflict to each other in the training of customized diffusion model. This is the potential reason that targeted attacks beat untargeted attacks in this special task.

###### Hypothesis 5.1 (Mechanism of attack-based protection on diffusion models (informal)) .

## 6 Conclusion

In this paper, we propose a simple yet effective protection method against unauthorized diffusion customization. Based on a targeted adversarial attack on diffusion models, we show that our method beats all existing protection through extensive experiments, with sound transferability and robustness to purification. We further analyze the mechanism of attack-based protections, providing a novel view to comprehend and explain the mechanism of adversarial attacks on diffusion models.

## Appendix A Implementation and Experimental Details

LoRA+DreamBooth For the evaluation, we finetune LDM with on CelebA-HQ dataset using the prompt a photo of a sks person, which was first used in the paper of ASPL (Van Le et al., ). This is because CelebA-HQ consists of portraints of certain people. Similarly, we use the prompt a photo of a sks painting on the WikiArt dataset, because WikiArt consists of paintings by certain artists. The number of finetuning epochs is set to be $1000$ which ensures LoRA on clean images achieves considerate performance.

SDEdit The strength of SDEdit is set to be $0.3$, which makes sense because a higher strength modifies the input image too much and a lower one keeps too many details of the input image. We use a null prompt to avoid the effect of prompts in the generation.

Metrics For MS-SSIM, we use the default setting in the implementation (^2^22https://github.com/VainF/pytorch-msssim). CLIP-SIM computes the cosine similarity between the input images and the output images in the semantic space of CLIP (Radford et al., ) and is given by the following definition:

$$ $\text{CLIP-SIM}(X,Y)={\color[rgb]{0,0,0}100\times}\cos(\mathcal{E}_{clip}(X), \mathcal{E}_{clip}(Y))$ (6) $$

where $\mathcal{E}_{clip}$ is the vision encoder of the CLIP Radford et al. () model. CLIP-IQA is a non-reference image quality assessment metric that computes the text-image similarity between the image and some positive & negative prompts. In the official implementation (^3^33https://github.com/IceClear/CLIP-IQA), the author exploits prompts such as Good image, Bad image, and Sharp image. An image with high quality is expected to have high text-image similarity with positive prompts and low text-image similarity with negative prompts. In our experiments, we use the positive prompt A good photo of a person and the negative prompt A bad photo of a person for CelebA-HQ and the positive prompt A good photo of a painting and the negative prompt A bad photo of a painting for WikiArt. Since we want to measure how poor the output image quality is, we use the text-image similarity between output images and the negative prompt. A strong adversarial attack results in low quality of output images and a high similarity between output images and the negative prompt.

Image Resolution The standard resolution for SD1.x is 512, while the one for SD2.x is 768. For cross-model transferability experiments, we set the resolution of every model to 512, disregarding that the standard resolution of SD2.1 is 768. The reason for this uniform resolution is to avoid the resizing, which may introduce distortion to the attacks. However, as LoRA on SD2.1 naturally generate image of resolution 768, we still test LoRA performance on SD2.1 on resolution 768.

Baseline Implementation We use the official implementation of PhotoGuard (^4^44https://github.com/MadryLab/photoguard),
PhotoGuard+ (^5^55https://github.com/MadryLab/photoguard),
AdvDM (^6^66https://github.com/mist-project/mist), and ASPL (^7^77https://github.com/VinAIResearch/Anti-DreamBooth) in our experiments. For PhotoGuard and PhotoGuard+, we follow the default setup in the
official Python implementation file (^8^88https://github.com/MadryLab/photoguard/blob/main/notebooks/demo_simple_attack_inpainting.ipynb)  (^9^99https://github.com/MadryLab/photoguard/blob/main/notebooks/demo_complex_attack_inpainting.ipynb), except for tuning the adversarial budget to $4/255$. We also set the surrogate model of PhotoGuard to be Stable Diffusion v1.5. PhotoGuard+ aims to attack an impainting task, and we simply set the impainting mask to 1 for all pixels, as both SDEdit and LoRA operates on full pixels. For AdvDM, we also follow the default setup in the official implementation. For ASPL, we directly use the official implementation except for transferring it to LoRA. The default setup sets $10$ steps of training LoRA and $10$ steps of PGD attacks in every epoch. However, the default epochs of ASPL is too time-consuming. Therefore, we tune the total epochs of one single attack to be $4$, which is a fair comparison for our method.

Hyperparameters & Implementation Details For ACE+, the loss weight $\alpha$ is set to be $10^{2}$ empirically. LoRA is done for 5 iterations while each iteration finetunes 10 steps. The learning rate is $10^{-5}$. To keep consistent to the real application, we use bfloat16 accuracy for ACE/ACE+. All experiments except PhotoGuard+ are done on one NVIDIA RTX 4090 GPU. The implementation of PhotoGuard+ is done on one NVIDIA RTX A100 GPU.

Visualization of Variables in the Latent Space of LDM We describe how to visualize variables in the latent space of LDM, including $\epsilon_{adv}$, $\mathcal{B}_{x}$, and $\mathcal{B}_{spl}$. These variables are of size $64\times 64\times 4$. Given a variable $E\in\mathbb{R}^{64\times 64\times 4}$, we first do normalization by $E^{\prime}=\frac{E-min(E)}{max(E)-min(E)}$. After the normalization, we directly plot $E^{\prime}$ as a heatmap. The used color bar is demonstrate in Figure 5.

Figure: Figure 5: An example for visualization. We use the same color bar in all visualizations.
Refer to caption: extracted/5921025/figs/target_latent_cbar.png

## Appendix B Additional Experiments

### B.1 Computation Cost

Computation cost is crucial to the utility of adversarial attacks on LDM for. First, they are designed for the sake of private image protection involved in the daily routine of human. This asks for the time efficiency of the attack. Second, the main body of the users are non-developers who do not have access to GPUs with large VRAM. Hence, the attack needs to be memory-efficient.

#### B.1.1 Analysis of the Computation Cost in ACE/ACE+

Time Cost As demonstrated in Algorithm 1, ACE/ACE+ consists of two computing processes: parameter updating (model training, step 5-7 in Algorithm 1) and input updating (PGD, step 8-12 in Algorithm 1). As stated in Appendix A, we set the iteration number to be 4, the parameter updating step number for each iteration to be 10, and the input updating step number to be 50 for each image. Note that the number of image is 20 in our experimental setup. Therefore, we run $5\times 10=50$ steps of parameter updating and $4\times 50\times 20=4000$ steps of input updating. The step number ratio is 1:80. Hence, although one single parameter updating step may consume more time cost than one input updating step(^10^1010As advised by Zhang et al. (), the time cost bottleneck is the back-propagation operation, which is included by both parameter updating steps and input updating steps. Hence, their single step time cost should be similar.), the main proportion of time cost is still cost by input updating. This conclusion is validated by experiments in the following.

Memory Cost The memory cost of ACE/ACE+ consists of three occupies, which store model weights, the computational graph, and the optimizer states, respectively. In the adversarial attack, we only optimize the inputs so the memory used to store optimizer states is small. We save memory cost mainly by decreasing the memory to store model weights and computational graph. We introduce two optimizations to for reducing memory cost, whose efficiency is validated by experiments in the following.

#### B.1.2 Computation Cost Optimizations in ACE/ACE+

To reduce and balance the computation cost of ACE/ACE+, we introduce the following two optimizations:

xFormers We leverage xFormers (Lefaudeux et al., ) to reduce the memory cost used to store the computational graph. xFormers is a toolbox that provides memory-efficient computation operators for training and inference of transformer-based modules. We use their attention operator in the computation of cross attention layers of UNet in LDM when computing gradients.

Gradient Checkpointing Chen et al. () A common tool of memory-efficient training is Gradient Checkpointing. Gradient Checkpointing separates a neural network into blocks. In forward-propagation, it only stores the activation. The back-propagation is done block by block. For each block, it reconstructs the forward computational graph within the block with the stored activation. Then, it constructs the backward computational graph within the block and compute the gradient over the activation. This greatly reduces the GPU memory at the cost of computing time. To balance the memory and time cost, we only apply gradient checkpointing in the down-block, mid-block, and up-block of the UNet.

#### B.1.3 Evaluation: Memory Cost

Table 4 shows the computation cost of ACE and existing attacks. ACE enjoys the lowest memory cost, 5.77 GB, compared to baselines. For the time cost, ACE takes 70.49 seconds to process one image, which is acceptable in real-world private image protection.

**Table 4: Computation cost of our method and baselines**
| Method | Memory/GB | Time/(seconds/image) |
| --- | --- | --- |
| PhotoGuard | 6.16 | 21.06 |
| PhotoGuard+ | 16.79 | 878.43 |
| AdvDM | 6.28 | 13.45 |
| ASPL | 7.33 | 55.63 |
| ACE&ACE+ | 5.77 | 70.49 |

We evaluate the memory cost of baselines and that of ACE/ACE+. We apply baselines and ACE/ACE+ on a group of 20 images from CelebA-HQ and record the maximum memory occupation of the runtime. To better simulate the real-world scenario of artwork protection, this experiment is run on an NVIDIA RTX 3080Ti(^11^1111PhotoGuard+ is an exception because it requires over 16 GB GPU memory. Hence, we run it on an NVIDIA A100 80GB.), which is an off-the-shelf consumer-level GPU. Other setups stay the same as the setup in Section 4.1.

Table 4 shows that the memory cost of ACE/ACE+ is 5.77 GB, lower than those of all baselines. We highlight that our GPU memory cost is lower than 6GB. This means that ACE/ACE+ is able to run on most of the consumer-level GPUs, which has not been achieved by any existing methods. This helps popularize the application of adversarial attacks on LDM as a practical tool for artwork protection. Additionally, we check the memory occupation of two kinds of updating steps. Parameter updating step takes 4.60 GB and input updating step 5.77 GB. This result proves that input updating is the bottleneck for GPU memory cost in ACE/ACE+.

#### B.1.4 Evaluation: Time Cost

We evaluate the time cost of baselines and that of ACE/ACE+. We apply baselines and ACE/ACE+ on a group of 20 images from CelebA-HQ and record the time cost of the runtime. To better simulate the real-world scenario of artwork protection, this experiment is run on an NVIDIA RTX 3080Ti, which is an off-the-shelf consumer-level GPU(^12^1212Similar to the case of the memory cost experiment, PhotoGuard+ is evaluated on A100 80GB. Since PhotoGuard+ is very inefficient, we only post its computation cost as a reference.). We rerun the experiment for three times to reduce the effect of randomness. Other setups stay the same as the setup in Section 4.1.

Table 4 shows that the time cost to process one image of ACE/ACE+ is 88.11 seconds, 27% longer than that of ASPL (Van Le et al., ), our strongest baseline. Considering that one human artist does not need to process dozens of artworks normally, the time cost of ACE/ACE+ is acceptable in real-world application.

We also investigate the time cost proportion between two kinds of updating steps. We rerun ACE for three times following the above setup and record the total time cost to process 20 images of all parameter updating steps and input updating steps separately. As shown in Table 5, parameter updating steps only take $1.46\%$ of the whole time cost, while input updating steps take the rest $98.54\%$. This result validates that input updating takes the larger proportion of time cost.

**Table 5: Time cost of parameter updating and input updating in ACE (processing 20 images).**
|  | Parameter Updating/seconds | Input Updating/seconds | Total/seconds |
| --- | --- | --- | --- |
| Run 1 | 20.61 | 1383.85 | 1405.46 |
| Run 2 | 21.24 | 1396.41 | 1417.65 |
| Run 3 | 19.92 | 1386.30 | 1406.21 |
| Average | 20.59 | 1389.18 | 1409.78 |
| Proportion | 1.46% | 98.54% | 100% |

### B.2 Robustness to purification methods

As discussed in Section 4.5, we conduct an experiment to investigate how ACE survives purification methods. We consider common denoising-based purification methods, including Gaussian (Zantedeschi et al., ), JPEG (Das et al., ), Resizing (Xie et al., ), SR (Mustafa et al., ), following the setup in existing works (Liang et al., ). This is because other purification methods are either not compatible or not available in the context of LDM.

We use these purification methods to denoise the adversarial perturbations on the protected images. After that, we apply SDEdit and LoRA on these purified images. The experimental setup follows Section 4.1 except for the adversarial perturbation constraint, which is set to be 8/255. This is still a small constraint compared to the setup of existing protections (For comparison, Salman et al. () and Van Le et al. () use 16/255). The purification methods include Gaussian (Zantedeschi et al., ), JPEG (Das et al., ), Resizing (Xie et al., ), SR (Mustafa et al., ). Specifically, Gaussian adds Gaussian noise of standard variance 4 and 8 to the protected image. We try two JPEG compression qualities, 20 and 70. For Resizing we have two setups, 2x up-scaling + recovering (denoted by 2x) and 0.5x down-scaling + recovering (denoted by 0.5x). The interpolation algorithm in resizing is bicubic.

The quantitative result is demonstrated in Table 3. It shows that ACE and ACE+ still have strong impact on the output image quality of few-shot generation after processing by purification. The CLIP-IQA score of most cases even increase after the purification. Hence, we believe that our adversarial attack has enough robustness to purification methods.

Qualitatively, Table 3 also visualizes the output images of SDEdit and LoRA referring to the protected images processed by different purification methods. For both method, they still have strong performance under most of the cases except for Gaussian Noise($\sigma=8$) and JPEG compression (quality$=20$). However, in the exception cases, the defense has added visible degradation to the image, which also heavily affect both LoRA and SDEdit process. For example, LoRA learns to produce images comprised of small squares due to a hard compression of quality 20. And SDEdit produces images of visible Gaussian noise when adding Gaussian noise of $\sigma=8$. It’s noteworthy that both ACE and ACE+ seems to be strengthened after SR purification, which is an intriguing phenomena.

### B.3 Performance on Dreambooth

Figure: Figure 6: Comparison of ACE and ASPL on DreamBooth. The top three rows: output images of DreamBooth under ACE. The bottem three rows: output images of DreamBooth under ASPL. The adversarial budget is $\zeta=4/255$. ASPL mainly hurts the diversity of output images while ACE directly degrades the image quality.
Refer to caption: extracted/5921025/figs/freecompress-rebuttal_2.png

Although LoRA+DreamBooth is the most widely-used customization method, we also follow ASPL (Van Le et al., ) to conduct experiments on DreamBooth, as robustness evaluation of our method. We compare ACE with ASPL, the strongest baseline, on DreamBooth. Except for replacing the finetuning method by DreamBooth, all experimental setups stay the same as Section 4.1 and Appendix A. We visualize the output images of DreamBooth under ACE and ASPL in Figure 6, respectively. ASPL mainly hurts the diversity of output images while ACE severely degrades the image quality and makes the output images unusable by adding perceptible chaotic texture.

### B.4 Ablation Studies

#### B.4.1 Targets and Objectives

Connections between ACE/ACE+ and other targeted attacks ACE/ACE+ are not the first targeted attack on LDM. ASPL-T is a general targeted form of attacks (Van Le et al., ). Here, we compare the objective function of ACE and ASPL-T (^13^1313The original paper does not provide the concrete objective function of ASPL-T so we refer to its implementation on GitHub: [https://github.com/VinAIResearch/Anti-DreamBooth/blob/main/attacks/aspl.py](https://github.com/VinAIResearch/Anti-DreamBooth/blob/main/attacks/aspl.py)):

$$ ACE: $\displaystyle\mathop{min}_{x^{\prime}}\mathbb{E}_{t}\mathbb{E}_{z^{\prime}(t)| z^{\prime}(0)}\|s_{\theta}(z^{\prime}(t),t)-\bm{\mathcal{T}}\|^{2}_{2}$ (7) ASPL-T: $\displaystyle\underbrace{\mathop{max}_{x^{\prime}}\mathbb{E}_{t}\mathbb{E}_{z^ {\prime}(t)|z^{\prime}(0)}\|s_{\theta}(z(t),t)-\nabla_{z(t)}\log p_{t}(z(t)|z( 0))\|^{2}_{2}}_{\textbf{ASPL}}-\|z^{\prime}_{\theta}(t-1)-z^{\bm{\mathcal{T}}} (t-1)\|^{2}_{2}$ $\displaystyle\text{where }z^{\prime}_{\theta}(t-1)=\frac{1}{\sqrt{1-\beta_{t}} }(z^{\prime}(t)+\beta_{t}s_{\theta}(z(t),t))+\sqrt{\beta_{t}}\bm{\sigma_{z}}, \bm{\sigma_{z}}\sim\mathcal{N}(\bm{\sigma_{z}};0,\bm{I})$ $\displaystyle\text{and }z^{\bm{\mathcal{T}}}(t-1)=\sqrt{\beta_{t}}\bm{\mathcal {T}}+\sqrt{1-\beta_{t}}\bm{\sigma},\bm{\sigma}\sim\mathcal{N}(\bm{\sigma};0, \bm{I})$ $$

ASPL-T adds a targeted guidance to ASPL. It is intuitive that it pushes the predicted previous latent representation $z^{\prime}_{\theta}(t-1)$ to the ground truth previous latent representation $z^{\bm{\mathcal{T}}}(t-1)$ of a target $\bm{\mathcal{T}}$. This sub-objective is jointly optimized with the original objective of ASPL, which maximizes the training loss of LDM. However, according to the result posted in its original paper (Van Le et al., ), ASPL-T is deterior to ASPL in performance.

Compared to the intuitive approach of introducing the target, ACE considers the target directly as the only guidance for the predicted score function $s_{\theta}(z^{\prime}(t),t)$. It is non-trivial because it does not correspond to an intuitive explanation within the framework of score-based generative modeling, unlike ASPL-T. We can only design it with acknowledging that all attacks work by biasing the predicted score function $s_{\theta}(z^{\prime}(t),t)$.

Effects of Targets and Objectives We conduct ablation studies on the effect of targets and objectives. For targets, we use two natural images, one human-face photo from CelebA-HQ and one artwork from WikiArt, as alternative images for the target $\bm{\mathcal{T}}$. This is recommended by Van Le et al. (). For objectives, we use ASPL-T as the alternative objective. The experiment setup follows the LoRA setup in Section 4.1.

Table 6 demonstrates the sampling outputs under different targets and objectives. Under the small adversarial budget $\zeta=4/255$, ASPL-T fails in degrading the quality of sampling outputs with all targets. By contrast, ACE adds obvious texture to the sampling outputs with different targets. Among them, our target shows distinguishing superiority in adding very chaotic texture to the sampling output. The result validates that both the objective of ACE in Section 3.1 and the target $\bm{\mathcal{T}}$ selected in Section 3.2 contribute to the performance of our method.

**Table 6: Ablation study on the effect of different targets and objectives.**
| Type | Human Face | Artwork | Our Target |
| --- | --- | --- | --- |
| Target Image |  |  |  |
| ASPL-T |  |  |  |
| ACE |  |  |  |

Second, we investigate the impact of two vision variables in the target image $\bm{\mathcal{T}}$: pattern density and contrast. The setup follows that in the first experiment above. The result is visualized in Figure 7. When the pattern is sparse, increasing pattern density yields better attacking performance. When the pattern is dense, increasing pattern density then leads to worse performance. Hence, in practice, we choose an appropriate pattern density. As for contrast, the performance of the attack increases as the pattern’s contrast goes higher. We then let our target be with the highest contrast.

Figure: Figure 7: Target images with different pattern repetition and contrast results in different effects.
Refer to caption: extracted/5921025/figs/vis_other_target.png

#### B.4.2 Prompts in LoRA

In real life usage, malicious ones may use different prompts to finetune the LDM. Hence, we investigate whether ACE maintains effectiveness under different prompts in the finetuning. We select one 20-image group from CelebA-HQ and use ACE to generate protected images under adversarial budget $4/255$ and prompt a photo of a sks person. We then train LoRA with four different prompts:

- •
a photo of a sks person
- •
a photo of a pkp
- •
a photo of a pkp woman
- •
an image of a pkp woman

We visualize the output images in Table 7. The result shows minor degradation in the effectiveness of attack when ACE handles more and more unfamiliar prompts. However, there still exists strong visual distortion under all three unknown prompts.

**Table 7: LoRA output images with different prompts under the attack of ACE. Red text notes the difference between the prompt in generation and the prompt in finetuning.**
|  |  |  |  |
| --- | --- | --- | --- |
| a photo of a sks<br>person | a photo of a pkp<br>person | a photo of a pkp<br>woman | an image of a pkp<br>woman |

#### B.4.3 Perturbation Magnitude

One interesting question is how the degradation of LDM’s performance is related to the magnitude of adversarial perturbations. We conduct an experiment to provide a quantitative answer. We tune the adversarial budget $\zeta$ to be $\{2,4,6,8,12\}$ and keep the other setup consistent as that in Section 4.1. In addition to the budget, we also post PSNR to measure the magnitude of adversarial perturbation. For the degradation of LDM’s performance, we post CLIP-IQA for LoRA and MS-SSIM & CLIP-SIM for SDEdit.

Figure 8 demonstrates the trend of performance degradation with the increase of magnitudes of adversarial perturbations. For SDEdit, the performance degradation always grow together with the perturbation magnitude, because SDEdit directly edits the protected image. For LoRA, performance degradation continues to grow when the magnitude increases from 2 to 8. When the magnitude grows from 8 to 14, however, the performance degradation holds still. This indicates that $\zeta=8$ is approximately a threshold for the performance degradation in LoRA.

Nevertheless, the main concern of increasing adversarial budgets is the visibility of adversarial perturbations. According to our user survey among human artists, $\zeta=4$ is an appropriate budget. This is the reason why we conduct experiments on $\zeta=4$.

Figure: Figure 8: On the relation between perturbation magnitudes and degradation performance. The left-most figure depicts the PSNR between the protected images and the original images. This could be seen as another metric for adversarial perturbation budgets.
Refer to caption: extracted/5921025/figs/ablation2.png

#### B.4.4 ACE with a new target

Figure: Figure 9: New target used by ACE*.
Refer to caption: extracted/5921025/figs/nips.png

From Appendix B.4.1, we know that a good target for ACE should be with high contrast and repeated patterns. To further validate this insight, we design from scratch a new target (See Figure 9) and conduct full sets of our experiments accordingly. We pick the logo of NeurIPS and repeat it by $2\times 8$ in an black image. We denote ACE with the new target by ACE*. All other setups follow Section 4.1.

We compare ACE* with the strongest baseline ASPL (Van Le et al., ) and our ACE/ACE+ in Table 1, with visualization given by Figure 10. ACE* performs similarly or even better than baselines. This shows that ACE can yield even better performance by carefully picking the target following our insights, providing stronger evidence for our target selection.

Figure: Figure 10: Visualization of LoRA (top) and SDEdit (bottom) output images under ACE*.
Refer to caption: extracted/5921025/figs/rebuttal.png

## Appendix C Limitations & Societal Impacts

Limitations First, due to the quick progress of the few-show generation empowered by LDM, ACE may need updates to cover the novel artwork copying pipelines in the future. Second, this paper focuses on explaining the mechanism of adversarial attacks on LDM empirically, which leads to a more powerful method. Hence, we do not provide rigorous theoretical proofs for our explanation but focus on validating it with empirical observation. A rigorous theoretical framework for this mechanism is then left to be explored in the future work.

Societal Impacts This paper presents work whose goal is to prevent the unethical abuse of the new generation AIGC. This is a crucial topic because of the legislative lag and the rapid progress of machine learning. The recent world has witnessed various cases concerning the copyright, privacy, and ethical problems of AIGC, most of which have not been solved by either technology or the law. Our work aims at providing stronger protection against unauthorized image copying and editing, which is only a small part of these problems. We thus believe that our work is completely ethical and sincerely hope that more attention will be paid to this field.

## Appendix D Toy Survey on Diffusion Customization

User Study To further compare ACE with the previous SOTA method ASPL and gain more feedback from the artist community, we conduct a survey on the effectiveness of ACE and ASPL. We choose ten 20-image subsets from our dataset and generate 100 customized images using LoRA-DreamBooth for each subset, under the protection of ACE and ASPL respectively. All hyperparameters are the same as mentioned in A. To test ACE’s effectiveness against ASPL, we randomly sample one ACE-protected image and one ASPL-protected image for comparison. The artists are asked to vote for the lower quality one. We collect a total of 1451 valid votes and ACE has a win rate of 55.48%. This further showcases ACE’s effectiveness in a real-world setting. To relieve the artists’ workload, we do not include more baseline methods in the survey.

Survey on Diffusion Customization Methods Additionally, we investigate 50 highest-rated models in CivitAI (^14^1414https://civitai.com/models), a popular platform for sharing diffusion customization models. Among them, 78% are LoRA models, which demonstrate the dominance of LoRA-DreamBooth in current diffusion customization applications.

## Appendix E Visualization

In this section, we visualize the comparison result between our proposed methods, ACE and ACE+, and baseline methods.

### E.1 Protected images

Figure 11 and Figure 12 demonstrate protected images generated by our adversarial attack and ASPL, respectively. Protected images by both methods under adversarial budget $\zeta=4/255$ show few differences between real images. However, the adversarial perturbations on ACE’s protected images appear to be more smooth than those on ASPL’s. This makes ACE more acceptable in real-world artwork protection.

Figure: Figure 11: Protected images by ACE with the adversarial perturbation budget $\zeta=4/255$. The perturbation is quite small and almost human-invisible, making the protected images resemble real images.
Refer to caption: extracted/5921025/figs/adv_ace.png

Figure: Figure 12: Protected images by ASPL with the adversarial perturbation budget $\zeta=4/255$. Their adversarial perturbations are more visible than those by ACE.
Refer to caption: extracted/5921025/figs/adv_aspl.png

### E.2 Transferability

We visualize the output images of different victim models under ACE by different backbone models in Table 2. As shown in the table, our method shows a strong consistency among different models. An exception is that when using SD2.1 as the victim model, it tends to fail in LoRA training(not learning the right person) instead of learning the strong semantic distortion from the target image. However, the model does learn the right person when no attack is conducted. Also, the SDEdit process is extra strong when victim is SD2.1. We attribute this phenomena to the resolution mismatch. SD2.1 is trained to receive images of resolution 768, while we actually fed it with images of resolution 512. This may leads to different behaviour of SD2.1. Also, the resolution mismatch between SD1.x and SD2.x may be the main reason for the performance degradation when using SD1.x as victim and SD2.1 as backbone.

### E.3 Output images of SDEdit

Figure 13 visualizes the output images of SDEdit under different adversarial attacks. All adversarial attacks are budgeted by $\zeta=4/255$. Two proposed methods add obvious noise to the output image, compared to no attack and three baseline methods, Photoguard, AdvDM, and ASPL. Note that the texture in the output images of ACE/ACE+ shows consistency with the pattern demonstrated in Figure 3.

Figure: Figure 13: Output images of SDEdit under different adversarial attacks. With the same perturbation budget, our attacks better interfere the image quality compared to three baseline methods. Specifically, ACE adds chaotic texture to the image. ACE erases some contents of the image.
Refer to caption: extracted/5921025/figs/vis_appendix_sdedit.png

### E.4 Output images of LoRA

Figure 14, 15, 16, and 17 show the output images of LoRA under different adversarial attacks. All adversarial attacks are budgeted by $\zeta=4/255$. Note that the texture in the output images of ACE/ACE+ shows consistency with the pattern of the sampling bias $\mathcal{B}_{spl}$ demonstrated in Figure 3. It is naturally because the texture is caused by the sampling error, which is accumulated by $\mathcal{B}_{spl}$.

Figure: Figure 14: Output images of LoRA under different adversarial attacks. Two proposed methods outperform baseline methods.
Refer to caption: extracted/5921025/figs/vis_appendix_0.png

Figure: Figure 15: Output images of LoRA under different adversarial attacks. ACE and ACE+ outperform baseline methods. (Cond.)
Refer to caption: extracted/5921025/figs/vis_appendix_1.png

Figure: Figure 16: Output images of LoRA under different adversarial attacks. ACE and ACE+ outperform baseline methods. (Cond.)
Refer to caption: extracted/5921025/figs/vis_appendix_2.png

Figure: Figure 17: Output images of LoRA under different adversarial attacks. ACE and ACE+ outperform baseline methods. (Cond.)
Refer to caption: extracted/5921025/figs/vis_appendix_3.png

## Peer Reviews

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: Please see the Weaknesses part.
soundness: 3
strengths: 1. The paper first proposes the targeted attacks for the protection against diffusion customization, and validates the effectiveness of targeted attacks.

2. The paper proposes an explanation for the superiority of targeted attacks, which may help understand attack-based protection.

3. The experiments on transferability and robustness also validate the effectiveness.
summary: This paper proposes a targeted attack method for the protection against unauthorized diffusion customization. Extensive experiments validate the effectiveness of the targeted attack compared to other baselines. The paper also proposes an explanation for the effectiveness of targeted attacks.
weaknesses: There are two main concerns.

1. Did the authors try some specifically purification methods for the protection? e.g., the method in [1]. Can the method purify the perturbations?

2. The authors may need to compare the added loss term alone in the ACE+ loss with the proposed ACE loss. The added loss in ACE+ is also targeted attack. Experimental comparisons are needed between it and the ACE loss.



[1] Bochuan Cao et al. IMPRESS: Evaluating the Resilience of Imperceptible Perturbations Against Unauthorized Data Usage in Diffusion-Based Generative AI, 2023.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: My questions have been listed above. I'm willing to increase my score if my concerns are addressed.
soundness: 3
strengths: 1. This is a well-written paper with solid experiments and analysis. The proposed ACE and ACE+ demonstrate superior performance against baseline methods.
2. The proposed method is straightforward and effective, with clear explanations for each step.
summary: This paper proposes using targeted adversarial attacks to prevent unauthorized customized fine-tuning of LDM. The motivation is straightforward with a clear method design. The proposed ACE and ACE+ demonstrate a significant reduction in generation quality compared to baseline methods while maintaining an acceptable computational cost. The authors also conducted experiments to assess the robustness and transferability of ACE.
weaknesses: Given the detailed and solid experiments presented in this paper, I have no queries regarding the need for more ablation experiments. However, I do have concerns regarding the technical contributions and practical settings.

1. While this paper employs targeted adversarial attacks to prevent unauthorized customized fine-tuning, it is noted that this approach resembles Glaze [1], which also utilizes targeted style transfer to safeguard against style mimicry. Can you discuss the core difference between your technical contributions?

2. It is intriguing to investigate whether we should adopt ACE to all the protected images to achieve such protection results. What would be the impact on protection performance if the attacked ratio (the proportion of protected images) is reduced?

---

confidence: 3
contribution: 2
initial_rating: 6
presentation: 3
questions: 1. Did the authors verify that the selected evaluation images were not part of the original SD models' training datasets to minimize potential bias? 

2. Please consider including the suggested work as an additional baseline for evaluating the proposed method.
soundness: 2
strengths: 1. Relevant and timely topic  
2. Clear presentation of ideas  
3. Thorough evaluation

The authors address the important and timely topic of protecting diffusion models from unauthorized fine-tuning on specific images. To overcome limitations in existing approaches, they shift the focus from untargeted to targeted attacks, introducing a novel protection method called ACE. The authors provide a clear explanation of the design and rationale behind their method, which is commendable. Additionally, they conduct extensive evaluations that demonstrate the method's effectiveness. Overall, this paper is well-written and easy to follow.
summary: This paper discusses the use of targeted adversarial attacks to improve protection against unauthorized diffusion customization in image generation models. Traditional protections using untargeted attacks are not effective enough, so the authors propose a method called Attacking with Consistent score-function Errors (ACE). ACE significantly degrades the quality of customized images by introducing targeted errors, making unauthorized customization less viable. The paper validates ACE's effectiveness through extensive experiments and provides insights into the mechanisms of attack-based protections, setting a new benchmark in the field.
weaknesses: 1. **Limited Technical Contribution**: The proposed method primarily relies on existing adversarial attacks, such as PGD, to mislead the model toward a predefined target. However, all of the techniques applied are directly taken from prior works, with minimal novel adaptation or extension.

2. **Lack of Evaluation on SD3**: The evaluations are conducted exclusively on SD versions 1.4, 1.5, and 2.1, which are somewhat outdated. Although testing on SD3 could provide valuable insights, it’s worth noting that SD3 is not open-source and lacks support for customization pipelines like LoRA or DreamBooth, which are central to this paper’s focus on protecting against unauthorized customization. Including a discussion of this limitation and potential future directions for adapting the method to newer models could strengthen the paper.

3. **Potential Bias in Selected Evaluation Images**: The authors selected images from two datasets to evaluate the performance of various customization and protection methods. However, it's unclear if these images were part of the original SD models’ training set, which could introduce bias. It would be helpful if the authors could clarify whether they verified that the selected images were not in the SD models’ training data. If verification wasn’t conducted, acknowledging this limitation would be beneficial.

4. **Additional Baseline for Comparison**: While the authors include several baselines, an important reference—**"Adversarial Perturbations Cannot Reliably Protect Artists from Generative AI"**—is missing. Including this work would allow for a more comprehensive comparison. Specifically, a discussion on how the proposed method compares to or improves upon the reliability and effectiveness of the techniques discussed in this paper would provide valuable context.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: - In algorithm 1 Line 5-7, why are you optimizing the diffusion model parameters as well? Seems that these details are not included in Eq. (4)-(5).

- In table 1, what are the budgets of the baselines? Are they 4/255 or aligned with their own settings?
soundness: 3
strengths: - The idea is simple and interesting, and the proposed method is easy to implement.

- The discovery that targeted attacks on diffusion-based mimicry works better than untargeted ones is novel and interesting.

- This paper is written in a clear way, and the logic of this paper is easy to follow.

- The performance reported in the paper demonstrates the effectiveness of the proposed technique.

- This paper tries to provide some insights to explain the underlying reason of why targeted attacks works better than untargeted attacks. The reasons and explanations are intuitive and reasonable.
summary: This paper focuses on protecting images from being exploited by sota T2I diffusion models via adversarial perturbation. Different from previous works that mainly utilize untargeted attacks, this work points out an interesting and novel perspective that targeted attacks works better. The experimental results prove the method's effectiveness. The author also provides an insight to explain the success of targted attack: the attack can lead to model to learn more consistent chaotic patterns, and mitigate the neutralization effect of untargeted perturbation from multiple samples.
weaknesses: My concerns mainly lie in the experimental evaluation part of the paper. The authors seem to be not closely following the recent advances in adversarial attacks & defenses for protection against diffusion-driven mimicry/editting.

- Lack of recent attack baselines (in 2024) for comparison in the experiments, such as SDS, MetaCloak, Influence Watermarks, etc.

- The paper only focuses on latent diffusion models, while other models such as diffusion transformers are not evaluated. I suggest to conduct more experiments on state-of-the-art DiT models. Although they might not be tailored for personalization, some of them can be easily adopted for image editting tasks. 

- The purification experiments does not include any purification methods specifically designed for diffusion mimicry, such as IMPRESS [1], GrIDPure [2], etc.

- I also have a concern on the superiority of targeted attacks claimed in this paper. In the analyses part (Section 5), the main idea is that as targeted attacks can lead to model to learn more consistent chaotic patterns, they mitigate the neutralization effect of untargeted perturbation from multiple samples. However, for image editting tasks and some state-of-the-art personalization methods, only one reference image is involved, and the above "neutralization effect" will not neccessarily happen. How can the hypotheses in Section 5 explain the empirical success of targeted attacks in these settings?

Minor Points:

- The claim in L144 that all existing protection are untargeted attacks is not accurate. For example, Glaze should be classified as a targeted attack. ASPL also proposes a targeted attack version.

- The description in L500 seems wrong. $\theta^{\prime}$ should be the customized diffusion model.

The reviewer will engage actively in the discussion and adjust the rating according to the rebuttal.

[1]: Cao et al. IMPRESS: Evaluating the Resilience of Imperceptible Perturbations Against Unauthorized Data Usage in Diffusion-Based Generative AI. NeurIPS 2023.

[2]: Zhao et al. Can Protective Perturbation Safeguard Personal Data from Being Exploited by Stable Diffusion? CVPR 2024.

Meta-review: The paper proposes a method to prevent unauthorized diffusion customization. Rather than an untargeted attack, it proposes a targeted attack in the protected image that will show a designated texture or patterns after diffusion modification. It also includes valuable discussion on the proposed method's effectiveness. The paper is well-written and easy to follow. The experimental results show the effectiveness of the targeted attack. Please remember to incorporate some of the reviewer's concerns in the main text as well. I recommend accepting this work.

Decision: Accept (Spotlight)