Skip to content

Elijah: Eliminating backdoors injected into diffusion models via distribution shiftElijah: Eliminating Backdoors Injected in Diffusion Models via Distribution Shift

arXiv· arXiv:2312.00050· Shengwei An, Sheng-Yen Chou, Kaiyuan Zhang, Qiuling Xu, Guanhong Tao, Guangyu Shen, Siyuan Cheng, Shiqing Ma, Pin-Yu Chen, Tsung-Yi Ho, Xiangyu ZhangPurdue University; The Chinese University of Hong Kong; University of Massachusetts Amherst; IBM ResearchIndexed by this site · 27 days ago· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose ELIJAH, a backdoor detection and removal framework for diffusion models, and state that on 151 clean and 296 backdoored models detection is close to 100% and the backdoor effect drops to close to zero.

Threat modelThe attacker's goal is to inject a backdoor into the diffusion model: generate target images when the input contains the trigger, and normal samples when the input is clean. The defender has no prior knowledge of the attack method and has white-box access to the model; the framework can work without any real clean data.

Questions
Diffusion models can be injected with backdoors: when the input noise carries a trigger, a target image is generated, whereas backdoor defenses for traditional classifiers rely on labels and cannot be directly applied to label-free diffusion models.
Methods
The authors unify three existing diffusion model backdoor attacks as injecting a distribution shift along the diffusion chain, and on this basis propose ELIJAH: invert the trigger based on the persistence of the distribution shift, detect using a uniformity score and TV loss, and then use a removal loss to pull the backdoor distribution back to the clean distribution.
Experiments and results
On 151 clean and 296 backdoored models (DDPM/NCSN/LDM, 13 samplers, 3 attacks), the authors report an average detection accuracy of 1.00, an average ∆ASR of -0.99, and an average ∆FID of 0.03; only NCSN-C has a ∆ASR of -0.96.
Limitations and future work
The paper has no limitations section. The experiments cover only CIFAR-10 and CelebA-HQ, 3 attacks, and 13 samplers; only two adaptive attacks were tried and both failed to inject; the detection and removal hyperparameters (e.g., λ=0.5, 16 images) come from tuning on a subset.
Experimental setupDDPM、NCSN et al. · CIFAR-10、CelebA-HQ · ACC、∆ASR et al.
Evaluated models
DDPMNCSNLDMDDIMPNDMDEISDPMO1DPMO2DPMO3DPM++O1DPM++O2DPM++O3UNIPCHEUN
Benchmarks
CIFAR-10CelebA-HQ
Metrics
ACC∆ASR∆SSIM∆FID
AI summaryThe researchers propose the Elijah framework, which detects and removes backdoors injected into diffusion models through distribution shift; the authors call it the first backdoor detection and removal framework for diffusion models. The background is that diffusion models are vulnerable to backdoor attacks: inputs with triggers (such as Gaussian noise stamped with a white patch) cause backdoored models to generate attacker-specified target images, and effective defenses were previously understudied. The evaluation covers hundreds of models across three architectures, DDPM, NCSN and LDM, using 13 samplers against 3 existing backdoor attacks; results show detection accuracy close to 100%, backdoor effects reduced to near zero, and no significant sacrifice of model utility.

