NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DiffSafeMerge: Mitigating Backdoor Inheritance in Diffusion Model Merging

Jiayang Zhang, Ji Guo, Jiachen Li, Wenshu Fan, Wenbo JiangarXiv 2026

TL;DR

Model merging allows developers to combine the capabilities of different diffusion models without costly retraining, but it leaves open a dangerous vector for inheriting hidden backdoors from compromised public checkpoints. DiffSafeMerge (DSM) solves this by using attack-agnostic "stress probes" and a tiny clean dataset to identify and safely attenuate malicious model blocks at merge time. DSM completely eliminates backdoor activation across multiple benchmark attacks while maintaining significantly better image generation quality than existing sanitization methods.

What Problem Does This Paper Address?

In the generative AI ecosystem, parameter-space model merging (such as "Diffusion Soup") has become a dominant workflow. Platforms like Hugging Face and Civitai host thousands of community-shared Stable Diffusion checkpoints and LoRAs that developers frequently blend together to create customized models.

However, this open ecosystem is highly vulnerable to supply-chain attacks. An adversary can upload a compromised model containing a dormant backdoor. During normal generation, the model behaves perfectly fine, but when a specific "trigger" (like a subtle patch or noise pattern) is present, it forces the model to output a malicious or specific target image.

Standard merging techniques blindly inherit these backdoors. Traditional defenses fail here because they typically require knowing the specific trigger, the target image, or exactly which source model is malicious. Broadly sanitizing or fine-tuning the merged model often destroys its generation quality, defeating the purpose of a quick, training-free merge.

Figure 1: Motivating setting. The defender does not know whether an unverified source is compromised. Standard merging can inherit its hidden backdoor, whereas DSM scores and attenuates risky source contributions before merg- ing.

Methods

DiffSafeMerge (DSM) introduces a target-free, attack-agnostic defense mechanism that operates entirely at merge time. It requires white-box access to the source models, a trusted base reference model ($\theta_0$) from which the sources were derived, and a tiny, unlabeled clean dataset.

The DSM pipeline consists of three core steps:

  1. Target-Free Ratio-Scanned Stress Testing: Instead of guessing the backdoor trigger, DSM applies generic, attack-agnostic "stress probes" (such as random noise, patches, overlays, and textures) to the models. It counterfactually removes one block group at a time and tracks the model's response across multiple timesteps and merge ratios.
  2. Ratio-Scanned Stress-Safe (R3S) Scoring: DSM calculates an R3S score for each block based on two key hypotheses:
  3. Malicious blocks will produce highly amplified responses under generic stress compared to clean blocks.
  4. This anomalous response will remain directionally stable even as the merge weight changes. To protect critical model components, DSM applies a clean utility discount, reducing the risk score of blocks whose removal significantly harms normal clean denoising performance.

  5. Bounded Non-Renormalized Shrinkage & Backoff: Suspicious blocks have their weights attenuated (shrunk) back toward the trusted reference model. Crucially, DSM does not re-normalize the remaining weights, preventing the backdoor risk from being redistributed to other unverified source models. Finally, a clean-only quality backoff mechanism selects the strongest safe attenuation level that respects a strict clean-loss budget ($\tau = 0.02$).

Figure 2: DSM pipeline. R3S scores source–block risk from fixed ratio paths and target-free probes. Hierarchical aggregation guides bounded, non-renormalized shrinkage, and clean-only backoff selects the strongest candidate within the denoising-loss budget.

Datasets

The authors evaluated DSM on unconditional Denoising Diffusion Probabilistic Models (DDPMs) across two widely used image datasets:

  • CIFAR-10 (using a clean calibration set of just 8 images)
  • CelebA-HQ (using a clean calibration set of just 4 images)

The defense was tested against four state-of-the-art diffusion backdoor frameworks: BadMerging, BadDiffusion, UIBDiffusion, and VillanDiffusion, spanning 21 different target conditions.

Key Insights and Ideas

  • Backdoors are Loud Under Stress: You do not need the exact trigger to find a backdoor. Backdoored blocks inherently react much more violently to generic out-of-distribution stress (like basic textures or mask overlays) than benign blocks.
  • The Renormalization Trap: Traditional model merging forces weights to sum to 1. The authors point out that if you simply reduce the weight of a suspicious model and re-normalize, you risk amplifying a backdoor hidden in a different source model. DSM avoids this by letting attenuated weights fall back directly to the trusted reference model.
  • Utility-Aware Defense: Purely looking at anomaly detection can cause a defense to strip out blocks that are vital for high-quality image generation. By pairing stress testing with a clean denoising loss evaluation, DSM ensures that utility-critical blocks are left intact.

Key Results

When evaluating standard merging (Diffusion Soup), the merged models suffered from an Attack Success Rate (ASR) of up to 100% in compromised scenarios.

  • Complete Backdoor Mitigation: Across all tested datasets, attack types, and random seeds, DSM successfully brought the worst-target ASR down to 0%.
  • Superior Image Quality Preservation: While other defenses like Adversarial Neuron Pruning (ANP) can also eliminate the backdoor, they severely degrade the model's generation capabilities. DSM maintains excellent image quality, measured via Fréchet Inception Distance (FID):
  • On CIFAR-10: DSM achieved a case-averaged FID of 50.2, vastly outperforming ANP's 243.4.
  • On CelebA-HQ: DSM achieved an FID of 166.2, compared to ANP's heavily degraded 418.0.
Figure 3: Matched seed-0 comparison. Color denotes worst- target ASR and marker area panel-scaled FID; crosses mark unavailable conditions. CFT and MaxF. denote clean fine- tuning and MaxFusion. Tables 1–4 give exact values.

Limitations and Future Work

  • Dependency on a Trusted Reference: DSM assumes that all source checkpoints are derived from a common, trusted reference model ($\theta_0$). If a user attempts to merge completely disparate models that do not share a common lineage, this framework cannot be applied directly.
  • Computational Overhead at Merge Time: While DSM adds zero overhead during inference, the merge-time diagnostic phase requires running multiple batched UNet forward passes to calculate the R3S scores, which increases the initial setup latency.

Summary updated

BibTeX
@misc{zhang2026diffsafemerge,
  author = {Jiayang Zhang and Ji Guo and Jiachen Li and Wenshu Fan and Wenbo Jiang},
  title = {{DiffSafeMerge: Mitigating Backdoor Inheritance in Diffusion Model Merging}},
  year = {2026},
  eprint = {2608.09445},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.09445},
}
Figure