arXiv:2610.23589cs.CVOct 2026

Manuscript Offprint

arXiv:2610.23589

SemPurify: Semantics-Aware Data Purification for Black-box Backdoor Defense

Jiawei Yu, Syed Irfan Ali Meerza, Yi Wu, Amir Sadovnik, Jian Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Backdoor attacks have emerged as a critical security threat in machine learning, where adversaries embed triggers within poisoned training samples to manipulate a model's predictions on targeted inputs while leaving its general behavior unaffected. This stealthy nature makes backdoor attacks difficult to detect, as the model functions normally until activated by a specific malicious trigger. Current purification-based defenses use image transformations (e.g., blurring) to disrupt trigger patterns but often degrade image quality. Even with advanced restoration techniques like diffusion models, these approaches can still alter visual or semantic information, reducing utility for downstream tasks. To address this, we propose the first semantics-aware data purification framework for black-box backdoor defense, SemPurify, which explicitly incorporates multi-level semantics (i.e., low-level semantic embeddings and high-level image tags) within a text-to-image (T2I) framework to guide image restoration during purification. Using this semantic information, the T2I model subsequently refines the transformed samples, helping preserve visual details and semantic information during restoration. Extensive experiments spanning multiple backdoor scenarios, i.e., classification models, CLIP-style encoders, and generative models, demonstrate that SemPurify reliably removes backdoors while effectively preserving semantic information for downstream tasks.

1. Introduction

Backdoor attacks [2, 6] pose a covert yet severe threat to machine learning systems. In such attacks, adversaries embed hidden triggers into training data so that the trained model behaves normally on clean inputs but produces attacker-specified outputs when the trigger is present. At inference time, these triggers cause the model to follow attacker-specified behaviors: targeted misclassification in classification models; targeted prediction or malicious prompt generation in CLIP-style encoders [1, 27, 28]; and attacker-directed content synthesis in generative models (e.g., [17, 40]).

To address the concerns caused by backdoor attacks, researchers have developed a variety of defense methods. Many existing approaches [4, 9, 10, 12, 20, 46, 55, 57] focus on detecting and filtering poisoned samples before training. However, simply removing such samples can lead to a loss of critical training data. Other lines of defense rely on additional assumptions, such as prior knowledge of clean samples [21, 22, 50, 62] or access to the model [3, 13, 20]. While effective under ideal conditions, these methods can become inapplicable when such information is unavailable. To overcome these limitations, recent works have explored purification-based defenses [19, 24, 42, 53, 61] which aim to remove backdoor triggers directly from data without requiring model access. These methods are particularly attractive in black-box scenarios, where defenders cannot inspect the model or access clean samples. However, existing purification approaches still suffer from important limitations. Some methods (e.g., [24]) provide limited protection against sophisticated backdoor attacks, while others (e.g., [42, 61]) can alter visual details or semantic information during purification, which can adversely affect the performance of downstream tasks.

The challenges of backdoor attack and current defense limitations raise a key question: Can we eliminate backdoor triggers while preserving semantic information in a fully black-box setting, without access to clean samples or prior knowledge of the model? In this paper, we propose SemPurify, a semantics-aware, black-box data purification framework designed to disrupt backdoor triggers, if present, while preserving semantic information. Unlike some of the prior methods, SemPurify operates without access to model parameters, the training dataset, or knowledge of which samples are clean or poisoned.

Specifically, to retain semantic details throughout the data purification process, SemPurify first extracts multilevel semantics, including both low-level semantic embeddings and high-level image tags, from the data (either poisoned or clean samples) using an image tagging model, i.e.,

Recognize Anything Model (RAM) [60]. These two forms of semantic information are subsequently used to guide the restoration process.

To disrupt hidden poisoned triggers, we apply linear transformations [25, 42] (e.g., blurring); however, these transformations can also impact the data's semantic content, leading to a loss of important visual details. To address this, we leverage the extracted semantic embeddings and image tags to guide data restoration through a pre-trained text-to-image (T2I) model, such as Stable Diffusion [41], conditioned with ControlNet [58] for structural guidance. By explicitly incorporating multi-level semantic guidance into the restoration process, SemPurify preserves semantic information while effectively suppressing backdoor effects.

Our main contributions are summarized as follows:

• We propose the first semantics-aware black-box data purification framework that explicitly incorporates multilevel semantic information into the restoration process to remove backdoor triggers while preserving semantic information.

• We explore the benefits of combining low-level semantic embeddings with high-level semantic descriptions (i.e., image tags) to guide the purification process and empirically demonstrate that the two forms of semantic information provide complementary guidance for trigger removal and semantic preservation.

• Extensive experiments across multiple datasets, diverse backdoor attacks, and state-of-the-art purification defenses for classification models, CLIP-style encoders, and image-to-image generative models, demonstrate the effectiveness of SemPurify in mitigating backdoor attacks while preserving semantic information across all three settings.

References (62)