A backdoored classifier is one that behaves normally until an input carries a secret pattern, the trigger, planted by whoever poisoned its training data. When the trigger is present, the model jumps to the attacker's chosen class. We propose detecting this by asking a question that recourse tools already know how to answer: what are all the different ways this input could be changed to get a different decision? A counterfactual explanation is the smallest edit to an input that flips a model's prediction. A diverse set of counterfactuals is several such edits, each pushed to differ from the others. For an ordinary input, a diverse set spreads across many features, because a well-trained model usually has many independent reasons for a decision. For a triggered input, the attacker's pattern overrides everything else. So every valid way out of the target class has to undo the trigger, and the diverse set keeps collapsing back onto the same few features however hard the generator is pushed apart. That forced convergence is a signal of necessity, which a single counterfactual cannot provide. One explanation only shows that changing a feature is enough; many mutually diverse explanations show that changing it cannot be avoided.
The setting where this matters most is the one current defenses handle worst: binary tabular models such as credit, income, and marketing classifiers. These are the models that recourse research targets. A careful stress test showed that Neural Cleanse's anomaly index is fixed at exactly 0.67 for any two-class problem, below its 2.0 detection threshold, so it cannot flag binary backdoors at all (Toward a Critical Evaluation of Robustness for Deep Learning Backdoor Countermeasures). Separately, the CatBack tabular attack evades Neural Cleanse, Fine-Pruning, and outlier filters, and Spectral Signatures misses its poisoned samples in over 75% of cases (CatBack). Fast diverse-counterfactual generators now run in a fraction of a second per query (DiCoFlex; Promoting Counterfactual Robustness through Diversity). That makes a black-box, per-query check of this kind practical.
Core Claim
On a backdoored binary tabular model, the features changed by a diverse counterfactual set for a triggered input concentrate on the trigger features far beyond what is seen for clean inputs of the same predicted class. A detector built on this concentration should catch multi-feature, sparse triggers such as CatBack's in cases where three simpler checks miss them: removing one feature at a time, a single counterfactual, and noise-based flip tests. The diversity is the active ingredient. If a single counterfactual, or a cheap feature-mixing test, does as well, the claim is false. The experiments are designed to show this either way.
Relation to Prior Work
Several papers motivate the idea. Caccia et al. describe a "triviality trap": a single explanation tends to lock onto the most dominant shortcut. Backdoor work shows that triggers are exactly such shortcuts, producing low prediction entropy under blending (STRIP) and "contextual blindness" in LLM self-explanations (When Backdoors Speak). We turn the trap into a test. Instead of treating convergence onto one feature as a flaw of the explainer, we measure whether convergence persists when the explainer is explicitly forced to diversify.
The explanation-based detectors closest to this proposal all rely on one explanation per input. XGBD extracts one dominant subgraph per graph with SubgraphX or GNNExplainer and checks whether it alone drives the prediction. TrinityAI needs white-box access to penultimate-layer neurons, and uses "counterfactual" only in the sense of attributing to classes the model did not choose. When Backdoors Speak reads a single greedy text justification. BBCaL does use the word counterfactual, but its interventions are isotropic Gaussian noise of increasing size. It records the noise level at which the label flips, so it measures how strongly a label resists noise, not which features are required to change it. Our method differs from all four: it is black-box, works on tabular inputs, and its score comes from the agreement structure of a set of explanations, not from any one of them.
The Effect of Data Poisoning on Counterfactual Explanations is the nearest paper that combines recourse and poisoning. It poisons training data to inflate recourse cost (up to 39% locally on Diabetes) with no trigger, and its sanitizers reach under 20–30% recall. It warns that the counterfactual machinery itself can be manipulated. We take this as a constraint: our evaluation includes an attacker who knows the detector.
Two papers supply the method. DiCoFlex supplies a conditional normalizing flow, a generative model that maps counterfactuals to a simple Gaussian so that new ones can be sampled quickly. It is trained on nearest neighbours from the target class and supports run-time masks that freeze chosen features without retraining. DiCE supplies optimization with an explicit diversity penalty. Leofante and Potyka supply a fast candidate-filter-refine generator and the observation that robustness is a property of sets rather than points.
Research Program
Let $x$ be a query the model assigns to the class $t$ we wish to audit. In practice this is either class, since the defender does not know the attacker's target. A diversity-enforcing generator returns a valid portfolio $C(x)=\{c_1,\dots,c_K\}$ of counterfactuals that leave $t$. We define the necessity of feature $j$ as the fraction of the portfolio that changes it:
$$n_j(x) = \frac{1}{K}\sum_{k=1}^{K} \mathbf{1}[c_{k,j} \neq x_j].$$
Some features are naturally necessary for clean inputs; income in a credit model is an example. The score therefore compares against a small held-out clean set of inputs predicted as $t$. On that set we estimate each feature's mean necessity $\mu_j$ and spread $\sigma_j$. The detection score is the largest standardized excess:
$$s(x) = \max_j \frac{n_j(x)-\mu_j}{\sigma_j}.$$
This uses the same small clean reference set that STRIP assumes.
The score is backed by a direct masking test, which a plain portfolio cannot run. Take the top-scoring feature group $S$ and freeze it with DiCoFlex's actionability mask. Then measure how often valid counterfactuals can still be found. For a clean input, alternatives remain. For a triggered input, validity should collapse, because every exit runs through $S$.
At the model level, we aggregate over many inputs. A feature group that is anomalously necessary for a minority of inputs, and whose masking test fails for that same minority, is reported as a candidate trigger. The detector outputs both a flag and the trigger itself, which supports cleanup and makes the result easier to audit than a bare anomaly score.
The work has three parts. First, we build the detector on two generators, DiCoFlex for speed and DiCE for a gradient-free optimization check, and vary the portfolio size $K$ and the diversity weight. Second, we characterize where the signal fails. Candidate failure modes are partial backdoors that fire only for one source subgroup, triggers spread redundantly over many features, and clean models with a genuinely dominant feature. Third, we attack our own detector. An adaptive attacker trains the backdoor so that it can be undone through any of several disjoint feature routes, with the goal of spreading the portfolio. We then measure what this costs the attacker in attack success rate and in the stealth that CatBack obtains from sparse perturbations.
Baselines
The naive reference point is no defense, scored as chance detection with the backdoor's full attack success rate. Next to it we run Isolation Forest on inputs, the outlier filter that Artelt et al. found catches under 20–30% of recourse poisoning and that CatBack reports evading.
Neural Cleanse is included as an offline reference. On binary tasks its index is proven fixed at 0.67, so we expect it to fail. Including it shows that the failure we exploit is real in our own pipeline. Spectral Signatures is the strongest training-data inspection baseline in the file; CatBack reports it failing in over 75% of cases.
The strongest input-level competitor is STRIP adapted to tables. Pixel blending has no tabular analogue, so each query is mixed feature-wise with random clean rows: each feature is swapped with probability one half, $N$ times, and we compute prediction entropy. A trigger that dominates should keep entropy low. STRIP reports 0% FAR and FRR in most CIFAR-10 and GTSRB cases. No reported result was found on Lacuna for STRIP on tabular data, so its tabular performance is an open empirical question, and potentially a serious threat. The second strong competitor is BBCaL's flip-position score with Gaussian noise on continuous features and random resampling on categorical ones; BBCaL reports average AUC over 84% on images. These are the baselines most likely to match us, because they are black-box, cheap, and target trigger dominance directly.
Two ablations isolate the key ingredient. The first is the same pipeline with $K=1$, a single closest counterfactual. The second is exhaustive leave-one-feature-out and leave-pair-out ablation, which resets features to clean reference values and records label flips.
Fairness rules apply to every method. All methods get the same clean reference set, the same per-query query budget to the model (matched to the number of model calls the portfolio generator spends), and the same threshold-tuning protocol on held-out clean data. Beating the field means a higher FRR at 1% FAR and a higher AUROC than tabular STRIP, BBCaL, and the $K=1$ ablation against CatBack. For our claim to stand, that advantage must not vanish once the competitors are given the same query budget.
Why not just…?
Why not just use a single counterfactual and check whether it touches the trigger? A single counterfactual answers "what is enough to flip the decision," and the cheapest sufficient edit need not be the trigger. A sparse CatBack trigger spread over several categorical fields may be costlier to undo than some unrelated continuous feature that also happens to flip the label. Leofante and Potyka also show that single counterfactuals jump around discontinuously near the boundary, which makes a per-feature statistic noisy. The $K=1$ ablation tests this directly. If it matches the portfolio, the diversity claim fails and we will report that.
Why not just remove features one at a time? This works for single-feature triggers and will be included. Its weakness is the multi-feature trigger. If the backdoor fires on a combination, or survives when any one of its components is removed, single-feature ablation sees nothing. Exhaustive subset ablation grows combinatorially with the number of features. The diverse portfolio searches over subsets cheaply, steered by the model. We test this by varying trigger width from one to several features. The prediction is that leave-one-out degrades as width grows while the portfolio score does not.
Why not just run STRIP-style mixing on tables? This is the most serious threat. If trigger features dominate, random feature mixing that happens to keep them will keep the target label, and entropy will drop. Our claimed advantages are three. STRIP's own authors flag partial, source-specific backdoors as open. Mixing destroys the source-class context that partial backdoors need, while counterfactuals preserve the input. And our method returns the trigger features, not just a flag. If tabular STRIP matches us on global triggers, we will narrow our claim to partial and subgroup-conditioned triggers and to trigger recovery, and test those separately.
Proposed Experiments
The datasets are the tabular benchmarks used by both CatBack and DiCoFlex, namely Adult Census Income and Bank Marketing, plus the financial sets from the file (Default, Lending Club, Give Me Some Credit). German Credit and Diabetes are added to connect with the recourse-poisoning results of Artelt et al.. Models are MLPs and gradient-boosted trees trained clean or with CatBack, BadNets-style tabular triggers, and Tabdoor, over several poisoning rates and seeds. We report attack success and clean accuracy first, to confirm that each backdoor is real. Detection is measured by AUROC and by FRR at a 1% FAR, the operating point STRIP uses. Trigger recovery is measured by the overlap between the recovered feature group and the true trigger. Latency is reported per query.
The first decisive check compares portfolio size: $K=1$ against $K\in\{5,10,20\}$ against CatBack. The second sweeps trigger width, comparing leave-one-out with the portfolio score. The third uses partial backdoors that fire only within one demographic subgroup, comparing tabular STRIP with our score. The fourth is the masking test on clean models that have a naturally dominant feature, to measure false alarms. The last is the adaptive attacker with redundant trigger routes. Here we report the attacker's frontier: attack success and stealth on one axis, the attacker's ability to drive our detection AUROC toward chance on the other. A detector that only forces the attacker to give up sparsity, and with it the outlier-evasion that sparsity buys, is still useful. A detector the attacker can bypass at no cost is not.
References
- Toward a Critical Evaluation of Robustness for Deep Learning Backdoor Countermeasures
- CatBack: Universal Backdoor Attacks on Tabular Data via Categorical Encoding
- DiCoFlex: Model-Agnostic Diverse Counterfactuals with Flexible Control
- Promoting Counterfactual Robustness through Diversity
- Beyond Trivial Counterfactual Explanations with Diverse Valuable Explanations
- STRIP: a defence against trojan attacks on deep neural networks
- When Backdoors Speak: Understanding LLM Backdoor Attacks Through Model-Generated Explanations
- XGBD: Explanation-Guided Graph Backdoor Detection
- Detecting Trojaned DNNs Using Counterfactual Attributions
- BBCaL: Black-box Backdoor Detection under the Causality Lens
- The effect of data poisoning on counterfactual explanations
- Explaining machine learning classifiers through diverse counterfactual explanations