An Evidence-Based Post-Hoc Adjustment Framework for Anomaly Detection Under Data Contamination

Sukanya Patra, Souhaib Ben Taieb

TL;DR

EPHAD is a new, "plug-and-play" framework designed to fix anomaly detection (AD) models trained on "dirty" or contaminated data. Instead of relying on expensive retraining, it performs a post-hoc adjustment at test-time. By combining the biased model’s predictions with fresh "evidence" from foundation models (like CLIP) or classical algorithms, EPHAD significantly boosts accuracy without needing access to the original training pipeline.

The Challenge of Contaminated Data

Most unsupervised anomaly detection algorithms operate on a strict "clean-data assumption": they assume the training set contains only "normal" examples. In real-world scenarios, however, this is rarely true. Datasets are frequently contaminated with undetected defects or mislabeled outliers.

When a model is trained on contaminated data, it inadvertently learns to treat those anomalies as "normal." This leads to a biased decision boundary and significantly degraded performance. Existing solutions usually require retraining the model from scratch, knowing the exact percentage of contamination beforehand, or having access to the proprietary training code. None of these are practical for engineers deploying pre-trained or third-party models. The authors tackle the challenge of adapting these biased models at test-time, without retraining and without prior knowledge of the contamination level.

Introducing EPHAD

The authors introduce EPHAD (Evidence-based Post-Hoc Adjustment Framework). Its core mechanism relies on exponential tilting, a mathematical approach to "nudge" the output of a pre-trained model using a secondary source of information called an "evidence function."

Visual comparison of decision boundaries on a synthetic dataset.
  1. The Prior: The process begins with a pre-trained AD model that is likely biased due to contaminated training data.
  2. The Evidence: At test-time, "evidence" is gathered for each sample. For images, this might come from a multimodal foundation model like CLIP. For tabular data, it might be a classical algorithm like Local Outlier Factor (LOF).
  3. The Adjustment: EPHAD combines these two signals. If the evidence suggests a sample is highly likely to be normal, it upweights the model's "normality" score for that sample, effectively correcting the biased decision boundary.
  4. Adaptive Tuning (EPHAD-Ada): The framework uses a temperature hyperparameter ($\beta$) to balance the model versus the evidence. To make this hands-off, the authors developed an adaptive version that uses Entropy Minimization to automatically determine the optimal balance based on how confident the model and evidence are on the test data.

Datasets and Validation

The researchers validated EPHAD across a massive range of scenarios:

  • Visual AD: 8 datasets including MVTecAD, MPDD, ViSA, and RealIAD (for industrial "sensory" anomalies like scratches) as well as CIFAR-10, MNIST, and SVHN (for "semantic" anomalies like a cat in a dataset of dogs).
  • Tabular AD: 26 datasets from the ADBench benchmark, covering domains like healthcare, finance, and physics.
  • Real-World Industrial: A specialized dataset from a Concentrated Solar Power (CSP) plant, using thermal images of solar panels.

Key Insights

  • Foundation Models as "Evidence," not "Detectors": A key insight is that foundation models like CLIP don't have to be perfect anomaly detectors on their own. In many domain-specific tasks (like finding a tiny crack in a metal pipe), CLIP performs poorly. However, EPHAD uses CLIP as a supplementary signal that helps "un-bias" the primary model.
  • Model-Agnostic Flexibility: EPHAD is agnostic to how the original model was built (e.g., DeepSVDD, PatchCore). It only requires the final anomaly scores, making it incredibly easy to wrap around existing production systems.
  • The Power of Post-Hoc: The paper proves that you don't always need to fix the training to fix the model. By treating the contaminated model as a "prior" and the test-time observations as "likelihood," AD is framed as a Bayesian-style update.

Key Results

Across almost all datasets, EPHAD consistently improved the AUROC (Area Under the Receiver Operating Characteristic).

Performance comparison across visual anomaly detection datasets.
  • Consistent Gains: As seen in the results, adding EPHAD to standard models yields broad improvements. For example, on the ViSA dataset with 10% contamination, adding EPHAD to the ULSAD model boosted performance from 86.58% to 87.23%.
  • Robustness to "Dirty" Data: In ablation studies, the authors showed that while standard models' performance nose-dives as contamination increases from 5% to 15%, EPHAD's performance remains remarkably stable.
  • Industrial Success: In the CSP plant use case, the baseline model's performance dropped by 5% due to contamination. EPHAD, using simple domain-specific rules as evidence, recovered nearly all of that lost accuracy, matching the performance of a model trained on perfectly clean data.

Limitations and Future Work

While powerful, EPHAD is only as good as its evidence. If the evidence function is significantly worse than the biased model, it can degrade performance. Choosing the right evidence source for the right domain remains a manual task. Furthermore, the adaptive $\beta$ (EPHAD-Ada) relies on "inlier probabilities." If the anomaly scores are poorly calibrated, the adaptive tuning might pick a sub-optimal balance.

Future directions include exploring more sophisticated ways to infer the balance between model and evidence by looking deeper into the underlying distribution of the test samples. The authors also highlight the potential for adding "explainability" to the framework so users can see exactly why a specific adjustment was made.

Summary updated

BibTeX
@inproceedings{patra2025evidence,
  author = {Sukanya Patra and Souhaib Ben Taieb},
  title = {{An Evidence-Based Post-Hoc Adjustment Framework for Anomaly Detection Under Data Contamination}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=NgLFQTBPRR},
}
Figure