Skip to content
AI.info

Research

DART: Domain-Agnostic Residual Transfer for Generalist Anomaly Detection

Overview Research area: Computer Vision — specifically visual anomaly detection, with a focus on Generalist Anomaly Detection (GAD), the setting where one model is trained on source domains and deploy

arXiv
2611.08271
Published
2026-11-05
Authors
Muhammad Aqeel, Maham Nazir, Marco Cristani, Francesco Setti

AI summary

Overview

Research area: Computer Vision — specifically visual anomaly detection, with a focus on Generalist Anomaly Detection (GAD), the setting where one model is trained on source domains and deployed on unseen target domains without fine-tuning. The work draws on domain adaptation, domain generalization, and representation disentanglement.

Technical level: Advanced. The paper assumes familiarity with residual-based anomaly detection pipelines, adversarial training with gradient reversal layers, transformer encoders, and mutual-information framings of representation learning.

Scope (one sentence): The paper identifies "residual domain entanglement" as a bottleneck in normal-abnormal guided GAD and proposes DART, a plug-in module-plus-training-schedule that separates anomaly-relevant from domain-specific residual components, evaluated on MVTec AD, VisA, and BraTS across three host methods.

What This Paper Is About

Generalist anomaly detection systems flag defects in a query image by comparing it against a few reference images, and recent methods also exploit a handful of abnormal references to transfer cues about what a defect looks like. The problem is that the residual signal driving this transfer mixes genuine, transferable anomaly information with domain-specific appearance factors — texture, object geometry, acquisition conditions — so a crack learned on bottles can produce false alarms on leather or transistors. DART's goal is to split that residual into an anomaly-relevant part and a domain-specific part, so that only the transferable anomaly signal reaches the detector.

Key Contributions

  1. Problem diagnosis. The authors name and characterize residual domain entanglement — the mixing of transferable anomaly cues with domain-specific factors inside normal-abnormal residuals — and argue it is a key bottleneck for cross-domain normal-abnormal guided GAD. A t-SNE visualization (Figure 1) shows baseline residuals fragmenting by domain identity rather than clustering by defect type.

  2. A plug-in disentanglement framework. DART combines a Residual Disentanglement Module (RDM), which decomposes a residual into an anomaly component r_a and a domain component r_d using sufficiency, adversarial-invariance, and reconstruction losses, with Cross-Domain Meta-Training (CDMT), which forms training episodes whose references and queries come from different source domains.

  3. Architecture-agnostic integration. RDM sits between residual computation and the detection head, so the host backbone and prediction head need no redesign. The authors demonstrate this by inserting DART into NAGL, InCTRL, and ResAD — three substantially different architectures (ViT patch-token attention residuals, CLIP-feature in-context residuals, and normalizing-flow distributional deviations on WideResNet features, respectively).

  4. Empirical validation across three benchmarks. Evaluation on MVTec AD, VisA, and BraTS under cross-dataset transfer, with consistent image-level gains and competitive localization.

