SCR: Detecting Backdoor-Poisoned Samples through Clean-Reference Residuals

Yi Yang, Jinyang Huang, Feng-Qi Cui, Yu-Tong Guo, Sirui Zhao, Haiming Jin, Weihua Li, Quan Bai, Meng LiarXiv 2026 · arXiv

TL;DR

The paper introduces Semantic Counterfactual Residualization (SCR), a novel defense that identifies backdoor-poisoned training samples by reconstructing individualized "clean" versions of every image. By isolating the parts of a sample's features that cannot be explained by a small set of trusted clean references, SCR can detect malicious triggers with over 99.5% accuracy across diverse attack types.

What Problem Does This Paper Address?

Deep neural networks are notoriously vulnerable to backdoor attacks. An adversary can inject "poisoned" samples into a training dataset—images that look normal but contain a hidden trigger (like a small patch or subtle warping). Once trained, the model behaves perfectly on normal data but misclassifies any input containing the trigger into a target class of the attacker's choosing.

The core challenge in Poisoned-Sample Detection (PSD) is distinguishing malicious signals from legitimate semantic variation. For example, in a "Dog" class, a Husky looks very different from a Chihuahua. Existing detectors often rely on class-level statistics, which can lead to two failures:

  1. False Positives: Legitimate but unusual clean samples are flagged as anomalies.
  2. False Negatives: Stealthy poisoned samples blend into the broad distribution of the class and go undetected.

SCR aims to solve this by moving from class-level averages to sample-specific baselines.

Methods

SCR operates on the principle of "counterfactual residualization." Instead of asking "Is this sample an outlier for this class?", it asks "What part of this sample's features cannot be explained by known clean data?"

The workflow consists of four main stages:

  1. Feature Extraction: Features are extracted from the training data using the potentially compromised model itself.
  2. Sample-Conditioned Clean Reconstruction: For every inspected sample, SCR finds the best way to represent it as a convex combination of a small set (e.g., 30) of trusted clean reference samples from the same class. This creates a "counterfactual" feature—what the sample would look like if it were composed entirely of clean components.
  3. Counterfactual Residualization: By subtracting the reconstructed "clean" feature from the original feature, SCR isolates the residual. If a sample is clean, the residual should be small or random. If it's poisoned, the residual should contain the signature of the backdoor trigger.
  4. Shared-Shift Detection: SCR doesn't just look for large residuals; it looks for coherence. It uses an anchored Gaussian Mixture Model to identify classes where a group of samples shows a consistent, shared shift in the residual space—a telltale sign of a systematic attack.
Figure 2. Overview of SCR. SCR contains four main stages: (1) extracting features of inspected samples and clean reference samples using an encoder; (2) reconstructing sample-specific benign representations from same-class clean references; (3) obtaining counterfactual residuals by subtracting the reconstructed benign components; and (4) estimating class-wise shared shifts, screening suspicious classes, and filtering poisoned samples through directional scoring.

Datasets

The authors evaluated SCR against 12 different backdoor attacks (including both "dirty-label" and "clean-label" varieties like BadNets, WaNet, and Blended) across three standard benchmarks:

  • CIFAR-10
  • CIFAR-100
  • Tiny ImageNet

Key Insights and Ideas

  • Individualized Baselines: The "aha moment" is realizing that class-level statistics are too coarse. By building a custom reconstruction for every image, SCR effectively "subtracts out" the natural diversity of the class, making the malicious signal stand out.
  • Coherence is Key: A single weird image might just be an outlier. However, if 50 images all deviate from their clean reconstructions in the exact same direction in feature space, it’s almost certainly a backdoor trigger.
  • Attack Agnosticism: Because SCR focuses on what is missing from the clean reconstruction rather than looking for specific trigger patterns, it is highly effective against a wide range of attacks, from obvious patches to invisible frequency-domain perturbations.

Key Results

SCR significantly outperformed eight state-of-the-art detection baselines (such as Spectral Signatures, SCAn, and Beatrix):

  • Near-Perfect Detection: It achieved an attack-averaged True Positive Rate (TPR) above 99.5% and kept the False Positive Rate (FPR) below 2% on all tested datasets.
  • Superiority on Complex Data: On CIFAR-100, SCR outperformed the strongest baseline by a massive 31 percentage points in macro-TPR.
  • Effective Purification: When the flagged samples were removed and the model was retrained, the Attack Success Rate (ASR) dropped to below 1%, effectively neutralizing the threat while maintaining high clean accuracy.
Visualization showing how poisoned samples (red) overlap with clean samples (blue) in raw feature space but become clearly separated in the residual space.

Limitations and Future Work

  • Clean Reference Set: SCR requires a small set of verified clean samples (the authors used 30 per class). While this is a common assumption in defense literature, obtaining these samples might be difficult in some real-world "in-the-wild" data collection scenarios.
  • Single-Target Focus: The current class-level screening is optimized for attacks targeting a single class. While the authors suggest it can be adapted, future work is needed to robustly handle multi-target or "all-to-all" backdoor attacks.
  • Computational Overhead: Reconstructing every sample in a massive dataset involves solving many small optimization problems, which may be a bottleneck for extremely large-scale applications.

Summary updated

Abstract

Deep neural networks are vulnerable to backdoor attacks, in which adversaries manipulate model predictions by injecting poisoned samples into training data. Detecting these samples remains challenging because legitimate semantic variation can obscure poisoning-related signals in learned representations. Consequently, class-level statistics used by existing detectors may flag benign feature deviations while overlooking poisoned samples that blend into the class distribution. In this paper, we propose Semantic Counterfactual Residualization (SCR), which uses a small set of clean reference samples to account for benign variation through sample-specific feature reconstruction. SCR identifies poisoned samples by detecting coherent deviations from these clean baselines, without requiring prior knowledge of the attacks. We evaluate SCR through experiments covering twelve dirty-label and clean-label attacks across CIFAR-10, CIFAR-100, and Tiny ImageNet. With a small clean-reference set, SCR achieves attack-averaged true positive rates above 99.5\% and false positive rates below 2\% on each dataset, outperforming eight representative detection baselines in macro-TPR.
BibTeX
@misc{yang2026scr,
  author = {Yi Yang and Jinyang Huang and Feng-Qi Cui and Yu-Tong Guo and Sirui Zhao and Haiming Jin and Weihua Li and Quan Bai and Meng Li},
  title = {{SCR: Detecting Backdoor-Poisoned Samples through Clean-Reference Residuals}},
  year = {2026},
  eprint = {2611.24558},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.24558},
}
Figure