Abstract
Backdoor attacks present significant risks to the security of deep neural networks (DNNs) in the NLP domain, as attackers can covertly manipulate a model’s output behavior by poisoning training data or tampering with the training process. This paper introduces a novel defense strategy, Backdoor Defense via Ensemble Knowledge Distillation (BDEKD), to mitigate various types of backdoors in compromised DNNs. BDEKD marks the first utilization of ensemble methods for backdoor mitigation. The framework requires only a minimal subset of clean data to generate several relatively heterogeneous and backdoor-cleaned teacher models. This is followed by data augmentation and an ensemble distillation technique designed to strip the backdoor from the student model. Empirical analysis demonstrates that BDEKD effectively lowers the success rate of six sophisticated backdoor attacks to approximately 17% while requiring only 20% of the training data and preserving clean accuracy around 85%.
Introduction
Deep Neural Networks (DNNs) in Natural Language Processing (NLP) are increasingly vulnerable to backdoor attacks. In these scenarios, an attacker poisons training data so the model learns a "sleeper agent" behavior: it functions perfectly on normal inputs but produces a specific, malicious output when it encounters a "trigger" (such as a rare word, a specific sentence, or a syntactic style).
Existing defenses often face a "Goldilocks" problem: they either fail to remove the backdoor entirely or are so aggressive that they destroy the model's original utility (Clean Accuracy). BDEKD addresses the need for a robust, general-purpose defense that works across various attack styles and requires minimal clean data to implement.
Methodology
The BDEKD framework consists of three main stages designed to neutralize backdoors while maintaining high model performance.
1. Teacher Diversification
Instead of relying on a single defense method, BDEKD creates three different "teacher" models from the compromised student model using three classic, individually imperfect strategies. This diversity ensures that the ensemble covers the "blind spots" of any single defense.
- Fine-tuning: Retraining on a small set of clean data.
- Re-init: Re-initializing the weights of the upper layers and retraining.
- Fine-pruning: Identifying and removing "dormant" neurons that are not activated by clean data but may be part of the backdoor path.
2. Semantic-Aware Data Augmentation
To prevent overfitting to the small amount of clean data available, the framework uses an enhanced version of Easy Data Augmentation (EDA). Crucially, it utilizes TF-IDF to identify and protect the most important words in a sentence (like sentiment-bearing words) while applying synonym replacement and random insertion to the remaining tokens.
3. Ensemble Knowledge Distillation
This is the core innovation. A "student" model is trained to mimic the internal representations—specifically the [CLS] token hidden states—of all three teachers simultaneously. By aligning the student's internal logic with an ensemble of teachers, the student learns to ignore the backdoor triggers that any single teacher might have missed.
Experimental Results
The framework was evaluated on four standard NLP benchmarks (SST-2, HateSpeech, OLID2, and AG News) against six distinct backdoor attacks, ranging from simple word-injection (BadNets) to complex syntactic triggers (HiddenKiller).
- Attack Mitigation: BDEKD lowered the Attack Success Rate (ASR) of sophisticated attacks to an average of ~17%, down from nearly 100% in undefended models.
- Utility Preservation: Clean Accuracy (CA) remained robust at approximately 85%, ensuring the model stayed useful for its intended task.
- Superiority over Baselines: BDEKD significantly outperformed individual defenses. For example, against the "HiddenKiller" attack on SST-2, BDEKD achieved an ASR of 22.4%, whereas simple fine-tuning left the ASR at 100%.
- Interpretability: Using LIME and attention heatmaps, the authors demonstrated that while poisoned models fixate on trigger words (like "bb"), the BDEKD-defended model ignores them and focuses on the actual semantic content of the sentence.
Limitations and Future Work
While effective, BDEKD involves higher computational overhead than single-model fine-tuning due to the ensemble training. Additionally, the current method relies on architectural alignment (e.g., BERT-base to BERT-base) to align hidden states. Future work may explore cross-architecture distillation and scaling these methods for multi-billion parameter Large Language Models (LLMs).
Reference: Zhang, Z., Miao, X., et al. (2025). BDEKD: mitigating backdoor attacks in NLP models via ensemble knowledge distillation. Complex & Intelligent Systems. https://doi.org/10.1007/s40747-025-02006-4
Summary updated