Main Findings

  • Best image-level AUROC on both industrial benchmarks. NAGL+DART reaches 95.93%, 96.62%, and 97.34% on MVTec AD at N¹, N², and N⁴ respectively, outperforming PromptAD (94.6%, 95.7%, 96.6%) and vanilla NAGL. On VisA it reaches 89.72% at N²+A¹ (+1.82% over vanilla NAGL's 87.90%) and 91.29% at N⁴+A¹ (+0.99%).

  • Gains scale with domain shift. Improvements are larger on VisA (the bigger gap from the MVTec-trained source) than on MVTec AD, and largest on the industrial-to-medical MVTec AD → BraTS transfer. On BraTS, InCTRL+DART gains +13.28% image-level AUROC at N¹ (65.20% → 78.48%) and +7.61% at N⁴ (69.89% → 77.50%).

  • Abnormal access alone is not enough — disentanglement is what helps. Naive abnormal-reference integration (+Inv) is unreliable or harmful: ResAD+Inv loses −3.0 I-AUROC on MVTec AD and −6.5 on VisA at N¹ (PRO down up to −6.0), and InCTRL+Inv swings from +0.42 at N¹ to −1.22 at N⁴. The +Inv → +DART gap widens with domain shift: +6.19 I-AUROC on VisA at N¹ (79.87% vs. 86.06%) growing to +9.85 at N⁴ (80.29% vs. 90.14%).

  • Localization is largely preserved. NAGL+DART matches or improves PRO and pixel-level AUROC in most settings; occasional pixel-level F1-max drops (e.g., −1.16 at N¹ on VisA) are attributed to threshold sensitivity rather than systematic degradation. A byproduct: InCTRL, which originally reported no segmentation metrics, gains spatially meaningful maps under DART (paper reports P-AUROC of 94.52–95.71% on MVTec AD across shot settings).

  • RDM and CDMT are co-dependent. CDMT without RDM is inert (Δ = +0.00 on both datasets), since the frozen backbone leaves nothing to update. RDM without CDMT gives only local disentanglement (+0.48 MVTec AD, +0.21 VisA). Full DART gives +1.15 and +0.68, with the +0.67 and +0.47 margins attributable to CDMT.

  • Sufficiency is the single most critical loss. Removing the sufficiency loss causes the largest degradation (−2.64 I-AUROC); removing the reconstruction loss, adversarial loss, or CDMT individually produces smaller consistent drops (−0.64 to −0.73).

  • Residual space beats feature space. Applying disentanglement in backbone feature space (DART-F) degrades performance (−0.54 vs. vanilla) while DART improves it (+1.15). Silhouette analysis on the same 640-d residuals shows DART-F amplifies domain separation (0.246 → 0.611) whereas DART suppresses it (0.246 → 0.192); relabeled by defect type, the silhouette rises from 0.08 to 0.25 under DART while DART-F stalls at 0.10. The authors describe this as demotion rather than deletion of domain information, and explicitly do not claim perfect invariance.

  • Architecture choices matter for cross-domain transfer. Replacing the transformer encoder with a linear projection drops VisA I-AUROC by −7.35 while leaving MVTec AD nearly unchanged; removing LayerNorm costs −0.75 on MVTec AD and −3.99 on VisA. Adversarial-only and orthogonality-only disentanglement variants both fall below vanilla (up to −1.74 MVTec AD, −2.02 VisA), a +2.89 gap versus the best single-objective baseline.

  • Modest cost. Training adds 3.1–20.1M parameters and approximately 1 GPU-hour per setting on a single RTX4090, incurred once on source domains. At inference only the anomaly encoder is kept (+0.82M for InCTRL, +0.89M for NAGL, +9.06M for ResAD), operating on low-dimensional residuals.

Methodology in Plain English

Start with an existing anomaly detector. Given a query image plus a few normal and abnormal reference images, that detector computes a residual — a map of how the query differs from the references. The paper's premise is that this residual is contaminated: it encodes both "here is the defect" and "this is what bottles/leather/brain MRI look like."

DART inserts a small module right after the residual is computed. Three encoders/decoders work on it:

  • An anomaly encoder (a transformer block with self-attention, chosen because domain appearance is broad and smooth while defects are localized and sparse) produces r_a.
  • A domain encoder (a small two-layer MLP) produces r_d, absorbing whatever is not needed for detection.
  • A reconstruction decoder rebuilds the original residual from the concatenation of the two, so nothing is simply thrown away.

Three training signals shape the split. A sufficiency loss sends only r_a to the host detector's unchanged prediction head and penalizes detection error, so anomaly information cannot be discarded. An adversarial loss attaches a spectrally normalized two-layer domain classifier to pooled r_a features through a gradient reversal layer, so the encoder is pushed to make r_a uninformative about which domain the reference came from. A reconstruction loss (cosine similarity rather than L2, because residuals are noisy and vary in scale) keeps the decomposition complete. The total objective is the sufficiency loss plus λ_adv times adversarial plus λ_recon times reconstruction, with λ_adv = 0.1 and λ_recon = 0.5 used unchanged across all hosts and datasets.

The adversarial loss alone is not enough, because within a single domain, domain cues remain predictive and the model can just pass the full residual through. So training episodes are built cross-domain: the reference set comes from source category D_i while the query comes from a different category D_j. A "domain" here is an object category, not a dataset — 15 categories when MVTec AD is the source, 12 when VisA is — and each episode's query and reference are pulled from different source categories with probability p_cross. Because domain-specific cues are no longer predictive, the model is forced to rely on the transferable component.

This is introduced gradually via a two-phase curriculum. For the first T_w = 5 epochs, all episodes are same-domain (p_cross = 0) and adversarial training is off (α = 0), letting a stable decomposition form. Then p_cross ramps linearly from 0 to p_max = 0.3 while the gradient-reversal strength follows a sigmoid schedule, α(t) = 2/(1 + exp(−10·(t − T_w)/(T − T_w))) − 1, preventing the adversarial term from destabilizing the warmup solution.

At inference, the domain encoder, reconstruction decoder, and domain classifier are all discarded; only the anomaly encoder runs, and the target dataset is never used for training, validation, or checkpoint selection.

Why This Matters

Impact on research. The paper reframes a practical failure mode of normal-abnormal guided GAD — spurious cross-domain activations — as a representation problem with a specific name and a specific fix, and backs it with a diagnostic (silhouette scores of domain versus defect identity) that distinguishes suppressing domain information from amplifying it. It also shows that abnormal-reference access is not automatically beneficial, which is a caution for a line of work that has treated extra supervision as a free win. The plug-in, architecture-agnostic design gives other researchers a drop-in component rather than a competing pipeline.

Real-world applications:

  • Industrial quality inspection — a single inspection model trained on some product categories and deployed on a new product line without collecting and labeling target-domain training data.
  • Medical imaging — the MVTec AD → BraTS experiment addresses transferring defect-detection knowledge from manufactured objects to brain-tumor MRI, where target-domain labeled data is scarce and privacy-restricted.
  • Safety-critical monitoring — the paper motivates visual anomaly detection generally by safety-critical monitoring, where rare failures must be caught without domain-specific retraining.
  • Rapidly expanding product catalogs — settings where new categories appear frequently and per-category models are impractical, which is the motivating scenario for GAD in the introduction.

Industry relevance. The overhead profile is the relevant part for deployment: training cost is incurred once on source data with the host model frozen, and inference adds only 0.82M–9.06M parameters running on low-dimensional residuals. Frozen host parameters mean an existing validated detector does not need to be re-trained or re-certified wholesale. No per-host or per-dataset hyperparameter tuning is required beyond the two loss weights, which matters for teams that cannot afford extensive per-deployment sweeps.

Future Directions

  • Beyond demotion toward stronger invariance. The authors explicitly note that DART demotes rather than deletes domain information and do not claim perfect invariance; pushing further on that axis — or characterizing when the remaining leakage hurts — is an open question.

  • Reference selection and defect-type matching. The protocol fixes a single abnormal reference (K₂ = 1), sampled by the query's defect type on MVTec AD but uniformly on VisA. Since VisA results still improve despite this weaker matching, it is unclear how much more is available from smarter reference selection or multi-reference abnormal sampling.

  • Extending the plug-in to methods outside the residual interface. DART is validated on three residual-based hosts. Whether the same disentanglement transfers to GAD methods that do not expose a residual — for instance purely reconstruction-based or memory-bank approaches — is untested.

  • Explaining the architecture sensitivity. The linear-projection variant costs only −7.35 I-AUROC on VisA but almost nothing on MVTec AD, and InCTRL+DART has a notable weak spot at N² on BraTS (64.11 image AUROC versus NAGL+DART's 77.10). Understanding what makes a host amenable to disentanglement would help predict where DART pays off.

Target Audience

Researchers and graduate students working on visual anomaly detection, domain generalization, or transfer learning who are already comfortable with residual-based detection pipelines and adversarial representation learning. It is most useful to those specifically working in the few-shot / generalist anomaly detection setting with access to abnormal references, and to practitioners in industrial inspection or medical imaging who need one model to serve multiple unseen domains. Readers new to anomaly detection will find the problem framing accessible, but the methodology section assumes prior exposure to gradient reversal, mutual-information objectives, and transformer blocks.

Authors’ abstract

Generalist Anomaly Detection (GAD) aims to detect anomalies in unseen domains using only a few reference samples. Recent normal-abnormal guided methods improve this setting by exploiting abnormal references, but their residuals often mix transferable anomaly cues with domain-specific appearance factors such as texture, geometry, and acquisition conditions. This residual domain entanglement limits cross-domain transfer and may produce spurious activations on novel domains. We propose DART, a plug-in framework for normal-abnormal guided GAD that learns to separate residuals into anomaly-relevant and domain-specific components. DART combines a Residual Disentanglement Module, which preserves anomaly-discriminative information while suppressing domain information, with Cross-Domain Meta-Training, which forms episodes across source domains to make the separation effective. The method is architecture-agnostic and can be inserted between residual computation and the detection head of existing GAD pipelines. Experiments on MVTec AD, VisA, and BraTS show consistent improvements over multiple base methods, with the largest gains under stronger domain shifts. https://github.com/aqeeelmirza/DART

Read the original paper