Class-Conditional Neural Polarizer: A Lightweight and Effective Backdoor Defense by Purifying Poisoned Features

Mingli Zhu, Shaokui Wei, Hongyuan Zha, Baoyuan WuarXiv 2025 · DOI

Abstract

Deep Neural Networks (DNNs) are vulnerable to backdoor attacks, where malicious triggers cause incorrect predictions. We present the Class-Conditional Neural Polarizer (CNPD), a lightweight defense that "purifies" features by filtering out trigger-related signals. Inspired by optical polarizers, CNPD inserts a single learnable layer into a frozen, compromised model. By leveraging the model's own predictions to guide the purification process, CNPD achieves state-of-the-art defense across multiple benchmarks, reducing Attack Success Rates (ASR) significantly (e.g., from 93.56% to 0.62% on CIFAR-10) with minimal computational overhead.

Introduction

Deep Neural Networks (DNNs) are notoriously vulnerable to backdoor attacks. In these scenarios, an attacker poisons the training data so the model behaves normally on clean inputs but predicts a specific "target label" whenever a secret "trigger"—such as a small pixel patch or a subtle color shift—is present.

Existing defenses typically involve fine-tuning the entire model on clean data or pruning suspicious neurons. However, fine-tuning is computationally expensive and can degrade original accuracy, while pruning often fails to isolate "backdoor neurons" without damaging core functionality. There is a critical need for a "surgical" defense that is lightweight, fast, and does not require full network retraining.

Methods

The authors introduce the Neural Polarizer (NP), a lightweight linear transformation layer inserted into the middle of a backdoored model.

The Polarizer Concept

Just as an optical polarizer filters light based on orientation, the NP is trained to "filter" features. It treats a poisoned sample as a combination of benign features and trigger features, aiming to suppress the latter.

Conceptual comparison between an optical polarizer and the proposed Neural Polarizer.

Training and Implementation

To train the NP without knowing the actual trigger, a bi-level optimization strategy is used. "Targeted adversarial perturbations" serve as proxies for unknown triggers, and the NP is trained to "unlearn" these perturbations.

The core innovation is Class-Conditioning (CNPD). Since a successful attack causes the model to predict the attacker's target label, CNPD uses this predicted label as a "condition" to tune the purification process. Three implementations were explored:

  • r-CNPD (Replicated): Separate NP layers for every class.
  • e-CNPD (Embedding-based): Class embeddings modulate a single NP layer for scalability.
  • a-CNPD (Attention-based): An attention mechanism allows the predicted class to suppress specific feature channels.
Architectural overview of (a) the basic Neural Polarizer defense and (b) the Class-conditional Neural Polarizer defense during training and test phases.

Results

The method was evaluated against 10 state-of-the-art backdoor attacks across CIFAR-10, GTSRB, and Tiny ImageNet.

  • Effectiveness: On CIFAR-10, the a-CNPD variant reduced the average Attack Success Rate (ASR) from 93.56% to 0.62%, while maintaining a Clean Accuracy (ACC) of 91.78%.
  • Efficiency: Training is remarkably fast; a-CNPD takes only 3.35 minutes on CIFAR-10, significantly faster than competing methods like SAU.
  • Robustness: The defense remains effective with as little as 0.1% clean data.
  • Detection: A derived tool, NPDT, achieved a 99.68% True Positive Rate in identifying poisoned samples by comparing model outputs with and without the polarizer.

Conclusion

CNPD provides a "surgical" and theoretically grounded defense against backdoor attacks. By inserting a lightweight, class-conditional layer, it effectively purifies malicious features without the need for extensive retraining. Future work includes exploring data-free versions and extending the approach to non-vision tasks like Large Language Models (LLMs).

Summary updated

BibTeX
@misc{zhu2025class,
  author = {Mingli Zhu and Shaokui Wei and Hongyuan Zha and Baoyuan Wu},
  title = {{Class-Conditional Neural Polarizer: A Lightweight and Effective Backdoor Defense by Purifying Poisoned Features}},
  year = {2025},
  eprint = {2502.18520},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.18520},
}
Figure