1. Introduction
The rapid advancement of Industry 4.0 and smart manufacturing has elevated intelligent quality inspection to a critical function in modern production systems [
1,
2,
3]. Automated visual anomaly detection (AD) is now widely deployed across industries such as semiconductor manufacturing, pharmaceuticals, and precision manufacturing, where manual inspection cannot meet the increasing demands for throughput, consistency, and reliability [
4,
5,
6,
7]. In semiconductor fabrication, for example, each new process node or product generation introduces inspection requirements that existing models cannot satisfy—driving repeated model development cycles that delay yield ramp and increase time-to-market. In pharmaceutical manufacturing, regulatory mandates for 100% visual inspection, combined with frequent batch and formulation changes, mean that inspection systems must be rapidly deployable across diverse product configurations without lengthy model development pipelines.
Despite significant progress in benchmark performance, most existing AD systems remain inherently domain-dependent: models trained on one product category or inspection environment typically fail to generalize to others. As a result, deploying AD in real-world factories requires repetition of the full pipeline of data collection, annotation, model training, and validation for every new product line. This per-domain retraining paradigm introduces substantial operational costs. As product portfolios grow, cumulative GPU computation, energy consumption, and engineering labor scale proportionally—directly undermining the resource efficiency and sustainability goals of modern manufacturing [
8].
The limitations of this paradigm can be summarized in three dimensions. First, data collection and curation must be repeated for each product variant [
9], requiring significant engineering effort to gather representative normal samples and validate defect patterns. Second, computational overhead accumulates across retraining cycles: repeated GPU-intensive training for each product variant generates energy consumption that, when multiplied across a multi-line facility, represents a non-trivial environmental burden inconsistent with the sustainability commitments increasingly adopted across manufacturing sectors. Third, models trained in one domain often exhibit severe performance degradation when transferred to another [
10,
11], reflecting their reliance on domain-specific visual features such as texture, color distribution, and imaging conditions. Together, these three dimensions constitute a sustainability barrier that scales adversely with product portfolio diversity. These challenges motivate a fundamental research question:
To what extent can an anomaly detection model trained on a source dataset be directly deployed to unseen industrial domains without requiring any target-domain data or retraining?Recent research has explored zero-shot AD approaches, particularly those based on vision–language models (VLMs) [
12,
13,
14,
15], which leverage textual prompts to define normality and abnormality. While promising, these methods introduce new complexities, including dependence on language encoders, sensitivity to prompt design, and the use of additional adaptation modules. In industrial inspection settings—where anomalies are often subtle, domain-specific, and purely visual—such dependencies can limit practicality and require expertise that may not be available on the factory floor. VLM-based methods may struggle in underrepresented industrial domains where visual–textual co-occurrence during pretraining is limited [
15].
An alternative direction is represented by vision-only approaches based on frozen foundation models. Notably, UniADet [
16] demonstrates that strong zero-shot and few-shot anomaly detection performance can be achieved without language encoders by learning lightweight decoupled direction vectors (
,
) on top of frozen vision transformers (e.g., DINOv2 [
17], DINOv3 [
18]). However, this approach treats all feature channels equally, implicitly assuming that each channel contributes uniformly across domains. We hypothesize that this assumption is problematic in cross-domain settings: some channels encode domain-specific information (e.g., texture and color) that can act as noise during cross-domain transfer, thereby degrading the learned direction vectors on unseen target domains. In a deployment context, this means that a source model may degrade unpredictably when transferred to a production line with different surface characteristics or imaging conditions, even when the inspection task is structurally similar. This hypothesis motivates our graded channel-weighting design (
Section 3.3).
Feature selection methods provide a complementary solution by identifying channels most relevant for anomaly detection. RealNet [
19] introduced Anomaly-aware Feature Selection (AFS), a self-supervised method that evaluates each channel’s anomaly discriminative capability and selects the top-
channels via hard thresholding. While effective within a single domain, such hard selection strategies discard a large portion of the feature space, causing information loss. This limitation is particularly critical in cross-domain scenarios: channels discarded based on the source domain may be precisely those needed to detect defects in an unseen target domain.
To address these limitations, we propose PFAD, a framework for retraining-free cross-domain deployment that combines the strengths of both approaches with two key improvements:
- 1.
Soft AFS: We propose a soft, information-preserving alternative to RealNet’s hard channel selection [
19], replacing binary top-
k masks with a softmax-based weighting mechanism (
w ) that retains all channels while calibrating anomaly-relevant ones. This preserves information from channels that may be less important in the source domain but critical in unseen target domains. The absolute performance gain over uniform channel weighting is modest (at most
pp image-level AUROC on public benchmark pairs;
Section 4.4.1); its primary value lies in statistical stability and calibrated selectivity across diverse domain-transfer scenarios.
- 2.
Real defect-based calibration: Instead of relying on synthetic anomalies (e.g., SDAS in RealNet), we calibrate channel weights using source-domain data, eliminating the distribution gap between synthetic and real anomalies.
In this work, “retraining-free” refers specifically to target-domain deployment: PFAD is trained once on a selected public source dataset and then transferred to unseen target lines without any target-side data collection or optimization. This design directly reduces the cumulative computational, energy, and engineering overhead associated with deploying inspection across multiple product lines, supporting the resource-efficiency goals of sustainable manufacturing.
Our contributions are as follows:
- 1.
We introduce Soft AFS, a method for channel-level, anomaly-aware weighting that improves cross-domain transferability while preserving feature information. This approach enables new product lines to be commissioned by training the model once on an appropriate public source dataset and deploying the resulting source model without target-domain retraining.
- 2.
We propose calibrating AFS weights using source-domain data, eliminating dependence on synthetic anomaly generation pipelines and leveraging existing inspection records.
- 3.
We demonstrate that training only 0.02 M parameters on a frozen backbone reduces per-domain setup to approximately 18 minutes on a single GPU, enabling integration into production-line quality management systems without dedicated AI infrastructure.
- 4.
We validate PFAD on both public benchmarks (MVTec AD, VisA, BTAD, KolektorSDD) and real industrial datasets (semiconductor PCB inspection and pharmaceutical packaging), demonstrating that the same PFAD architecture transfers across heterogeneous industrial target domains—semiconductors and pharmaceuticals—without any per-domain retraining.
- 5.
We provide an optional single-reference one-shot pathway that can further improve detection at inference time when zero-shot performance has room for improvement—e.g., Mono → RGB sensor transfer ( pp) or large domain-gap scenarios such as Pharma (up to pp)—without requiring any additional training.
5. Discussion
Domain gap and transfer patterns. Cross-domain performance is positively associated with source dataset diversity. MVTec AD (15 categories) and VisA (12 categories) provide broader feature coverage than BTAD (three categories), resulting in more generalizable direction vectors. This finding suggests that curating diverse source datasets is a practical strategy for deployment.
Segmentation robustness to domain gaps. Across all experiments, pixel-level AUROC degrades less than image-level AUROC under domain shift. In the extreme case of Pharma, pixel-level AUROC remains above 0.90 while image-level AUROC drops to 0.43–0.66. This finding suggests that local, patch-level anomaly patterns transfer more reliably than global, image-level representations, consistent with the observation that defects (scratches, stains, structural deviations) share low-level visual signatures across domains.
Soft AFS behavior. From a deployment perspective, the value of Soft AFS lies in its ability to provide calibrated channel importance without any inference overhead. Soft AFS provides a natural mechanism to absorb the uncertainty of domain transfer by retaining all channels with graded importance rather than discarding channels that may be critical in unseen target domains. The
ablation (
Table 9) shows that AUROC is insensitive to the temperature parameter: the entire sweep from
to
spans only
pp under the current code (CAA disabled, multi-seed mean), with no significant penalty at any setting. This robustness arises because
is folded into frozen per-channel weights at calibration time; the direction vectors compensate for any weighting sharpness. Direct comparison with a No-AFS baseline (
Table 8) confirms statistical indistinguishability (mean gap
pp, within seed noise). The primary value of Soft AFS therefore lies in its zero-inference-cost, calibration-derived channel differentiation: it is never a liability and provides structural robustness to domain-specific channel shifts even when accuracy differences are not measurable on public benchmarks.
Few-shot as a practical bridge. The one-shot extension demonstrates that a single normal reference image can improve image-level classification when zero-shot performance has not yet reached saturation, but its benefit is domain-gap-dependent rather than universal. On Pharma, the largest domain gap scenario, one-shot inference improves image-level AUROC by up to 10 percentage points, with pixel-level performance remaining robust across all source configurations (consistent with the segmentation robustness patterns noted above). On SemiCond, paired one-shot cross-modality transfer can substantially improve one sensor direction (Mono → RGB reaches image-level AUROC of 0.977), but the effect is asymmetric and can become negative in the opposite direction when reference mismatch or modality-specific feature asymmetry is introduced. Two distinct mechanisms can cause one-shot fusion to underperform the zero-shot baseline:
modality-specific over-anchoring, observed when the zero-shot baseline is already high (SemiCond RGB → Mono: 0.952 → 0.890,
Table 13; see
Section 4.5.1 for a mechanistic analysis); and
reference ambiguity, observed when the source domain is already structurally close to the target (Pharma KolektorSDD: 0.894 → 0.891,
Table 7). Both scenarios share a common operational implication: one-shot fusion should be applied selectively—it is most beneficial when zero-shot performance has meaningful headroom, not as a default addition to every deployment. Notably, this extension requires no additional training—only inference-time score fusion—making it a practical option when even minimal target-domain data is available. The results suggest a practical deployment rule: zero-shot transfer is appropriate when no target-side data are available; one-shot score fusion may provide additional benefit when a single normal reference image is available and zero-shot performance still has measurable headroom for improvement—when zero-shot is already near-saturated, the one-shot extension may offer little or no gain; and patch-level inference becomes necessary when defects occupy only a small fraction of high-resolution images.
Resource efficiency. PFAD trains only lightweight direction vectors on a frozen backbone, requiring no gradient computation through the backbone parameters. The entire training process is completed in approximately 18 min per source domain on a single NVIDIA RTX A6000 GPU. The measured inference efficiency (RTX A6000, batch 1, input
, 100 warm-up + 1000 timed iterations with
torch.cuda.synchronize()):
ms/image, 16.28 FPS, peak VRAM 1.20 GB. For Pharma (
,
patch split): 245.75 ms effective latency (4.07 FPS).
Table 14 summarizes the resource profile.
Once trained, the model deploys to multiple unseen target domains without retraining, eliminating the repeated data collection and computation cycles that conventional per-domain models demand. AFS calibration leverages existing inspection records from the source domain rather than requiring new data campaigns. These properties collectively reduce the computational overhead and resource expenditure associated with deploying anomaly detection across diverse manufacturing lines. This is particularly relevant for factories operating large product portfolios, where repeated per-domain retraining amplifies GPU hours, engineering labor, and energy consumption over time. PFAD is parameter-efficient: only M direction vectors are trained on a frozen backbone, enabling domain adaptation without any retraining overhead; deployment on resource-constrained edge hardware would additionally require backbone quantization, which is left for future work.
Practical implications for industrial deployment. The experimental results directly support several concrete deployment benefits. Training on VisA alone yields an image-level AUROC of 0.945 on semiconductor PCB inspection without any target-domain data, demonstrating that an operator can deploy
PFAD on a new inspection line immediately by selecting a suitable public source dataset—no proprietary data collection or retraining is required. When a representative normal reference image is available, the optional one-shot pathway can further reduce setup cost in favorable deployment settings, as illustrated by the Mono → RGB SemiCond result (image-level AUROC 0.977). However, as shown in
Section 4.5.1, this benefit is not symmetric across sensor directions and should therefore be treated as a conditional deployment aid rather than a mandatory step. On pharmaceutical packaging, zero-shot transfer from KolektorSDD achieves an image-level AUROC of 0.894, indicating that an industrially sourced training dataset suffices for a chemically distinct production domain. However, when the source dataset is structurally dissimilar to the target domain (e.g., VisA or BTAD sources yield 0.764–0.782 image-level AUROC on Pharma), operators should consider selecting a more compatible source or applying the optional one-shot pathway before deployment in safety-critical applications. The full training pipeline completes in approximately 18 min per source domain on a single NVIDIA RTX A6000 GPU, while only 0.02 million of the model’s 300 million parameters are trained, keeping the model footprint small and suitable for edge deployment. Source selection is therefore a key deployment decision: datasets sharing surface texture and defect morphology with the target domain (e.g., industrial component inspection datasets for semiconductor PCB or surface-crack inspection datasets for pharmaceutical packaging) tend to yield higher zero-shot transfer performance. From an operational perspective,
PFAD follows a simple three-step deployment workflow:
Select source: choose the public source dataset most structurally compatible with the target domain (surface texture and defect morphology are the key criteria).
Train once: train on the source dataset ( min on RTX A6000); the resulting model transfers to all target domains without further training.
Optionally refine: if a single normal reference image from the target is available and zero-shot performance still has meaningful headroom, apply one-shot score fusion at inference time.
Across both semiconductor and pharmaceutical validation scenarios, the same PFAD architecture is transferred without target-domain retraining, demonstrating practical versatility across two structurally distinct industries.
Limitations and future work. (1) The CAA–AFS interaction, in which class-aware augmentation during training can contaminate the AFS calibration signal, is addressed in the current protocol by disabling CAA during cross-domain transfer to industrial target domains. The decoupled-pipeline experiment (
Table 12) shows no statistically significant difference between the entangled and decoupled pipelines (
for all pairs when comparing entangled vs. decoupled pipelines). However, future architectural work could decouple these pipelines at the training level to recover the full benefit of CAA on source-domain benchmarks without adversely affecting cross-domain calibration. (2) The few-shot fusion weight
is currently fixed; adaptive fusion strategies conditioned on domain similarity could further improve performance. (3) Evaluation across a wider range of industrial domains and modalities would strengthen the evidence for generalizability. Additionally, an automated source-selection strategy that recommends the most transferable public source dataset for a given target production line would reduce the current reliance on operator knowledge.