Label-Free Stacking of Reconstruction Residuals for Anomaly Attribution

When a tabular anomaly detector flags a record, such as a patient chart, a sensor reading or a transaction, the next question is which fields are wrong. Today the answer depends on which detector and which explanation method you happen to use. Different explanation algorithms applied to the same model routinely contradict each other. Different detectors trained on the same data have different blind spots. In particular, flexible reconstruction models can learn to copy the anomaly through unchanged, so their error on the broken field shrinks to zero.

We propose a direct alternative to choosing one detector and one explainer and hoping. First, train several detectors with different internal assumptions. Each one is a "reconstruction model": it learns only from normal data to rebuild an input, so fields it rebuilds poorly are suspicious. Ask each detector to rebuild every field from the other fields only. Then train a small second-stage model to combine these per-field errors into a probability that each field is corrupted. This is "stacking": a model that learns how much to trust each first-stage model, and where.

Stacking normally needs labels, and anomaly detection has none. We obtain labels by deliberately corrupting held-out normal records, which tells us exactly which fields were changed. The resulting system outputs a detection score and a per-field attribution from one trained object, rather than reconciling disagreeing explainers after the fact.

Core Claim

Stacked generalization can be made label-free and feature-level for reconstruction-based anomaly detection by using synthetic corruptions of out-of-fold normal data as per-feature targets. The combiner it learns should beat unweighted averaging of residuals in two settings: anomalies that break dependencies between fields, and data where some base detectors fall into the copying shortcut. The disagreement among base detectors is an input to the combiner, not noise to be discarded. If unweighted consensus matches the learned combiner, that is a clean negative result about where stacking pays off, and the experiments are designed to deliver it.

Where This Sits

Supplying the method. Three lines of work supply pieces of the method.

  • DRÆM feeds an image and its reconstruction to a discriminative network trained on synthetic Perlin-noise defects. This is the closest single-model ancestor. We generalize it to many heterogeneous reconstructors, to tabular fields, and to proper out-of-fold training, and we output per-feature attributions rather than pixel maps.
  • Anomaly Shapley (ASH) defines a missing feature as the value that minimizes the anomaly score given the others. It shows that fixed-baseline Shapley values create artificial outliers. Our masked, leave-one-field-out reconstruction is the same intuition ("what would normal look like here, given the rest?"), computed by generative imputation at the same O(d) cost as ASH's relaxation. It avoids the local-optimum failures ASH reports on deep models like DAGMM.
  • The out-of-fold protocol is standard stacking practice, as in Mapping child growth failure in Africa.

Motivating the work. Several papers supply evidence for the gap.

  • Idé et al. and Likelihood Compensation show that gradient-based explainers and LIME are blind to the size of the deviation. They return the same explanation whether the error is zero or huge. This argues against explaining reconstruction detectors with gradients at all.
  • The disagreement literature shows that explainer conflict comes from differing objectives and baselines rather than bugs. Han et al.'s no-free-lunch result and Wright and Koenen's baseline analysis both make this case. The implication is that post-hoc reconciliation on top of a black-box score cannot settle which explainer is right.
  • Vascotto et al. build consensus across three gradient explainers on one supervised network. GRANITE treats disagreement as a signal of feature interaction. Neither touches unsupervised reconstruction.
  • Neither does supervised explainable stacking, such as Lu and Uddin, which pairs a single-model feature selector with LIME.

Borrowed logic. The consensus feature selection literature contributes a principle and a known failure. The principle is that agreement across different inductive biases filters out method-specific artifacts, as in the LASSO, SVM-RFE and random forest intersection of Wang et al. and the 2-of-3 voting of Chen et al.. The failure is that the voting threshold is hand-picked. Our combiner effectively learns a soft, per-field voting threshold from data instead of fixing intersection or majority in advance.

Constraining the design. Two results limit what we can safely build.

  • ADBench reports a median −16.43% drop for unsupervised detectors when anomalies are duplicated six times in the training data. Any method trained on "normal" data must therefore be tested under contamination.
  • Ensembling Tabular Foundation Models warns of a diversity ceiling and a calibration trap when ensembling similar models. This is why base-model heterogeneity and per-field residual standardization are part of the design, not afterthoughts.

Research Program

Base level. The base level holds $M$ reconstructors chosen for distinct inductive biases:

  • a closed-form Gaussian conditional imputer;
  • a k-nearest-neighbour imputer over normal training rows, a retrieval analogue of CORE's in-context reconstruction;
  • a masked-autoencoder MLP;
  • a variational autoencoder;
  • a tabular denoising-diffusion imputer.

