Telling Triggers from Shift: Shift-Conditioned Backdoor Detection

Many runtime defenses against backdoor attacks rest on one signal: confidence that is too high or too stable. A backdoor attack, or trojan, is a hidden behavior planted during training so that the model works normally until an input carries a secret trigger, which flips its prediction to an attacker's chosen label. Defenses such as STRIP flag an input when its prediction barely changes as the input is perturbed. Defenses such as PSBD flag an input when its prediction barely changes as neurons are randomly dropped. Research on out-of-distribution calibration, meaning how well a model's stated confidence matches its real accuracy once test data drifts from training data, has shown that natural shift produces a similar kind of distortion. On blurred, noisy, or new-hospital images, clean models become confidently wrong. Every backdoor detector we found in the literature was tuned and tested only on in-distribution data. That leaves a simple, unanswered deployment question: when the camera fogs up, does the detector start rejecting honest inputs as trojaned, or does it loosen its threshold and let real triggers through?

We propose to treat the backdoor detector's score as a quantity that itself needs calibrating under shift. The idea is to model how a clean input's stability score should vary with how far that input sits from the training distribution, and then to flag only inputs whose stability is abnormal for their level of shift. In practice, we fit a conditional "clean" reference distribution for the detector score, indexed by cheap descriptors of shift: the penultimate-layer feature norm and the input's typicality under its predicted class. We fit this reference on clean validation data plus synthetic corruptions. At test time, each input receives a conditional p-value. The claim is that this restores detection at a fixed false-rejection rate on natural shifts never seen during fitting, where pooled or in-distribution thresholds fail.

Core Claim

Confidence-based backdoor detectors confuse two different causes of unusual confidence. Shift-induced overconfidence moves together with measurable features of the representation. MaxEnt Loss found that OOD overconfidence goes with inflated penultimate $L_2$ feature norms, and AdaTS found that class-typicality likelihoods predict how much each sample's confidence needs correcting. Trigger-induced stability comes from a shortcut pathway: the "neuron bias" described by PSBD, or the input-agnostic dominance exploited by STRIP. We hypothesize that, once we condition on the shift descriptors, the remaining stability is mostly trigger signal.

Let $s(x)$ be any detector score, such as STRIP entropy or PSBD's prediction-shift uncertainty. Let $d(x)$ be the shift descriptor, made of feature norm and class typicality. The test statistic is the conditional p-value

