Backdoors Look Invariant: Trigger-Transplant Environments for Invariant Learning

A backdoor attack plants a hidden rule in a model. A small fraction of the training data is stamped with a trigger, such as a pixel patch or a blended pattern, and relabeled to an attacker's target class. The resulting model behaves normally on clean inputs and outputs the target whenever the trigger appears. One line of defense work treats the trigger as an extreme spurious correlation, a shortcut that predicts the label far better than any natural feature (Mitigating Backdoor Poisoning Attacks through the Lens of Spurious Correlation). It is therefore tempting to apply Invariant Risk Minimization (IRM), a training objective built to make models ignore spurious correlations (Invariant Risk Minimization). IRM keeps only features whose relationship to the label stays the same across several training "environments", meaning subsets of the data collected under different conditions. The obvious recipe would split the data into clean and suspected-poisoned environments and train with IRM.

This note argues that the obvious recipe should fail, and that the reason points to a better design. The rule "if trigger, then target; otherwise use the image content" is exactly as predictive in the clean environment as in the poisoned one, so the backdoored model is the invariant solution. IRM can only reject a trigger if some environment shows the trigger present while the label is not the target. We propose to build that environment without knowing the trigger. Pieces of suspected-poisoned inputs are transplanted onto clean inputs of other classes, and the clean labels are kept. IRM then trains across the clean and transplant environments. The specific claim is about tolerance to imperfect detection. Filtering suspects and retraining with ordinary training fails when even a small number of poisoned samples slip through, because low poisoning rates already suffice for a strong backdoor (BackdoorBench: A Comprehensive Benchmark of Backdoor Learning). The invariance penalty should suppress the trigger even when the "clean" environment still contains leaked poison.

Core Claim

Two claims are testable, and the first is a negative prediction worth establishing in its own right. Let $s$ be the semantic content of an input and $t \in \{0,1\}$ indicate trigger presence. In a dirty-label attack the clean environment has $t=0$ and label $y=f(s)$; the poisoned environment has $t=1$ and $y=c$, the target class. Consider the representation $\Phi=(s,t)$ with the classifier $w$ that outputs $c$ when $t=1$ and $f(s)$ otherwise. This $w$ is simultaneously optimal in both environments, so it satisfies the IRM condition exactly. The representation $\Phi=s$ is not invariant: its optimal classifier is $f(s)$ in one environment and the constant $c$ in the other. IRM on a clean/poisoned split therefore prefers the backdoor.

The constructive fix adds an environment $e_{\text{tr}}$ in which suspected trigger carriers appear with labels drawn from clean data. The predictive relation of $t$ then differs between the leaked-poison clean environment and $e_{\text{tr}}$, and $s$ stays predictive in both. Training uses the gradient-penalty form of IRM from Invariant Risk Minimization:

$$\min_{\Phi} \sum_{e \in \{e_{\text{clean}}, e_{\text{tr}}\}} \Big( R^e(\Phi) + \lambda \,\big\| \nabla_{w} R^e(w \cdot \Phi) \big|_{w=1} \big\|^2 \Big).$$

Here $R^e$ is the cross-entropy risk in environment $e$, $w$ is a scalar dummy classifier, and $\lambda$ sets the strength of the invariance penalty. The second claim is that this objective keeps attack success low across a range of detector recall where filter-then-retrain does not.

Relation to Prior Work

Two works motivate the proposal. The spurious-correlation paper above supplies the framing: it treats triggers as shortcuts. It acts only by filtering text data with token and parse-tree z-scores, and it is vulnerable to blended triggers that lower those scores. We keep the framing but act on the training objective, and we deliberately study leaky filters. Adversarial Invariant Learning learns worst-case environment splits. It reports 97.05% versus 75.94% for ordinary training under MNIST data poisoning, but on untargeted poisoning, not sleeper triggers. Our analysis predicts that its splitter, like the environment inference method EIIL (Environment Inference for Invariant Learning), can isolate the poisoned set. It also predicts that this isolation alone yields the wrong invariant.

Two works constrain the design. Certified Causal Defense with Generalizable Robustness combines IRM with smoothing against test-time perturbations under domain shift and needs environment labels. We address training-time triggers, and we construct our environments rather than receiving them. Persistent Backdoor Attacks in Class-Incremental Learning via Structural Invariant Anchoring anchors triggers in structurally stable shallow subspaces and keeps over 82% attack success against Fine-Pruning. That is a warning that "invariant" in the architectural sense can protect a backdoor, and it is consistent with our negative prediction. The critiques in Does Invariant Risk Minimization Capture Invariance? and What Is Missing in IRM Training and Evaluation? Challenges and Solutions question whether the IRM penalty enforces invariance with deep nonlinear representations. We therefore treat penalty tuning and the comparison to plain counterexample augmentation as central, not incidental.

Two defenses supply method pieces. STRIP: A Defence Against Trojan Attacks on Deep Neural Networks superimposes clean images on a query and measures prediction entropy at test time. We reuse superposition at training time as the transplant operator. Adversarial-Inspired Backdoor Defense via Bridging Backdoor and Adversarial Attacks (AIBD) flags poisoned samples by how many adversarial-attack steps they need. It serves as one of our suspect detectors and as the strongest competitor.

Research Program

The work has three stages. The first verifies the negative prediction in a controlled setting. We build a Colored-MNIST-style task, matching the benchmark used by EIIL and AIL, with an added patch trigger at 1–10% dirty-label poisoning. We compare IRM on an oracle clean/poisoned split, EIIL-inferred splits, and AIL-inferred splits, and we measure whether the learned model keeps the trigger rule.

