Introduction
Diffusion Models (DMs) have revolutionized generative AI, becoming central to "Model-as-a-Service" (MaaS) platforms. However, this widespread deployment exposes them to backdoor attacks, where an attacker poisons training data so that a specific "trigger" (e.g., a pixel patch or a keyword) forces the model to generate a target output. Detecting these backdoors is challenging because defenders often lack access to model weights (black-box setting) and must handle diverse modalities like text and images.
The Causal Lens of UFID
The proposed Unified Framework for Input-level Backdoor Detection (UFID) is built on a fundamental causal insight. In a clean model, the output is driven by a causal path from the input noise or prompt; small perturbations to the input result in significant variations in the output. In contrast, a backdoored model contains a "spurious path" where the trigger acts as a dominant confounder. This path is unnaturally robust—the model "locks onto" the trigger, producing nearly identical target images even when the rest of the input is perturbed.
The UFID Pipeline
UFID operates during inference through a four-step process designed to expose this suspicious stability:
- Augmented Batch Generation: For a given query, UFID creates a batch of slightly varied versions. For images, it adds Gaussian noise. For text prompts, it appends random, semantically distinct phrases (e.g., "Iron Man", "Kitchen Dish Washer").
- Model Querying: These variations are sent to the diffusion model to generate a corresponding batch of images.
- Graph Density Calculation: A pre-trained encoder (like CLIP or ViT) converts these images into embeddings. UFID then constructs a similarity graph where nodes are images and edges represent their semantic similarity.
- Detection: The framework calculates a Graph Density Score. If the generated images are highly similar (high density), the input is flagged as a backdoor and rejected.
Experimental Evaluation
The researchers evaluated UFID against five state-of-the-art backdoor attacks (including TrojDiff and BadDiffusion) across datasets such as CIFAR-10, CelebA, and Pokemon.
- Effectiveness: UFID achieved nearly 100% AUC on unconditional models and approximately 90% AUC on conditional models, performing comparably to white-box methods that require full model access.
- Efficiency: The inference overhead is minimal. On Stable Diffusion, the detection process only slightly increases the time per sample, making it practical for real-time API deployments.
- Robustness: To counter "diversity-preserving" attacks, UFID uses a "Correspondence" score to verify if the output actually matches the semantic content of the prompt. If the model ignores the prompt to generate a fixed target, it is caught.
Conclusion
UFID represents the first unified, black-box defense specifically designed for diffusion models. By leveraging the inherent stability of backdoored outputs through a causal lens, it provides a robust and efficient safeguard for generative AI services without requiring internal model access.
Summary updated