Many deployed classifiers are retrained continually on data that arrives over time: user reports, moderation decisions, crowd labels. That makes them easy to poison. An attacker can slip in examples that carry a small "trigger", such as a rare token, and label them with a target class. The model then learns to output that class whenever the trigger appears, and behaves normally otherwise. This is a backdoor attack. For a fixed dataset there is a cheap and strong defense: treat the trigger as an extreme spurious correlation, meaning a feature whose link to one label is far too strong to be natural, and discard any example containing a feature with an outlandish z-score. In a stream, that defense breaks. The data drifts. Word frequencies surge with the news, class proportions shift, and the true relationship between inputs and labels changes. A static threshold then flags harmless words that suddenly become common, and it misses triggers spread thinly across a long period.
We propose a streaming, model-light trigger detector built on one question: does this feature predict the label beyond what the rest of the input already explains, and is that excess unusual compared with other features right now? Answering the first half separates triggers from harmless frequency surges. Answering the second half cancels drift that shifts every feature at once. Accumulating evidence over time catches slow, low-rate poisoning. The result keeps the speed and transparency of statistical filtering while staying calibrated under drift.
Core Claim
The closest prior work, Mitigating Backdoor Poisoning Attacks through the Lens of Spurious Correlation (Z-defence), compares each n-gram's or parse-path's label rate against the dataset-wide label rate. It removes sequences containing any feature with $z \ge 18$. On SST-2 under BadNet it reports a 0.0% false acceptance rate and cuts attack success from nearly 100% to below 10%. Its baseline is the marginal label rate, and that is exactly what moves under drift.
We replace the marginal baseline with a content-conditional one. For a candidate feature $f$ and an incoming example $i$ that contains $f$ and carries label $y_i$, define the residual
$$r_{i,f} = \mathbb{1}[y_i = c] - q_{i,\setminus f}(c),$$
where $c$ is the class most associated with $f$ and $q_{i,\setminus f}(c)$ is the probability a lightweight streaming reference model assigns to $c$ when $f$ is masked out of example $i$.
Consider how different features behave under this residual:
- A benign feature whose frequency surges with a news topic has a small residual, because the surrounding words carry the same label signal.
- A dirty-label trigger has a residual near one, because the content says one class and the label says another.
Each step's mean residual for $f$ is then standardized against the cross-sectional distribution of residuals over all active features at that time. Concept drift that makes the reference model stale inflates residuals for many features together, and this common-mode shift is subtracted out. A trigger stays an idiosyncratic outlier.
Finally, standardized scores are accumulated with a one-sided cumulative-sum test, a running sum that resets at zero and alarms when it crosses a threshold $h$:
$$S_{f,t} = \max\big(0,\; S_{f,t-1} + \tilde r_{f,t} - \kappa\big).$$
Here $\tilde r_{f,t}$ is the standardized mean residual of $f$ at step $t$ and $\kappa$ is a slack that absorbs benign excess. This choice follows the logic of sequential testing used for gradual drift in Sequential Covariate Shift Detection Using Classifier Two-Sample Tests: weak evidence spread over many steps should add up rather than be judged one window at a time.
How the Directions Fit Together
Backdoors are the threat. Concept drift is the operating regime that breaks existing defenses. Spurious-correlation research supplies both the diagnosis and the core statistical idea. On the diagnosis side, Spurious Correlations in Concept Drift: Can Explanatory Interaction Help? shows that shortcut features both mask real drift and raise false drift alarms. That paper is our motivation for not trusting raw association changes in a stream. Its remedy, though, asks a human to inspect SHAP plots and was tested only on shallow learners; we remove the human.
The central idea comes from stable learning. Stable Prediction across Unknown Environments and Stable Learning via Sample Reweighting treat a feature as suspect when its link to the outcome does not survive conditioning on the other covariates. They act on that by reweighting a static training set. We use the same conditional view as a detection statistic computed online, not as a training objective.
Extracting Rare Dependence Patterns via Adaptive Sample Reweighting shows that global dependence measures average away dependencies confined to a small subpopulation. A trigger injected during one window of a stream is such a localized dependence, which is another reason to accumulate evidence per feature over time rather than pool the whole history.
Two adaptation-time defenses are relevant but solve a different problem. Protecting Model Adaptation from Trojans in the Unlabeled Data (DiffAdapt) observes that poisoned inputs are "over-determined": they carry both real content and a trigger. It filters them through output variance under input noise, but only after training a risky model on a static batch. Our residual uses the same over-determination intuition without a multi-stage retraining loop. Test-Time Poisoning Attacks Against Test-Time Adaptation Models is a cautionary constraint: ten crafted samples in a 1,000-sample stream drop an adapting model from 76.20% to 41.83%. Any component that updates on stream data, including our reference model, must therefore be shielded from what it scores.
Research Program
Detector. The detector runs on CPU. It has three parts:
- Feature extraction reuses Z-defence's lexical n-grams and constituency ancestor paths, so the feature space is identical to the strongest baseline.
- The reference model is a hashed n-gram logistic regression updated online with exponentially discounted gradients, but only on examples the detector has accepted.
- Masking $f$ at scoring time removes $f$'s own learned weight. A trigger therefore cannot vouch for itself, even if some poisoned examples leaked into the reference model's training.
Streams. Because the file contains no timestamped text corpus, we build controlled drifting streams from SST-2, OLID, AG News and QNLI, in the style of the c-stagger and c-electricity constructions in Spurious Correlations in Concept Drift. Each stream combines four ingredients:
- Class priors drift gradually and abruptly.
- A topical vocabulary is resampled so benign tokens surge and fade.
- A benign injected token carries a label correlation that drifts over time, to mimic a natural shortcut.
- At scheduled points, a genuine concept change relabels a subtopic.
Poisoning is layered on top with BadNet-style token triggers, sentence-insertion triggers and syntactic triggers. We vary poison rate from 0.25% to 5% and use three schedules: burst, uniform-slow, and drift-timed. In the drift-timed schedule the attacker injects during a concept change to hide among benign residual spikes.
Downstream evaluation. A transformer classifier is fine-tuned periodically on whatever each filter accepts. We report attack success rate and clean accuracy over time. We also run c-stagger with a discrete trigger attribute as a tabular sanity check, since its features are already categorical.
Baselines
The naive reference point is continual fine-tuning with no filtering. It fixes the attack success rate we must reduce and the clean accuracy we must preserve.
The strongest existing method is Z-defence as published (Mitigating Backdoor Poisoning Attacks through the Lens of Spurious Correlation), run in two streaming forms:
- Fit once on an initial warm-up segment with the published $z \ge 18$ threshold.
- Recompute over a sliding window, with both window length and threshold tuned on a held-out validation stream.
The reported offline figure to remember is 0.0% false acceptance on SST-2 under BadNet. We found no reported result on Lacuna for Z-defence on drifting or streaming data, so the streaming numbers will come from our own runs. All filters see the same feature space, the same streams, the same downstream trainer and the same tuning budget of validation-stream sweeps. The validation stream uses different seeds and drift schedules from the test streams.
As a model-based competitor we adapt DiffAdapt's noise-variance weighting (Protecting Model Adaptation from Trojans in the Unlabeled Data) to run on each retraining batch, and we report its compute cost alongside its accuracy.
Three ablations isolate the ingredients:
- Replacing the content-conditional residual with the marginal label rate tests whether conditioning is what removes false rejections of surging benign words.
- Removing cross-feature standardization tests robustness to common-mode concept drift.
- Replacing the cumulative sum with a single-window test tests detection of slow poisoning.
Beating the baselines means two things. First, at a false acceptance rate matched to the best tuned sliding-window Z-defence, we need a clearly lower false rejection rate on benign drift-surge features. Second, under the slow and drift-timed schedules, we need downstream attack success near the no-poison level while sliding-window Z-defence stays high.
Why not just…?
Why not just rerun Z-defence on a sliding window? This is the real threat, and the experiments are designed around it. A short window has too few trigger occurrences at low poison rates to reach a high z-score. A long window mixes drift regimes, so benign surges inflate scores. Tuning the threshold trades one failure for the other. If a well-tuned window matches our detector across poison rates and drift schedules, the content-conditional residual adds nothing, and the marginal-rate ablation will show that directly. We expect the gap to be largest on the drift-timed and uniform-slow schedules. If it is not, we will say so.
Why not just pause learning when an unsupervised drift detector fires? Detectors such as Fast Unsupervised Online Drift Detection Using Incremental Kolmogorov-Smirnov Test test one-dimensional input marginals. A trigger inserted into a small fraction of examples barely moves any marginal. Meanwhile, pausing during benign drift stops the model from tracking real concept change. We include a pause-on-alarm baseline to measure both costs.
Why not just use a model-based defense such as DiffAdapt or TTBD? Test-Time Adaptation for Backdoor Defense reports cutting attack success on CIFAR-10 from 88.18% to 2.32%. However, it repairs a static model with Shapley estimates that are expensive per batch, and DiffAdapt needs a risky model retrained each round. These methods may well match our detection accuracy. Our claim is accuracy at a small fraction of their cost, without GPU passes over the stream, so we report detection quality against wall-clock time.
Why not just reweight the stream for invariance, as in StableNet? Decorrelation by reweighting, as in Deep Stable Learning for Out-of-Distribution Generalization, down-weights shortcuts but does not remove near-deterministic triggers. Its global cross-covariance caching is also costly online. We test a reweighting-only variant to check whether it reduces attack success at all.
Decisive Checks and Limits
Three outcomes would settle the proposal:
- Benign surges. False rejection rate on benign surging tokens, at matched false acceptance rate, against tuned sliding-window Z-defence.
- Slow poisoning. Detection delay and final attack success under 0.25% to 1% uniform-slow poisoning.
- Camouflaged poisoning. Robustness when injection coincides with concept change, the attack the cross-feature standardization is meant to handle.
We also run an adaptive attacker who pairs the trigger with content that agrees with the target label (clean-label poisoning). In that case the residual is small by construction. We expect our detector to degrade there and will report it as the method's boundary, not hide it.
References
- Mitigating Backdoor Poisoning Attacks through the Lens of Spurious Correlation
- Sequential Covariate Shift Detection Using Classifier Two-Sample Tests
- Spurious Correlations in Concept Drift: Can Explanatory Interaction Help?
- Stable Prediction across Unknown Environments
- Stable Learning via Sample Reweighting
- Extracting Rare Dependence Patterns via Adaptive Sample Reweighting
- Protecting Model Adaptation from Trojans in the Unlabeled Data
- Test-Time Poisoning Attacks Against Test-Time Adaptation Models
- Fast Unsupervised Online Drift Detection Using Incremental Kolmogorov-Smirnov Test
- Backdoor Defense via Test-Time Detecting and Repairing
- Deep Stable Learning for Out-of-Distribution Generalization