The second stage builds the transplant environment. A suspect set comes from a detector: AIBD, a loss-based detector from BackdoorBench, or EIIL's inferred minority group. Each suspect is combined with a clean image of a different class, and the clean image's label is kept. Three operators are compared. Alpha-blending follows STRIP. Random-patch pasting suits localized triggers. Full-image superposition at varied opacity suits sample-specific triggers such as ISSBA (ISSBA codebase). Suspects are then removed from labeled training, and IRM runs across the clean and transplant environments.

The third stage controls leakage directly. Using ground-truth poison indices, we fix the fraction of poisoned samples that remain in the clean environment at 0%, 5%, 20%, and 40% of the poison budget. This separates the training objective's tolerance from detector quality.

Baselines

The naive reference point is ordinary training (empirical risk minimization, ERM) on the poisoned data with no defense. It fixes the attack success to beat, near 100% for standard attacks in BackdoorBench settings.

The strongest existing method is AIBD. It reports average attack success reduced from 99.73% to 0.33% on CIFAR-10 and from 99.62% to 0.08% on GTSRB (Adversarial-Inspired Backdoor Defense via Bridging Backdoor and Adversarial Attacks). It is the strongest competitor because it already detects and relabels poisoned samples, and relabeling also creates "trigger with non-target label" examples. We run it from the same poisoned data, architecture (ResNet-18 first, then the other BackdoorBench architectures), and epoch budget. Its hyperparameters get the same tuning budget as our penalty weight $\lambda$. Beating it means matching its attack success at equal clean accuracy while giving higher robust accuracy (the true-label accuracy on triggered inputs) on CIFAR-100 and Tiny-ImageNet. BackdoorBench reports that robust accuracy collapses as the class count grows. No reported result found on Lacuna for AIBD's robust accuracy on CIFAR-100 or Tiny-ImageNet, so we measure it ourselves.

Fine-Pruning (Fine-Pruning: Defending Against Backdooring Attacks on Deep Neural Networks) is the standard repair baseline. It reports attack success dropping from roughly 99% to roughly 30% on traffic signs. We run it through the BackdoorBench codebase with the same clean holdout we allow ourselves.

Filter-then-retrain uses the same suspect detector, discards suspects, and retrains with ERM. It isolates whether the invariance objective matters beyond the filter.

The key ablation is transplant-plus-ERM. It uses identical transplant data and environments but sets $\lambda=0$, so the transplants act only as counterexample augmentation. A second ablation runs IRM on the clean/suspect split without transplants, which is the direct test of the negative prediction. Our method beats the ablations if, at 20% leakage, its attack success is at least ten points lower than both filter-then-retrain and transplant-plus-ERM at matched clean accuracy, averaged over BadNets, Blended, WaNet, and SIG.

Why not just…?

Why not just filter suspects and retrain? This works when the detector catches everything. BackdoorBench shows that 1% poisoning already yields strong attacks while evading density-based defenses. A filter with 95% recall can therefore leave enough poison to rebuild the backdoor. The leakage sweep measures exactly where filter-then-retrain breaks and whether our objective moves that point.

Why not just add the transplant examples as augmentation and train normally? This is the real threat to the proposal. The counterexamples may do all the work, and the IRM penalty may add nothing, especially given the doubts about IRM with deep networks raised in Does Invariant Risk Minimization Capture Invariance?. Our reason to expect a gap is that ERM can fit an interaction: trigger alone predicts the target, trigger plus mixed content predicts the clean label. The penalty instead punishes any use of the trigger whose effect differs by environment. The $\lambda=0$ ablation settles this. If the gap is under a few points, we will report that the contribution is the transplant environment plus the negative result, not the penalty.

Why not just run EIIL or AIL off the shelf? Our analysis says their inferred environments, even when they perfectly isolate the poison, make the backdoored predictor invariant. Stage one tests this directly against oracle splits. If off-the-shelf environment inference removes the backdoor anyway, the negative claim is wrong and we will say so.

Why not just relabel suspects, as AIBD does? Relabeling depends on recovering the correct true label, which is the quantity BackdoorBench finds collapsing with many classes. Transplanting takes its labels from clean images, so it never needs a suspect's true label. The CIFAR-100 and Tiny-ImageNet robust-accuracy comparison tests whether this advantage holds.

Proposed Experiments

The decisive checks are four. First, on triggered Colored MNIST, IRM on the oracle clean/poisoned split should keep attack success near the undefended level while adding transplants removes it. This confirms or refutes the "backdoors are invariant" prediction.

Second, on CIFAR-10, GTSRB, CIFAR-100, and Tiny-ImageNet through BackdoorBench, we sweep leakage (0–40%) and poisoning rate (1%, 5%, 10%). We report clean accuracy, attack success, and robust accuracy, and we expect the IRM curve to stay flat where filter-then-retrain and transplant-plus-ERM rise.

Third, we stress the transplant operator with attacks it may not carry. ISSBA uses sample-specific invisible triggers, WaNet uses warping, and a PBTO-style shallow-anchored trigger probes architectural invariance. We report which operators preserve trigger activation, measured by the undefended model's target-class rate on transplanted inputs, since the method can only work when that rate is high.

Fourth, an adaptive attacker who knows the transplant operator designs triggers that blending destroys. This tells us whether the defense reduces to an arms race over the transplant operator.