DEFUSE: Generalizable Backdoor Defense for Self-Supervised Encoders with Generative Priors

Tuo Chen, Jie Gui, Minjing Dong, Lanting Fang, Ju Jia, Benlei Cui, Jian LiuarXiv 2026 · DOI

TL;DR

Self-supervised learning (SSL) encoders are highly vulnerable to backdoor attacks, but existing defenses are often limited to specific models or require unrealistic prior knowledge. DEFUSE solves this by using a fine-tuned conditional diffusion model to reconstruct images from latent representations, exposing backdoors through semantic mismatches between the original and reconstructed images.

What Problem Does This Paper Address?

Foundation models trained via self-supervised learning (SSL)—such as CLIP or contrastive visual encoders—are the backbone of modern computer vision. However, because they are trained on massive, uncurated internet datasets, they are highly susceptible to backdoor attacks. An attacker can poison a tiny fraction of the training data so that any image stamped with a specific "trigger" (like a small graphic or patch) gets mapped to a target representation (e.g., forcing a triggered image of a car to be encoded as a "banana").

Existing defenses are narrow: they are typically tailored to a single SSL paradigm (vision-only vs. vision-language) or rely on restrictive assumptions, such as having access to clean, uninfected in-distribution data. The authors of this paper introduce DEFUSE, a generalizable, black-box defense framework designed to detect backdoored inputs without needing any prior knowledge of the attack strategy, trigger type, or training data.

Methods

DEFUSE approaches backdoor detection through a Bayesian lens, framing it as a representation-conditioned image likelihood estimation problem. If an encoder is clean, reconstructing an image from its representation should yield something semantically consistent with the original input. If it's backdoored, the reconstructed image will instead match the attacker's target class or look like meaningless noise.

The framework operates in two main stages:

  1. Semantic Reconstruction via Conditional Diffusion: Because highly abstracted global features discard low-level spatial details, exact pixel-level reconstruction is intractable. DEFUSE relaxes this goal to semantic reconstruction. It takes a pretrained conditional denoising diffusion model (CDDM), like Stable Diffusion XL, and fine-tunes only its cross-attention layers. The suspect encoder's global features are projected into image prompt tokens to guide the diffusion process.
  2. Semantic Consistency Measurement: Instead of using pixel-space metrics (like $L_2$ distance), which fail when layouts or viewpoints shift, DEFUSE passes both the original and the reconstructed images through an independent, clean reference encoder (specifically DINOv2). It then calculates the cosine similarity between these two high-level feature vectors. A low similarity score flags a backdoor sample.
Figure 1: Illustration of the proposed framework for reconstructing backdoor representations back to the image space.

Datasets

  • Diffusion Model Fine-tuning: A poison-free 900-class split of ImageNet-1K (ImageNet-900).
  • Encoder Evaluation:
  • CLIP ViT-B trained on a 50K subset of CC3M and evaluated on ImageNet-1K.
  • ResNet18 (SimSiam) evaluated on ImageNet-100.
  • Out-of-Domain (OOD) Generalization: To test robustness beyond natural images, the authors evaluated DEFUSE on medical datasets (NIH ChestX-ray14, HAM10000) and remote sensing datasets (Aerial Image Dataset (AID), NWPU-RESISC45).

Key Insights and Ideas

  • Pixel-Level Metrics are a Trap: Low-level distance metrics like $L_2$ or SSIM are unreliable for evaluating generative reconstructions. Two images can be semantically identical (e.g., two different photos of a watch) but have massive pixel-space distances due to lighting or layout changes. Evaluating consistency in a robust feature space (like DINOv2) solves this.
  • Generative Priors as a Regularizer: By leveraging a frozen pretrained diffusion model and only adapting the conditioning modules, the framework inherits a strong natural image prior. This prevents the model from learning to reconstruct weird backdoor triggers, even if the fine-tuning dataset itself is partially poisoned.
  • Dual-Use as a Purifier: Beyond detection, DEFUSE can act as an image purifier. By adding noise to a suspect image ($t = 0.3T$) and running a few reverse diffusion steps conditioned on its representation, it effectively scrubs away the backdoor trigger, reducing the Attack Success Rate (ASR) to safe levels.
Figure 2: (a) Reconstruction performance across different CLIP encoders [43]. (b) Low-level distance metrics (e.g., L2) fail to reliably assess semantic consistency, as semantically similar images can exhibit high distances.

Key Results

  • Superior Detection Performance: DEFUSE consistently outperforms state-of-the-art detectors (DECREE, DBCL, DeDe, PatchSearch) across 7 prominent backdoor attacks. For instance, against the CLIP Backdoor attack, DEFUSE achieves an Area Under the Precision-Recall Curve (AUPRC) of 0.96. Against the stealthy BadEncoder attack, it hits 0.89 AUPRC.
  • Effective Purification: When deployed as a purifier, DEFUSE successfully drops the Attack Success Rate from over 88–95% down to under 10% (e.g., reducing BadCLIP ASR from 88.9% to 0.0%).
  • Excellent OOD Generalization: Despite being fine-tuned on ImageNet, the SDXL-backed detector maintained high Area Under the ROC Curve (AUROC) scores ranging from 0.90 to 0.98 when tested on medical X-rays and satellite imagery.

Limitations and Future Work

  • Computational Overhead: Running a diffusion model—even with optimized DDIM sampling (20–30 steps)—is computationally more expensive during inference than traditional clustering or statistical anomaly detection methods.
  • Adaptive Adversaries: Although the authors demonstrate that adding simple Gaussian noise can defend against basic PGD adversarial attacks on the consistency score, highly sophisticated adversaries that explicitly optimize triggers to fool the reference encoder space remain a threat for future work to address.

Summary updated

BibTeX
@misc{chen2026defuse,
  author = {Tuo Chen and Jie Gui and Minjing Dong and Lanting Fang and Ju Jia and Benlei Cui and Jian Liu},
  title = {{DEFUSE: Generalizable Backdoor Defense for Self-Supervised Encoders with Generative Priors}},
  year = {2026},
  eprint = {2608.25851},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.25851},
}
Figure