The researchers propose the Elijah framework, which detects and removes backdoors injected into diffusion models through distribution shift; the authors call it the first backdoor detection and removal framework for diffusion models. The background is that diffusion models are vulnerable to backdoor attacks: inputs with triggers (such as Gaussian noise stamped with a white patch) cause backdoored models to generate attacker-specified target images, and effective defenses were previously understudied. The evaluation covers hundreds of models across three architectures, DDPM, NCSN and LDM, using 13 samplers against 3 existing backdoor attacks; results show detection accuracy close to 100%, backdoor effects reduced to near zero, and no significant sacrifice of model utility.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    To address the lack of detection and removal methods for diffusion model backdoors, the authors propose the framework ELIJAH.

    Core problem: diffusion models (DMs) can be injected with backdoors, but backdoor detection and removal methods for DMs remain a gap.

    • Problem setting and importance: The authors note that there are many pretrained DMs online (e.g., Hugging Face), and that companies fine-tune them and offer generation services externally; if a model is injected with a backdoor, then when the input noise carries a trigger it will generate inappropriate or even illegal target images, harming the business and even leading to litigation. The authors also mention that DMs are often used for privacy-preserving data synthesis, and that an injected bias can be triggered and cause downstream models to behave abnormally.
    • Shortcomings of existing methods: The authors state that backdoor defenses on traditional classifiers rely on label information, using triggers to flip predicted labels in order to invert triggers or using ASR for judgment; DMs have no labels, so these methods cannot apply.
    • Core observation: The authors studied three existing DM backdoor attacks and argue that the key to injecting a backdoor is to implant in the DM a distribution shift relative to the trigger, and that this shift is progressively maintained along the inference chain.
    • Proposed approach: Based on this observation, they propose ELIJAH—which the authors describe as a backdoor detection and removal framework for DMs, comprising trigger inversion based on the persistence of the distribution shift, detection based on a uniformity score and TV loss, and backdoor removal by eliminating the distribution shift; detection and trigger inversion require no data, and removal can use synthetic data self-generated by the model.
    • Threat model (consistent with existing literature, copied from the paper):
      • Attacker's goal: backdoor the DM so that it generates target images when the input contains the trigger and normal samples when the input is clean.
      • Defender's knowledge: no knowledge of the attacks.
      • Defender's capability: white-box access to the DM.
      • Data conditions: the framework can work without any real clean data.
  2. What related research exists?

    Related work falls into three categories: DM backdoor attacks, classifier backdoor attacks and defenses, and DMs and samplers; the paper states that no one has yet worked on DM defenses.

    Diffusion models and their accelerated sampling

    • Ho et al. (2020) proposed DDPM; Song and Ermon (2019) proposed NCSN; Rombach et al. (2022) proposed LDM—three types of Gaussian noise-to-image diffusion models, all represented in this paper as Markov chains.
    • DDIM (Song, Meng, and Ermon 2021), DPM-Solver/DPM-Solver++ (Lu et al. 2022a,b), UniPC (Zhao et al. 2023), Heun (Karras et al. 2022), DEIS (Zhang and Chen 2023)—samplers for accelerated sampling, which this paper takes as test subjects.

    Diffusion model backdoor attacks (the defense targets of this paper)

    • BadDiff (Chou, Chen, and Ho 2023a)—attacks only DDPM; the backdoor reverse process shares parameters with the clean process.
    • TrojDiff (Chen, Song, and Li 2023)—attacks DDPM; triggering the backdoor requires switching to a separate backdoor reverse process, and a separate backdoor reverse process is derived for DDIM.
    • VillanDiff (Chou, Chen, and Ho 2023b)—a unified framework that can attack multiple DMs. The paper notes that all three can be represented as injecting a distribution shift along the diffusion chain.

    Backdoor attacks and defenses on discriminative models such as classifiers

    • Attacks: label-poisoning attacks such as BadNets (Gu et al. 2019) and Trojaning (Liu et al. 2018), as well as clean-label attacks (Turner, Tsipras, and Madry 2018; Saha et al. 2020).
    • Defenses: model/dataset scanning (Neural Cleanse, Wang et al. 2019; ABS, Liu et al. 2019a), certified robustness (Xiang et al. 2022; Jia et al. 2022), backdoor removal (Fine-Pruning, Liu et al. 2018; Tao et al. 2022a,b; Xu et al. 2023, etc.). The paper notes that these methods rely on labels or ASR and are not tailored to diffusion models; Appendix E uses Neural Cleanse as an example to illustrate that it requires label information and clean samples, making it difficult to adapt to DMs.

    Baselines and benchmarks: The paper explicitly states that, to its knowledge, there is no backdoor detection or removal technique for DMs, and therefore there is no direct baseline; the comparison in the removal experiments is fine-tuning with only 10% clean data (Finetune). The evaluation datasets are CIFAR-10 and CelebA-HQ.

    The authors position this paper as addressing the gap in which DM backdoors are already confirmed to exist as attacks while defenses have not yet been explored, proposing what the authors call a detection and removal framework for diffusion models.

  3. How does the paper address this problem?

    Unifying DM backdoors as a distribution shift, and on this basis designing a three-part suite of trigger inversion, dual-feature detection, and distribution shift elimination.

    Overall idea: all three existing DM backdoor attacks can be expressed as injecting a trigger-related distribution shift along the diffusion (Markov) chain; ELIJAH accordingly designs three components—invert a trigger that preserves the distribution shift, use it to generate images and extract features for detection, then remove the backdoor by eliminating the distribution shift (Figure 4, Figure 5).

    Problem setting and unified representation

    • DDPM, NCSN, and LDM are unified as a Markov chain: the forward process gradually adds noise to xT ∼ N(0,I), and the learned network Mθ forms the reverse process that gradually denoises to obtain a sample x0.
    • The three attacks are summarized as: defining a trigger-r-related distribution shift ρt·r in the forward process, training so that Mθ outputs the shift ρ̃t·r when the input contains the trigger, and setting the shift at the x0 step to the target image to be generated.

    Trigger inversion (Section 3.1)

    • The distribution shift is assumed to be linearly related to the trigger: µtb − µtc = λt·τ. The inversion goal is to find τ such that the output distribution shift is proportional to the input shift, i.e., E[M(xct+λtτ,t)] − E[M(xct,t)] = λt−1τ.
    • To avoid step-by-step sampling along the chain, the loss is computed only at time step T: Lossτ = ∥Eϵ[M(ϵ+τ, T)] − λτ∥ (when the UNet predicts noise), and τ is optimized by gradient descent with Adam (learning rate 0.1); DDPM sets λ=0.5 (the authors tuned it on a subset within [0,1] with step size 0.1).
    • Training epochs: 100 epochs for DDPM/NCSN, 10 epochs for LDM and ODE models; batch size depends on resolution: 100 (32×32), 50 (128×128), 20 (256×256).

    Backdoor detection (Section 3.2)

    • The inverted τ is used to shift the mean of the input Gaussian distribution, generating n=16 images, and two features are extracted: the uniformity score (the expected pairwise difference among a batch of images; smaller means more consistent) and the average Total Variance loss (measuring the noise level; the authors' rationale is that the target image is not noise, and inverting the trigger makes a clean model generate low-quality out-of-distribution samples).
    • Two settings: when backdoored models produced by different attacks are available, a random forest binary classifier is trained on these features (random forest is chosen because it does not require input normalization); when only clean models are available, a threshold is set on clean models at a chosen FPR (e.g., 5%), and features below the threshold are judged backdoored.

    Backdoor removal (Section 3.3)

    • The goal is to pull the backdoor distribution back to the clean distribution: Lossrb = Eϵ∥Mθ(ϵ+τ) − Mf(ϵ)∥, where Mf is a frozen copy of the original model, preventing the model from pulling the clean distribution in the opposite direction.
    • Lossmc = Eϵ∥Mθ(ϵ) − Mf(ϵ)∥ is added to preserve the clean distribution, along with the original diffusion training loss Lossdm; the total loss is Lossθ = Lossrb + Lossmc + Lossdm.
    • Lossdm's data comes from two sources: 10% real clean training data, or clean synthetic data generated by the backdoored model itself (the authors state this is not possible in the classifier setting).

    Success criteria

    • Detection uses ACC; removal uses ∆ASR (the relative change in the proportion of trigger-input generated images whose MSE to the target image is below a threshold), ∆SSIM, and ∆FID (the change in FID relative to the frozen model, measuring utility loss).
  4. What experiments did the paper conduct?

    On 151 clean and 296 backdoored models, the authors report an average ACC of 1.00, ∆ASR of -0.99, and ∆FID of 0.03.

    Experimental setup

    • Models tested: 3 architecture types (DDPM, NCSN, LDM) plus 13 samplers (DDIM, PNDM, DEIS, DPMO1/2/3, DPM++O1/2/3, UNIPC, HEUN, etc.), totaling 151 clean models and 296 backdoored models; clean models come from Hugging Face or are self-trained, and backdoored models are provided by the attack authors or trained with the official code.
    • Attacks: All three in the literature—BadDiff, TrojDiff, VillanDiff.
    • Datasets: CIFAR-10 (60K 32×32 images) and downsampled CelebA-HQ (30K 256×256 face images).
    • Metrics: ACC (detection accuracy), ∆ASR and ∆SSIM (removal effectiveness, lower is better), ∆FID (utility loss, lower is better); ∆ metrics are computed on 2048 generated images.
    • Baselines: No-DM-defense baseline; the removal comparison is fine-tuning with only 10% real data (Finetune).
    • Detection protocol: In the random forest setting, clean models are split 80/20, and the test set includes backdoored models produced by attacks different from the attack under test; the threshold is set at FPR=5%.
    • Number of repetitions: Appendix B.1 states that the inversion and removal algorithms are each run once per model (except for models involved in multiple experiments for random forest and threshold detection).

    Main results

    Table 1 (random forest detection setting; DDPM-C/A denotes DDPM trained on CIFAR-10/CelebA-HQ, and ODE-C is the average result over ODE samplers under the VillanDiff attack):

    Swipe horizontally to read the table

    AttackModelACC↑∆ASR↓∆SSIM↓∆FID↓
    Average—1.00-0.99-0.970.03
    BadDiffDDPM-C1.00-1.00-0.99-0.00
    BadDiffDDPM-A1.00-1.00-1.000.10
    TrojDiffDDPM-C0.98-1.00-0.960.04
    TrojDiffDDIM-C0.98-1.00-0.960.03
    VillanDiffNCSN-C1.00-0.96-0.900.17
    VillanDiffLDM-A1.00-1.00-0.99-0.31
    VillanDiffODE-C1.00-1.00-1.000.17
    • The authors state that average detection accuracy is close to 100%, with over half of the cases at 100%; in Figure 6, clean and backdoored models are well separated in the uniformity/TVLoss feature space.
    • The authors state that the backdoor is completely removed for all models except NCSN (NCSN is "almost completely", with ∆ASR -0.96).
    • The authors state that utility loss is small (average ∆FID 0.03), and explain that part of the ∆FID increase is because the noise space and model are larger (DDPM-A) or the model is more sensitive to training on small data (NCSN-C, ODE-C).

    Threshold detection using only clean models (Appendix B.2, Table 2)

    • What was tested: At FPR=5%, the detection rate using only the uniformity threshold (U@5) or only the TV loss threshold (T@5), compared with random forest.
    • Results: Random forest ACC is 100 or 98.36; the lowest U@5 row is 92.04% for BadDiff DDPM-C, the lowest T@5 is 96.36% for TrojDiff DDPM-C/DDIM-C, and the rest are mostly 100.
    • The authors state that the two approaches perform comparably, with random forest having higher overall accuracy.

    Role of the removal losses and synthetic data (Sections 4.4, 4.5)

    • Fine-tuning with only 10% real data cannot remove the backdoor: In Figure 7 (BadDiff, stop sign trigger, hat target), Finetune's ASR stays close to 1, while ELIJAH reduces ASR to 0 within 5 epochs; Figures 10 and 11 are similar.
    • Lossrb alone is insufficient: Figure 9 shows that 20 updates suffice to disable the real trigger, but the inversion algorithm can find another effective trigger, so Lossdm must be added.
    • Synthetic data can replace real data: In Figures 8, 12, and 13, the SSIM and ASR curves for real and synthetic data overlap, and the FID trends are similar; the authors state that the entire framework can work without real data.

    Adaptive attacks (Section 4.6, Appendix B.11)

    • What was tested: An attacker fully aware of ELIJAH, with two adaptation strategies—directly using the removal loss to suppress the distribution shift at time step T; or injecting the shift only starting from step T−1 and training step T with only the clean loss.
    • Results: The authors report that backdoor injection fails for both adaptive attacks, because injection depends on the distribution shift, and suppressing or misaligning it makes the attack fail.

    Other ablations and analyses

    • Trigger size (Appendix B.3, Table 3, TrojDiff, 3×3 to 9×9 white squares): all detected, ∆ASR all -1.00, ∆FID 0.02–0.11.
    • Poisoning rate (Appendix B.4, Table 4, BadDiff, 0.05–0.90): all detected, ∆ASR all -1.00, ∆FID -0.11–0.20.
    • ODE sampler details (Appendix B.8, Table 5, VillanDiff, 11 samplers): ACC all 1.00, ∆ASR and ∆SSIM all -1.00, ∆FID 0.14–0.25.
    • Inpainting task (Appendix B.10): the authors state that the backdoor injected by BadDiff can be detected and completely removed, with inpainting capability almost unchanged (no numbers given).
    • Inverted trigger visualization (Appendix B.9, Figure 14): the inverted trigger is usually not exactly the same as the real trigger, which the authors state does not pose a problem for detection and removal.
  5. What are some points that can be further explored?

    The paper has no limitations section; the experiments cover 3 attacks, 13 samplers, and two datasets, and only two adaptive attacks.

    Limitations and future directions noted by the authors

    The paper does not specifically discuss limitations (there is no Limitations section, and neither the Conclusion nor the appendix contains an explicit sentence saying "this is a limitation/future work").

    Scope of experiments

    • The models tested are three architectures, DDPM, NCSN, and LDM, and 13 samplers, totaling 151 clean models and 296 backdoored models (Section 4.1).
    • The attacks cover all three noise-to-image DM backdoor attacks in the literature at the time of writing: BadDiff, TrojDiff, and VillanDiff (Section 4.1).
    • The datasets are CIFAR-10 (32×32) and downsampled CelebA-HQ (256×256), two in total (Section 4.1).
    • The adaptive attack evaluation tested two strategies, and the authors report that both injections failed (Section 4.6, Appendix B.11).
    • Key hyperparameters come from subset tuning or empirical settings: λ=0.5 was tuned on some models within [0,1] with a step size of 0.1; detection uses only 16 generated images; the inversion and removal algorithms are each run once per model (Appendix B.1).
  6. Summarize the main content of the paper

    ELIJAH attributes DM backdoors to a distribution shift; the authors report detection close to 100% and the backdoor effect close to zero after removal.

    A backdoor defense paper for diffusion models (DMs); the authors describe it as a backdoor detection and removal framework for DMs.

    • Problem: Once a DM is injected with a backdoor, input noise carrying a trigger generates a target image; traditional classifier backdoor defenses rely on labels and cannot be used for label-free DMs.
    • Method: The authors unify the three attacks BadDiff, TrojDiff, and VillanDiff as injecting a trigger-related distribution shift along the diffusion chain, and on this basis propose ELIJAH: invert a trigger that preserves the distribution shift (optimizing only at time step T, λ=0.5); detect using the uniformity score and TV loss of 16 generated images (random forest or a 5% FPR threshold); pull the backdoor distribution back to the clean distribution with Lossrb+Lossmc+Lossdm, using either 10% real data or synthetic data generated by the model itself.
    • Results (Table 1, 151 clean and 296 backdoored models, 3 architecture types, 13 samplers, 3 attacks): average ACC 1.00, ∆ASR -0.99, ∆SSIM -0.97, ∆FID 0.03; the exception is NCSN-C under the VillanDiff attack, with ∆ASR -0.96 and ∆FID 0.17.
    • Threshold detection (Table 2, clean models only, FPR=5%): the lowest single-feature threshold detection rate is 92.04% (U@5 for BadDiff DDPM-C), with most at 100.
    • Comparisons and ablations: Fine-tuning with only 10% real data cannot remove the backdoor (ASR stays close to 1, Figure 7); the removal curves for real and synthetic data overlap (Figure 8); ∆ASR is -1.00 for trigger sizes 3×3–9×9 and poisoning rates 0.05–0.90 (Tables 3, 4).
    • Adaptive attacks: Both attack strategies aware of the framework fail to inject (Appendix B.11).
    • Authors' conclusion: ELIJAH has detection accuracy close to 100%, can completely eliminate the backdoor effect in most cases without noticeably sacrificing model utility, and the entire pipeline can operate without relying on real data.

Related papers

Show 3 more papers
Read originalarxiv.org