$$ \pi(x) = \Pr_{x' \sim \text{clean}}\big[\, s(x') \le s(x) \;\big|\; d(x') \approx d(x) \,\big], $$

which we estimate by quantile regression of $s$ on $d$ over clean reference data. An input is flagged when $\pi(x) < \alpha$. If clean shifted inputs really have stability that is predictable from $d$, then $\pi$ stays close to uniform on clean data at any shift level. The false-rejection rate is then held near $\alpha$, which is what an in-distribution threshold cannot do.

Relation to Prior Work

Two attack papers motivate the proposal by showing that confidence signals can be manipulated. Label-Smoothed Backdoor Attack trains triggers to be only "just enough" confident and drives STRIP's false acceptance near 100% on MNIST and CelebA. Confidence-driven Sampling poisons samples near the decision boundary so they blend into clean feature clusters. Neither paper looks at deployment shift. We use both as stress tests, and we expect them to remain hard. Our method targets the false alarms and missed detections that shift causes, not attacks that are under-confident by design.

Two defense papers are the closest work on separating benign variation from poisoning. SDFC recognizes that outlier filters in federated learning mistake honest client heterogeneity for poisoning. It works in parameter space during training, while we work on per-input scores at test time. OSCS wraps detector scores in online density estimation with provable false-acceptance control. It explicitly assumes stationary or slowly drifting traffic and becomes conservative when score distributions overlap. Our conditioning attacks that overlap directly, and the two approaches could be combined. Django uses the word "calibration" for reweighting bounding-box losses, not for probabilities, so it shares the vocabulary but not the problem.

From calibration research we reuse methods. MaxEnt's feature-norm finding gives us one descriptor. AdaTS's typicality signal gives the other. We replace its per-class variational autoencoder with class-conditional Gaussians on frozen features, because the file reports that mixture priors scale poorly with many classes. The calibration survey supplies a constraint: post-hoc fixes tuned on proxy shifts can overfit to those shift types. We therefore evaluate only on shift families and natural shifts held out from fitting.

Research Program

The first stage is diagnostic. Using the BackdoorBench codebase, we train backdoored PreAct-ResNet18 models on CIFAR-100, GTSRB, and Tiny ImageNet with BadNets, WaNet, LSBA, and CBS poisoning. We also poison the WILDS Camelyon17 training hospitals with BadNets. We then measure STRIP entropy and PSU, which we compute at test time from PSBD's dropout procedure, under three conditions: clean shifted inputs, triggered shifted inputs (the trigger applied after corruption), and in-distribution inputs. The shifted data are CIFAR-100-C, TinyImageNet-C, and held-out Camelyon17 hospitals. This stage answers the open question directly: how far do false rejections and missed detections move with corruption severity?

The second stage builds the conditional reference. We use the same clean validation budget PSBD already assumes, 5% of the data. We augment it with corruptions from a training subset of corruption families, such as noise and blur, and fit quantile regressions of each detector score on $d(x)$. Evaluation covers the held-out families (weather, digital) and the WILDS hospitals.

The third stage tests the mechanism. We check whether triggered and clean-shifted inputs overlap in $d$ but separate in $s$ given $d$. We also run an adaptive attacker who adds a loss term matching the feature norm and typicality of triggered inputs to clean ones. Finally, we train backdoored models with MaxEnt Loss to see whether norm-suppressing training weakens trigger pathways or only flattens the descriptor.

Baselines

The naive reference point is each detector with its threshold set on in-distribution clean validation data and applied unchanged under shift. This is how STRIP and PSBD are reported. In distribution, STRIP reports 0% false acceptance and 0% false rejection in most CIFAR-10 and GTSRB cases. PSBD reports a true-positive rate near 1.0 with a 10–15% false-positive rate on CIFAR-10, and 0.996 TPR against WaNet on GTSRB. We found no reported result on Lacuna for any backdoor detector on CIFAR-100-C, TinyImageNet-C, or WILDS. Establishing those numbers is the first contribution.

The strongest existing competitor is PSBD's uncertainty score. It handles WaNet where other methods fail, and it already depends on representation stability, which is the quantity shift disturbs. We run it with its published dropout-rate tuning on the same 5% clean split. The strongest score-wrapping competitor is OSCS applied to the same raw scores on the same streams, with matched target rate $\alpha = 0.05$. OSCS reports staying at or below a 0.05 target false-acceptance rate on AdvBench jailbreak streams, but under stationarity.

The key ablation is a pooled-threshold variant. It recomputes the unconditional threshold on the same corruption-augmented clean data and drops the conditioning on $d$. Any gain then comes from conditioning, not from extra data. We also ablate each descriptor separately.

All methods share models, validation data, and corruption-augmentation budget. Beating the baselines means two things on held-out shift families at severity 3–5. The false-rejection rate on clean inputs must stay within a factor of 1.5 of $\alpha$ where the baselines exceed it. True-positive rate at that matched false-rejection rate must be higher than the pooled variant by a margin larger than the seed-to-seed variation.

Why not just…?

Why not just recalibrate the detector threshold on corrupted clean data? This is the pooled ablation, and it is the most serious threat. If clean stability under shift drifts mostly as a single shift in level, pooling will match conditioning. Conditioning only helps if severity varies across inputs and the descriptor tracks it. The pooled-versus-conditional comparison on held-out families settles this. If pooling wins, the conditioning step adds nothing and should be dropped.

Why not just train with MaxEnt Loss so shifted inputs stop being overconfident? MaxEnt cut CIFAR-100-C ECE from 10.2% (cross-entropy) to 6.30%, which could shrink the detector's drift on its own. But the user of a supplied model usually does not control its training. It is also untested whether norm suppression interacts with trigger pathways at all; the file flags this as uncharacterized. Our third-stage experiment measures the in-distribution-threshold detector on MaxEnt-trained backdoored models. If that detector is already stable under shift, the use case narrows to post-hoc settings.

Why not just reject everything an OOD detector flags as shifted? That gives up utility on exactly the inputs a deployed system must handle, such as fog for traffic signs or a new hospital for pathology. Triggered inputs are also atypical, so an OOD filter cannot tell which shifted inputs are malicious. We report clean accept-rate under shift for a typicality-only rejector, which is just the descriptor $d$ used as a detector, to make this cost concrete.

Decisive Checks

The proposal stands or falls on three results. First, in-distribution thresholds must show a measurable rise in false rejections or drop in detection on CIFAR-100-C, TinyImageNet-C, and Camelyon17; if detectors are already robust to shift, the problem is not real. Second, conditional p-values must stay roughly uniform on clean data from shift families held out from fitting, which we check with reliability plots of $\pi$ by severity. Third, conditioning must beat pooling at matched false-rejection rate. We will also report honestly whether LSBA and the descriptor-matching adaptive attacker defeat the method. We expect they may, because both deliberately erase the stability gap rather than hide in shift.