SemPurify: Semantics-Aware Data Purification for Black-Box Backdoor DefenseSemPurify: Semantics-Aware Data Purification for Black-box Backdoor Defense
SemPurify uses multi-layer semantic-guided T2I for black-box backdoor purification; on CIFAR-10 the average ASR is 1.19% and PA is 85.00%.
Black-box inference-time purification. The defender has no prior knowledge of the attack setup, cannot access model parameters or training data, and does not know whether the input is poisoned; an independent pre-trained image labeling model that is not contaminated by this backdoor may be used. The goal is to remove the trigger and preserve semantics, so that the poisoned classifier and CLIP encoder return to the original label, and the generative model does not produce the attacker-specified pattern.
- Backdoor triggers make classifiers, CLIP encoders, and generative models output attacker-specified results on specific inputs while behaving normally otherwise. Detection deletes samples and loses data, and many defenses also require clean samples or model access. The authors aim to remove the trigger and preserve semantics under a fully black-box setting.
- SemPurify uses RAM to extract semantic embeddings and image labels, applies a linear transformation to the sample to disrupt the trigger, and then guides a pretrained T2I restoration with the label, the embedding, and ControlNet structural conditions. The restoration checkpoint in the experiments is not fine-tuned on the evaluated backdoor data.
- On the three classification datasets, SemPurify's average ASR is 1.19%, 2.35%, 3.18%, and average PA is 85.00%, 85.76%, 82.57%. BadCLIP's Caltech101 ASR is 0.20%; the generative model's CS is 0.78 and PS is 0.20.
- The paper does not specifically discuss limitations. The experiments cover ResNet-34 classification, BadCLIP on vanilla CLIP, and the I2I backdoor on EDSR super-resolution; the generative setting does not include ShrinkPad. The paper does not report the number of repetitions or the number of diffusion inference steps.
- Evaluated models
- ResNet-34vanilla CLIPEDSR
- Benchmarks
- CIFAR-10GTSRBImagenetteCaltech101OxfordPetsBSD100Set14
- Metrics
- CAASRPAPSNRSSIMLPIPSCSPS
SemPurify is a semantics-aware data purification framework for black-box backdoor defense. In a text-to-image framework, it introduces both low-level semantic embeddings and high-level image labels to guide the recovery of transformed samples, so as to preserve visual details and semantic information while disrupting trigger patterns; the authors claim this is the first such framework. In experiments across multiple backdoor scenarios including classification models, CLIP-style encoders and generative models, SemPurify can reliably remove backdoors while preserving the semantic information required by downstream tasks.
Paper analysis
What problem does this paper attempt to solve?
Remove backdoor triggers at black-box inference time while preserving downstream-usable semantics.
How to remove backdoor triggers and preserve semantics at black-box inference time without access to the model and without clean samples.
- Scenario: The authors state that backdoors embed triggers into training data; clean inputs behave normally, and only when the trigger appears does the model give the attacker-specified output. For classification it is targeted misclassification, for CLIP-style encoders it is targeted prediction or malicious prompt generation, and for generative models it is attacker-specified content synthesis; behavior is normal otherwise, making it hard to detect in time.
- Limitations of existing work: Detecting and deleting poisoned samples before training loses key training data. Another class of defenses requires clean samples or model access and is inapplicable when the information is unavailable. Purification methods can work without model access, but the authors state that some offer limited protection against complex attacks and some alter visual details or semantics, affecting downstream utility.
- This paper's approach: The authors ask whether triggers can be eliminated and semantics preserved under a fully black box, with no clean samples and no model prior. SemPurify extracts low-level semantic embeddings and high-level image labels, uses a linear transformation to disrupt the trigger, and then uses these semantics to guide text-to-image (T2I) restoration. The authors state that this is the first semantics-aware black-box data purification framework.
- Threat model:
- Victim systems: A classification model F(x), a CLIP-style encoder C(x) for few-shot classification, and an image-to-image generative model G(x) (the text uses super-resolution as an example). Poisoned models are denoted Fp, Cp, Gp.
- Attacker's goal: Add trigger p to a test image x to obtain xp. Fp should predict ytarget rather than ytrue; Cp maps xp toward the target label; Gp injects a specific pattern into the output, such as an unexpected image.
- Defender's knowledge: black-box. No prior about the attack setup, no access to model parameters or training data, and no knowledge of whether an inference input is clean or poisoned.
- Capabilities and goals: Assume access to an independent pretrained, trusted image-labeling model not contaminated by this backdoor. The goals are Trigger Removal and Semantic Preservation: after purification, classification predictions are correct, generative results are the expected pattern not altered by the trigger, and downstream-relevant content is preserved. Both clean samples and possibly poisoned test samples are purified.
What related research exists?
Related work is divided into image backdoors, and detection-based and inference-time purification-based defenses.
The introduction and Related Work divide related work into backdoor attacks, detection-based defenses, and purification-based defenses, and state that this paper focuses on inference-time, generally black-box defenses.
Backdoor Attacks
- Three categories in the image domain: Patch-based methods embed visible pixel blocks; the text uses BadNet as an example, and PhysicalBA adds physical transformations on top of it. Perturbation-based methods add imperceptible noise to the whole image; the text uses Blended as an example. Warping-based methods apply geometric deformation to the input; the text uses WaNet as an example.
- Encoders and generative models: The introduction describes backdoors on CLIP-style encoders as targeted prediction or malicious prompt generation, corresponding to BadCLIP in the experiments. The generative-side experiments use Jiang et al.'s image-to-image backdoor, with the task being super-resolution.
Detection-Based Defenses
- Pre-training filtering: The paper summarizes a group of works as detecting and filtering poisoned samples before training. The authors state that they do not remove the trigger from the sample, and are inapplicable when the key poisoned samples still need to be left for downstream use.
Purification-Based Defenses
- Transformation, masking, and training-set purification: Li et al. use flipping or scaling to weaken the trigger, which the authors state changes visual details and semantics. Chen et al. use a U-Net transformation module to eliminate backdoor patterns, which the authors state relies on an in-distribution benign dataset, rarely satisfied in a strict black box. May et al. and Sun et al. use masks to locate and cover the trigger region, which the authors state is difficult when the trigger covers the whole image (e.g., perturbation-based attacks). Other methods purify the training set to obtain a clean model, which the authors state relies on ground-truth labels and model architecture and is impractical in a black box.
- Inference-time diffusion purification: ZIP uses a pretrained diffusion model to restore semantics lost during purification, which the authors state may still alter fine-grained visual details. DataElixir combines label detection with diffusion purification and can be used in both training and inference stages; the authors state that it changes visual details and semantics, and that detection incurs additional computation. SampDetox uses two-stage noise diffusion, identifying highly visible triggers by structural similarity (SSIM) and selectively strengthening noise; the authors state that the stronger perturbation in the second stage also changes semantics. BDFirewall uses three-layer detection and applies different purification strategies to poisoned samples; the authors state that it still requires a clean subset to calibrate thresholds and is impractical when task-relevant clean data is unavailable.
Baselines and Datasets
- Comparison setup: Baselines are ShrinkPad, BDMAE, ZIP, DataElixir, and SampDetox. Classification data are CIFAR-10, GTSRB, and Imagenette; CLIP uses Caltech101 and OxfordPets; the generative model is trained on BSD100 and tested on Set14.
- Authors' positioning: Unlike the above works, SemPurify explicitly extracts multi-level semantics from the sample and uses them to guide restoration during purification, so as to preserve semantics while mitigating the backdoor effect.
How does the paper address this problem?
First extract semantic embeddings and labels, then after a linear transformation use them to guide T2I restoration.
SemPurify processes a possibly poisoned test sample xp in three stages to obtain a purified image x0: multi-layer semantic extraction, linear transformation, and semantic-conditioned diffusion restoration. It does not read the parameters of the protected model.
Multi-layer semantic extraction
- The labeling model is the Recognize Anything Model (RAM). The image encoder E is a Swin Transformer, and the low-level semantic embedding is Se=E(xp); the labeling head H is a two-layer transformer, and the high-level label is St=H(Se).
- The authors state that RAM was chosen because its label accuracy is higher than Tag2Text and Query2Label. The latter two decode with randomly learnable embeddings; RAM uses the 10000 most frequent labels, made into text label queries through a pre-trained CLIP encoder, and then interacts with the image representation.
- The authors state that under the evaluated attacks, the semantics extracted by RAM are largely stable. Figure 1 uses BadNet to steer an image labeled church toward dog; the caption states that the poisoned image adds two labels, which are still related to the context of the original image, and that there is no label associated with the target label dog.
Linear transformation
- Apply a linear transformation T to xp to obtain x+=T(xp). The paper's example is blurring, used to destroy the hidden trigger.
- The authors state that the transformation also loses visual details, so afterward the already-extracted Se and St are used to guide restoration, rather than relying only on the transformed image.
Conditional diffusion restoration
- An image condition encoder, ControlNet, and representation cross-attention (RCA) are added to a pre-trained T2I diffusion model. x+ passes through the image condition encoder into ControlNet as structural guidance. St is encoded by the T2I text encoder and injected through the original text cross-attention (TCA); Se is injected through RCA placed after TCA. ControlNet's condition features are injected into the corresponding U-Net blocks during denoising. The authors state that x+ provides structure, while St and Se provide high-level semantics and feature-level semantics, respectively.
- In the training described by the method, the VAE, text encoder, and original U-Net parameters of the pre-trained T2I backbone are frozen, and the image condition encoder, ControlNet, and RCA are optimized. The target image latent z0 is given Gaussian noise at a random time step t to obtain zt, and the loss is conditional noise prediction:
Ltrain=𝔼z0,t,ϵ|ϵ−ϵθ(zt,t,x+,Se,St)|22 that is, the denoising network predicts the added noise under the conditions x+, Se, and St.
- The reverse process is written as
zt−1=D(zt,t,x+,Se,St)+σt·ϵt D is the denoising network with the above condition modules, σt is the noise schedule standard deviation, and εt is standard Gaussian noise. The resulting z0 is decoded into x0.
- The experiments do not further fine-tune on the clean or poisoned backdoor data used for evaluation, but instead load a pre-trained restoration checkpoint. The authors state that this makes the restoration model independent of the evaluated attack. The main text does not give the number of inference diffusion steps and the blur kernel size, and states that more configurations are in the supplementary material.
How the two objectives translate into judgments
- Trigger Removal looks at whether the purified poisoned input no longer produces the attacker-specified output: for classification and CLIP few-shot classification, whether it leaves ytarget and returns to ytrue; for the generative model, whether the output is no longer close to the attacker's target image.
- Semantic Preservation looks at whether a clean input after purification still completes the original task, as well as the visual fidelity between the original image and the purified image. The metric definitions are placed in the experimental setup.
What experiments did the paper conduct?
In Table 1, SemPurify's average PA on the three datasets is 85.00%, 85.76%, 82.57%.
Experimental Setup
- Classification: Backbone is ResNet-34. Datasets are CIFAR-10 (10 classes), GTSRB (43 classes), and Imagenette (10 classes). Attacks are BadNet, PhysicalBA, Blended, Semantic Blended, and WaNet, with a 5% poisoning rate. For 32×32 images, BadNet and PhysicalBA use a random 2×2 pixel block; for 256×256, a random 9×9. Blended uses a blend ratio of 0.2 and Semantic Blended 0.1; the latter's patterns are 32×32 Hello Kitty for CIFAR-10 and GTSRB, and 256×256 Blue Elephant for Imagenette. WaNet's grid equals the input size. The classification setup follows ZIP, and the rest follows BackdoorBox. The main text states that more details are in the supplementary material.
- CLIP: The evaluated encoder is vanilla CLIP, the attack is BadCLIP, and the datasets are Caltech101 and OxfordPets. The downstream task is few-shot image classification; the paper does not state the number of shots. Metrics are the same as for classification.
- Generative model: EDSR for super-resolution, with an image-to-image backdoor attack. BSD100 is used for training and Set14 for testing. The paper does not state the poisoning rate for this setting.
- Baselines: ShrinkPad, BDMAE, ZIP, DataElixir, SampDetox. None access model internals or a task-relevant clean set. DataElixir is used only at test-set inference time and is not retrained. Methods requiring a clean set or model information were not included; the authors state that they fall outside this threat model. The generative experiments omit ShrinkPad; the authors state that it performs poorly in this setting.
- Metrics: CA is the proportion of purified clean images classified by the poisoned model as their original label; ASR is the proportion of purified poisoned images classified as the attacker's target label; PA is the proportion of purified poisoned images classified as their original label. On the generative side, SSIM defines CS (output from the purified clean low-resolution input versus the high-resolution ground truth) and PS (output from the purified poisoned low-resolution input versus the attacker's target image). PSNR, SSIM, and LPIPS between original and purified images are also compared. There is no LLM review. The paper does not report the number of repetitions or the number of test-set samples.
- Restoration network usage: A pretrained restoration checkpoint is used, without further fine-tuning on the evaluated backdoor samples. The efficiency experiment uses 50 256×256 Imagenette images on a single NVIDIA A100.
Main Results
The main classification results are five-attack averages on a poisoned ResNet-34, excluding the No Attack row (according to Table 1).
Swipe horizontally to read the table
Dataset Setting CA↑ ASR↓ PA↑ CIFAR-10 No defense, five-attack average 89.36 99.89 10.08 CIFAR-10 SemPurify, five-attack average 86.29 1.19 85.00 GTSRB No defense, five-attack average 98.08 99.77 5.90 GTSRB SemPurify, five-attack average 90.81 2.35 85.76 Imagenette No defense, five-attack average 86.15 89.92 18.82 Imagenette SemPurify, five-attack average 83.71 3.18 82.57 - The authors state that SemPurify's average PA is higher than other defenses in the same table on all three datasets, while maintaining a relatively low average ASR. CIFAR-10's average ASR is not the lowest: SampDetox is 0.90% and SemPurify is 1.19%. There are also per-row exceptions, e.g., for CIFAR-10 Semantic Blended, DataElixir's ASR is 0.89% and SemPurify's is 2.37%; for WaNet on the same dataset, SampDetox's ASR is 0.51% and SemPurify's is 1.41%.
- Without defense, not every attack's ASR is close to 100%. On Imagenette, PhysicalBA is 69.09% and Semantic Blended is 84.44%. The authors state that DataElixir often has high CA because samples not judged poisoned are left unchanged, while missed samples bypass purification. On Imagenette Blended, DataElixir's ASR is 96.66%, SampDetox's is 97.71%, and SemPurify's is 0.28%. BDMAE's three-dataset average ASR is 40.32%, 26.23%, and 35.66%.
- On Semantic Blended, the authors state that SemPurify has the highest PA on all three datasets. On CIFAR-10 Blended, the authors state that PA rises from the second-best 69.17% to 82.84% (the authors state an increase of 19.8%), and CA is 1.56 points below the highest value of 88.03%. On GTSRB Blended, the authors state that PA rises from ZIP's 66.56% to 84.56% (the authors state an increase of 27.0%), and CA is 3.98 points below BDMAE's highest CA.
Results on BadCLIP
- In Table 3, Caltech101 without defense has ASR 98.30% and PA 2.60%; SemPurify has CA 91.30%, ASR 0.20%, and PA 91.30%. ShrinkPad's CA is 91.70%, higher than SemPurify's, with ASR 0.90%. BDMAE has ASR 35.59% and PA 57.97%.
- OxfordPets without defense has ASR 99.30% and PA 5.50%; SemPurify has CA 93.40%, ASR 3.20%, and PA 93.30%. DataElixir has CA 95.02% and ASR 6.26%; SampDetox has ASR 4.08% and CA 89.26%; ShrinkPad has ASR 47.90%; BDMAE has ASR 49.33%.
- The authors state that on both datasets SemPurify has the lowest ASR and highest PA, and its CA remains competitive.
Results on Generative Model Backdoors
According to Table 4, ShrinkPad is not listed.
Method CS↑ PS↓ No defense 0.89 0.86 BDMAE 0.54 0.24 ZIP 0.69 0.38 DataElixir 0.61 0.21 SampDetox 0.66 0.27 SemPurify 0.78 0.20 - The authors state that among the evaluated defenses, SemPurify has the highest CS and lowest PS. BDMAE and DataElixir also lower PS to 0.24 and 0.21, but lower CS to 0.54 and 0.61.
- The attack target in Figure 4 is called a black bug pattern by the authors. The authors state that this pattern is suppressed after SemPurify purification, remains visible after other methods, and that this is consistent with the low PS in Table 4.
Ablation on Semantic Embeddings and Labels
- On the Imagenette classification backdoor, semantic embedding only (Se), image label only (St), and both are compared (Table 5).
- On Semantic Blended, Se only has PA 72.58% and ASR 6.96%, and both together give 77.65% and 6.11%. St only has lower CA and PA, e.g., for BadNet, CA is 68.84% and PA 69.22%, versus 83.21% and 83.36% for Se only. On PhysicalBA, Se only has PA 86.85%, and both together give 87.05%.
- The authors believe that Se anchors fine-grained visual content and St describes salient objects and scenes, and that combining them reduces reliance on a single semantic representation and gives better trade-offs on PhysicalBA, Blended, and Semantic Blended. On WaNet, both together give CA 76.94 and PA 76.91, lower than Se only's 82.39 and 82.70; the paper does not explain this. This both-together row is also inconsistent with WaNet in Table 1 (CA 81.80, ASR 1.21, PA 82.34), and the paper does not explain why.
Other Ablations and Analyses
- Table 2 does not state the dataset. The authors state that BDMAE has the highest PSNR and SSIM in most settings, and attribute this to reconstructing only the region localized as the trigger; when localization fails, the purified image can remain close to the poisoned input and leave the trigger. For the PhysicalBA column, PSNR is 27.63±2.57 for SemPurify and 27.56±4.71 for BDMAE; LPIPS is 0.05±0.04 and 0.08±0.04, respectively.
- In Table 2's Semantic Blended column, SemPurify's PSNR is 19.80±1.93, SSIM is 0.56±0.12, and LPIPS is 0.24±0.07. The main text puts PhysicalBA's LPIPS 0.05 versus 0.08 in the same sentence as that attack's ASR on Imagenette going from 20.54% to 7.33%.
- Table 6: on 50 256×256 Imagenette images on a single A100, SemPurify is 0.5101 seconds with peak GPU memory 5764.6 MB; ZIP is 1.0441 seconds, DataElixir is 15.2913 seconds with 1632.1 MB, SampDetox is 12.2146 seconds, ShrinkPad is 0.0047 seconds with 100.7 MB, and BDMAE is 0.2085 seconds. The authors state that the higher GPU memory comes from the large pretrained T2I but is still acceptable, and that the sub-second latency is suitable for deployment.
- Figure 3's columns include No Defense, ShrinkPad, BDMAE, ZIP, DataElixir, SampDetox, SEM PURIFY, and Original Image, and the rows cover No Attack and the five attacks. The authors state that ShrinkPad shows black regions; in several examples BDMAE leaves trigger-related patterns; in the shown BadNet example DataElixir alters facial details, and in the shown Blended example global noise remains visible after SampDetox.
What are some points that can be further explored?
The paper does not specifically discuss limitations or future directions.
Limitations and future directions noted by the authors
The paper has no dedicated Limitations, Discussion, or Future Work section. The conclusion in Section 6 only summarizes the method and experimental results, and does not frame memory, attack types, or data scope as limitations or future work. The paper does not specifically discuss limitations.
Scope of experimental coverage
- The backbone tested in the classification experiments is ResNet-34, the datasets are CIFAR-10, GTSRB, Imagenette, the attacks are BadNet, PhysicalBA, Blended, Semantic Blended, WaNet, and the poisoning rate is 5% (Section 5.1, Table 1).
- The CLIP experiment is BadCLIP on vanilla CLIP, the datasets are Caltech101 and OxfordPets, and the task is few-shot classification; the paper does not state the number of shots (Section 5.1, Table 3).
- The generative experiment is an image-to-image backdoor on EDSR super-resolution, trained on BSD100 and tested on Set14; Table 4 does not include ShrinkPad (Section 5.2.3).
- The compared defenses are ShrinkPad, BDMAE, ZIP, DataElixir, SampDetox. The authors write that methods requiring a clean set or model information exceed the threat model, so they were not included (Section 5.1).
- The ablation compares Se, St, and the two together only on Imagenette (Table 5). Efficiency is 50 images of 256×256 Imagenette, a single NVIDIA A100 (Table 6). The main text does not give the number of repetitions, the number of test set items, the blur kernel, and the number of inference diffusion steps, and states that more details are in the supplementary material.
Summarize the main content of the paper
Use multi-layer semantic-guided T2I for black-box purification, and report backdoor metrics on three types of models.
SemPurify is an inference-stage black-box backdoor data purification method: it does not read the parameters of the protected model, nor does it judge whether an input is poisoned.
- Problem to address: Triggers make classifiers, CLIP-style encoders, and generative models alter outputs only on specific inputs. Deleting poisoned samples loses data; defenses that rely on clean samples or model access are unusable under the black-box conditions the authors set. Existing purification may also alter visual details or semantics.
- Method: RAM extracts semantic embeddings and image labels; a linear transformation (the paper uses blur as an example) disrupts the trigger; a frozen-backbone T2I combined with ControlNet's structural conditions and these two levels of semantics performs restoration. Experiments load pretrained checkpoints and do not fine-tune on the evaluated backdoor data.
- Classification: On a poisoned ResNet-34, the five-attack average ASR of Table 1 on CIFAR-10, GTSRB, and Imagenette is 1.19%, 2.35%, and 3.18%, with average PA of 85.00%, 85.76%, and 82.57%. Average PA is higher than other defenses in the same table; on CIFAR-10, SampDetox has a lower average ASR of 0.90%.
- Two other model types: Under BadCLIP, Caltech101 has ASR 0.20% and PA 91.30%, and OxfordPets has ASR 3.20% and PA 93.30% (Table 3). On EDSR super-resolution, CS is 0.78 and PS is 0.20, versus PS 0.86 with no defense (Table 4).
- Authors' conclusion: The authors believe that explicitly feeding multi-level semantics into the restoration process helps suppress the backdoor in black-box purification while preserving relatively high PA and downstream-relevant semantics. In Table 6, its peak GPU memory is 5764.6 MB, higher than the listed baselines; the authors state that this overhead is still acceptable in practice.