For record $\mathbf{x}$ and field $j$, each model $m$ predicts $\widehat{x}^{m}_j$ from $\mathbf{x}_{-j}$ (all other fields). It reports a standardized masked residual

$$z^{m}_j(\mathbf{x}) = \frac{\ell\big(x_j, \widehat{x}^{m}_j(\mathbf{x}_{-j})\big) - \mu^{m}_j}{\sigma^{m}_j},$$

where $\ell$ is squared error for continuous fields and negative log-probability for categorical ones. $\mu^{m}_j$ and $\sigma^{m}_j$ are the mean and standard deviation of that loss on clean validation rows. Masking field $j$ removes the copying shortcut by construction, since the model cannot see the value it must predict. Standardization puts heterogeneous fields and models on one scale.

Meta level. The combiner $g$ is a small gradient-boosted model shared across fields of a dataset. For field $j$ it sees:

  • the vector $(z^{1}_j,\dots,z^{M}_j)$;
  • the spread of that vector, which measures how much the base models disagree;
  • the unmasked residuals, which reveal which models copy;
  • coarse row-level context, namely the top masked residuals elsewhere in the row.

It outputs $p_j(\mathbf{x})$, the probability that field $j$ is corrupted. The row anomaly score is a learned pooling of the $p_j$.

Training targets. We split the normal training data into $k$ folds. On each fold:

  1. Fit the base models on the other $k-1$ folds.
  2. Corrupt the held-out rows using a library of corruption families: marginal outliers, swaps of a field value from another row (which keep the marginal intact but break dependencies), small multi-field shifts, and categorical flips.
  3. Record the binary mask of which fields were touched.

The out-of-fold residuals and masks train $g$ with per-field cross-entropy. The base models are then refit on all data. This is the step that makes stacking label-free. It is also the main risk, because $g$ may learn the corruption library rather than anomalies. The evaluation is built around exposing that.

Disagreement analysis. Before and after stacking, we measure how much standard explainers disagree on the same anomalies. The explainers are KernelSHAP on each detector's score, Integrated Gradients on the autoencoder, ASH, and the raw residual of each model. Agreement is measured by top-k overlap and Spearman correlation. We then relate that disagreement to attribution accuracy against the known corrupted fields. This tests whether high cross-explainer disagreement predicts attribution errors, as GRANITE's view of disagreement-as-signal would suggest. If it does, it justifies feeding disagreement to $g$.

Baselines

Do-nothing reference. The single best base reconstructor, chosen on validation, attributes by its own standardized masked residual and scores rows by their sum. This is what a practitioner would deploy today. Beating it shows the ensemble is worth its cost.

Unweighted consensus. We average the standardized masked residuals across the $M$ models. We also run a majority vote on per-model top-k fields, which mirrors the voting schemes of Chen et al. and Osanaiye. This is the strongest competitor on our specific question, because unsupervised ensembles are notoriously hard to beat with learned weights. It uses exactly the same base models and residuals, so the only difference is the learned combiner. "Beating it" means a statistically significant gain in attribution mean reciprocal rank and detection AUROC across datasets, using paired tests over datasets and seeds. The gain must hold on corruption families held out of meta-training, not just on the families $g$ saw.

Strongest published attribution method. ASH is run on the GMM and VAE base models with the authors' regularization. It reports a mean reciprocal rank (MRR) of 0.8–0.9 for identifying synthetically corrupted features across six public benchmarks (Takeishi and Kawahara). We rerun it on those same six benchmarks with the same corruption protocol, so the number is reproduced rather than borrowed. Beating it means higher MRR on the same benchmarks, especially on dependency-breaking corruptions where single-detector attribution should struggle. KernelSHAP on the averaged ensemble score serves as the generic post-hoc reference, with the same sampling budget per instance as ASH.

Strongest published detector. For detection, CORE reports the highest average AUROC, 0.8488, across its 34-dataset unified tabular benchmark (CORE). We evaluate on the subset of those datasets we can obtain under its protocol, and we include CORE-style retrieval reconstruction as a base model. We do not expect to beat a cross-dataset pretrained model on its home benchmark with per-dataset training. Matching it while adding calibrated per-field attribution would already be useful. For contamination robustness we use ADBench's duplication protocol, with the −16.43% median drop as the reference degradation (ADBench).

Fairness controls. Every method sees the same normal training rows and the same evaluation anomalies. Each gets the same hyperparameter search budget, with trials counted per method. Total compute is reported, including the extra cost of the $k$ out-of-fold refits for our method.

Ablations. Four ablations isolate the key ingredients:

  • One base model: stacking over a single reconstructor, which is essentially DRÆM's design moved to tabular data.
  • Unmasked residuals: tests whether masking is what defeats the copying shortcut.
  • No disagreement inputs: removes the spread and copy-detection features from $g$.
  • In-fold training: trains $g$ on residuals from base models that have seen those rows, which should reproduce the known stacking leakage failure.

Why not just…?

Why not just average the residuals across models? This is the real threat, and the proposal is built to measure it. On isolated marginal outliers we expect averaging to be nearly as good. Every base model sees the bad value, so a learned weighting has little to add. Our claim of an advantage is confined to two settings. In dependency-breaking corruptions, a value is plausible on its own but inconsistent with its partners, and models that capture correlations disagree sharply with models that do not. In mixed field types, residual scales and model reliability vary by field. If held-out-family results show averaging within noise of $g$ in those settings too, we report that stacking adds nothing over consensus. The surviving contributions are then the masked-residual base level and the disagreement study.

Why not just run ASH or SHAP on one good detector? Shapley-style attribution on a single score inherits that detector's blind spots. Its answer also depends on baseline choice, as Wright and Koenen showed. ASH's own authors report degraded quality on nonlinear detectors such as DAGMM because of local optima. Gradient explainers are blind to deviation size outright (Idé et al.). The head-to-head on ASH's six benchmarks, broken down by corruption family and by base-model nonlinearity, settles whether this matters in practice.

Why not just use a single strong detector like CORE, or DRÆM's discriminator, and read off its residual? A single reconstructor that generalizes too well copies anomalies, and its residual on the broken field collapses. This is the copying shortcut documented in the reconstruction literature, and Xing et al. needed retrieved normal anchors to mitigate it in images. The single-base-model stacking ablation is exactly this alternative. If it matches the full system, heterogeneity is unnecessary and we say so.

Why not just train on real labeled anomalies with a supervised stacker? Where some labels exist, ADBench shows semi-supervised methods with 1% labeled anomalies reach a median AUCROC of 75.56%, versus 60.84% for fully supervised ones (ADBench). Even so, labels almost never say which field was wrong. Our corruption targets supply that per-field supervision. We add a variant that mixes a handful of real labeled anomalies into meta-training to test whether they complement synthetic targets.

Proposed Experiments

Primary testbed. The primary testbed is ADBench's tabular datasets (ADBench), using its four generated anomaly types (local, global, dependency, clustered) and its corruption settings, together with Takeishi and Kawahara's six attribution benchmarks. Ground-truth corrupted fields are known in both.

Generalization protocol. The decisive protocol is leave-one-family-out. The combiner $g$ is meta-trained on all corruption families but one and evaluated on the held-out family and on ADBench's independently generated anomaly types. This guards against $g$ merely memorizing our corruption library.

Metrics. We report:

  • detection AUROC and average precision;
  • attribution MRR and per-field average precision for multi-field anomalies;
  • expected calibration error of $p_j$, given the calibration trap documented for tabular ensembles;
  • cross-explainer agreement (top-k overlap and Spearman correlation) before and after stacking.

Decisive checks. Five results would settle the claim:

  1. $g$ beats unweighted consensus on dependency-type and held-out-family anomalies. If it does not, the stacking claim fails.
  2. Unmasked residuals lose sharply on high-capacity base models, confirming that masking is what removes the copying shortcut.
  3. Cross-explainer disagreement on a test instance predicts attribution error. If so, it justifies treating disagreement as signal rather than noise.
  4. Under ADBench's sixfold anomaly duplication, the stacked system degrades less than the −16.43% median reference. The mechanism would be that a contaminated base model is down-weighted when its residuals diverge from the others.
  5. As a single real-ground-truth sanity check outside tabular data, we transplant the combiner to pixel-level stacking on MVTec AD over a structural-similarity autoencoder, a diffusion reconstructor and DRÆM's reconstruction branch, against DRÆM's reported pixel average precision of 68.4. Its manually annotated defect masks provide true localization labels rather than synthetic ones. RealNet's 99.0 pixel AUROC is reported for context only, since its pretrained feature selection is a different regime.