Recent anomaly detection studies have shown that residual features, which model the discrepancy between normal and abnormal patterns, provide strong generalization to anomalies unseen during training. However, existing residual-based approaches mainly rely on visual discrepancies derived from image representations, while semantic discrepancies that can be explicitly expressed through language remain largely underexplored. To address this problem, we propose TIRAD, Text-guided Image Residual Learning for Generalist Anomaly Detection, a multimodal residual learning framework that defines the discrepancy between textual representations of normal and abnormal states as a Text Residual Feature and uses it to guide the Image Residual Feature. Specifically, a Text Fusion Module converts patch-level text residuals into a gate that modulates the image residual of each patch. The gate retains the visual discrepancies that the text residual identifies as defect-related and attenuates the others, leading to more discriminative anomaly representations. Extensive experiments on industrial benchmarks and industrial-to-medical transfer demonstrate that the proposed method outperforms existing image-centric residual learning methods.
Figures & tables
Figure 1: (a) Illustration of the text residual: subtracting the normal text embedding from the abnormal one yields a text residual that markedly reduces the normal–abnormal similarity. (b) Comparison of text features: raw normal and abnormal embeddings are highly similar and entangled, whereas the text residual features separate normal from abnormal consistently across object classes in the t-SNE projection.
Figure 2: Overview of the proposed framework. The image branch uses memory-bank-based nearest-neighbor search to compute an image anomaly score map Simage from query and normal reference features. In parallel, the text branch constructs text residual features from normal and abnormal prompts, and the Text Fusion Module converts them into a gate that semantically modulates image residual features to produce a text-guided score map Stext . The two score maps are merged into the final anomaly score map Sfinal , which is used for both image-level anomaly detection and pixel-level anomaly localization.
Shot
Method
MVTec AD
VisA
Image-level
Pixel-level
Image-level
Pixel-level
AUROC
AP
F1
AUROC
F1
PRO
AUROC
AP
F1
AUROC
F1
PRO
1-shot
PatchCore
83.4
92.2
90.5
92.0
50.4
79.7
79.9
82.8
81.7
95.4
38.0
80.5
WinCLIP
93.1
96.5
93.7
95.2
55.9
87.1
83.8
85.1
83.1
96.4
41.3
85.1
AnomalyDINO ∗
95.4
97.6
94.9
93.8
52.2
86.0
85.6
88.3
82.9
95.6
36.4
87.3
ResAD ∗
92.8
95.5
93.9
94.9
55.4
92.1
89.3
91.2
87.2
96.5
38.7
87.7
Table 1: Main results on MVTec AD and VisA under 1-, 2-, 4-shot settings. Results marked with ∗ are based on our re-implementation under the same DINOv2-Txt backbone, while the remaining results are taken from [ 36 ] . Best results are in bold , and second-best results are underlined .
Shot
Method
Image-level
Pixel-level
AUROC
AP
F1
AUROC
F1
PRO
1-shot
AnomalyDINO
71.83
91.03
91.13
94.69
39.18
76.43
ResAD
71.95
90.47
91.07
95.32
37.47
76.29
NAGL
72.79
91.05
91.34
95.36
42.66
77.30
TIRAD(Ours)
73.69
92.12
91.55
95.81
46.44
76.14
2-shot
AnomalyDINO
76.77
92.32
91.40
95.36
42.69
77.78
Table 2: Cross-domain results on BraTS under 1-, 2-, and 4-shot settings. All competing methods are reproduced under the same DINOv2-Txt backbone, where models are trained on MVTec AD and directly evaluated on BraTS without target-domain fine-tuning. Best results are in bold , and second-best results are underlined .
Image-level
Pixel-level
Configuration
AUROC
AP
F1
AUROC
F1
PRO
Simage
93.79
96.60
94.77
95.61
54.21
91.48
Simage+Stext (matched)
95.47
97.50
95.56
95.67
54.82
91.98
Simage+Stext (residual)
97.06
98.39
96.21
95.87
56.19
92.63
Table 3: Ablation study on text residual modeling under the 1-shot setting on MVTec AD. “matched” directly uses the matched text feature, while “residual” uses the text residual feature computed with respect to the normal text anchor.
Table 6
Figure 3: t-SNE visualization of text features across three stages: (a) raw features from the frozen encoder, (b) adapted features after the learned text projector, and (c) the resulting text residual features. Separation between normal and abnormal semantic states improves progressively from (a) to (c), and remains consistent across different object classes.
Figure 4: Qualitative anomaly localization on MVTec AD and VisA. From left to right: input image, ground-truth mask, text-residual gate, image residual response, and the fused anomaly map. The text-residual gate modulates the image residual, and the resulting fused map localizes anomalies more accurately than the image residual alone.
Figure 5: Qualitative comparison of anomaly maps produced by different methods, each following the setting in Sec. 4 .
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
MVTec AD
VisA
BraTS (medical)
1
[cls]
[cls]
[cls]
2
flawless [cls]
flawless [cls]
healthy [cls]
3
perfect [cls]
perfect [cls]
normal [cls]
4
unblemished [cls]
unblemished [cls]
intact [cls]
5
[cls] without flaw
[cls] without flaw
[cls] without abnormality
6
[cls] without defect
[cls] without defect
[cls] without lesion
Appendix
Table A1 : Normal-state prompt templates for the three evaluation domains. The industrial lists follow the taxonomy of MultiADS [ 33 ] ; the medical list is constructed by us (Sec. A.1 ). [cls] is replaced by the category name.
Defect type
Prompts ( [cls] = category name)
bent
[cls] has a bent defect; flawed [cls] with a bent; a bend found in [cls]; [cls] with noticeable bending; a bent edge on [cls]; [cls] has a slight curve defect
broken
[cls] has a broken defect; flawed [cls] with breakage; visible breakage on [cls]; [cls] with broken areas; [cls] shows signs of breaking; cracked or broken spots on [cls]
color
[cls] has a color defect; inconsistent color on [cls]; [cls] with color discrepancies; [cls] has a noticeable color difference; [cls] with irregular coloring; [cls] has off-color patches
combined
[cls] has a combined defect; multiple issues with [cls]; [cls] with mixed defects; [cls] showing multiple imperfections; several flaws found on [cls]; [cls] with combined defect types
contamination
[cls] has a contamination defect; foreign particles on [cls]; [cls] is contaminated; [cls] contains contaminants; [cls] has impurity issues; traces of contamination on [cls]
crack
[cls] has a crack defect; a crack is present on [cls]; cracked area on [cls]; [cls] with noticeable cracking; fine cracks found on [cls]; [cls] shows surface cracks
Appendix
Table A2 : Defect-aware prompts for MVTec AD (20 defect states, superset over 15 categories), adopted from the MultiADS knowledge base [ 33 ] .
Defect type
Prompts ( [cls] = category name)
damage
[cls] has a damaged defect; flawed [cls] with damage; [cls] shows signs of damage; damage found on [cls]; [cls] with visible wear and tear; [cls] with structural damage
scratch
[cls] has a scratch defect; flawed [cls] with a scratch; scratches visible on [cls]; [cls] has surface scratches; small scratches found on [cls]; [cls] with scratch marks
breakage
[cls] with a breakage defect; broken [cls]; [cls] with broken defect; [cls] shows breakage; broken or cracked areas on [cls]; visible breakage on [cls]
burnt
[cls] with a burnt defect; [cls] shows burn marks; burnt areas on [cls]; [cls] with signs of burning; scorch marks on [cls]; [cls] appears slightly burnt
weird wick
[cls] with a weird wick defect; [cls] has an unusual wick; the wick on [cls] appears odd; [cls] with a strangely shaped wick; irregular wick found on [cls]; odd wick defect on [cls]
stuck
[cls] with a stuck defect; [cls] stuck together; [cls] has stuck parts; adhesive issue causing [cls] to stick; [cls] is partially stuck; [cls] with adhesion defect
Appendix
Table A3 : Defect-aware prompts for VisA (18 defect states, superset over 12 categories), adopted from the MultiADS knowledge base [ 33 ] .
Defect type
Prompts ( [cls] = category name)
lesion
[cls] has a lesion; a lesion is present on [cls]; abnormal lesion in [cls]; [cls] with a visible lesion; lesion region found in [cls]; [cls] shows a focal lesion
tumor
[cls] has a tumor; a tumor is present in [cls]; tumor region in [cls]; [cls] with an abnormal mass; [cls] shows tumor tissue; abnormal growth detected in [cls]
hemorrhage
[cls] has a hemorrhage; bleeding region in [cls]; [cls] with hemorrhagic area; [cls] shows signs of bleeding; hemorrhage found in [cls]; abnormal bleeding in [cls]
edema
[cls] has edema; edema region in [cls]; [cls] with swelling; [cls] shows abnormal fluid accumulation; swollen area in [cls]; edematous region found in [cls]
mass
[cls] has an abnormal mass; a mass is present in [cls]; mass region in [cls]; [cls] with an abnormal mass effect; [cls] shows a mass; abnormal mass detected in [cls]
anomaly
[cls] has an anomaly; an abnormal region in [cls]; [cls] with abnormal tissue; [cls] shows an abnormality; abnormal area found in [cls]; [cls] with a pathological region
Appendix
Table A4 : Anomaly-state prompts for the BraTS (brain MRI) domain. These are semantic state descriptors constructed by us, mirroring the industrial taxonomy; they are not diagnostic labels and are not adopted from prior medical work.
Image-level
Pixel-level
Category
AUROC
AP
F1
AUROC
F1
PRO
1-shot
bottle
99.92 ± 0.11
99.97 ± 0.06
99.60 ± 0.57
98.78 ± 0.31
79.62 ± 0.48
96.64 ± 0.08
cable
95.57 ± 0.44
97.90 ± 0.41
91.01 ± 0.14
93.55 ± 0.22
65.37 ± 0.21
86.63 ± 0.91
capsule
92.96 ± 0.37
98.97 ± 0.35
94.93 ± 0.33
95.37 ± 0.06
45.41 ± 0.56
95.33 ± 0.23
carpet
99.80 ± 0.25
99.91 ± 0.07
99.15 ± 0.41
99.03 ± 0.02
61.46 ± 0.52
97.56 ± 0.21
grid
100.00 ± 0.00
100.00 ± 0.00
100.00 ± 0.00
99.18 ± 0.21
43.34 ± 0.37
96.07 ± 0.14
Appendix
Table D5 : Per-category results on MVTec AD under the 1-, 2-, and 4-shot settings, averaged over three random seeds (mean ± std).
Image-level
Pixel-level
Category
AUROC
AP
F1
AUROC
F1
PRO
1-shot
candle
95.30 ± 0.44
95.22 ± 0.69
90.00 ± 0.61
98.85 ± 0.09
47.42 ± 1.71
96.10 ± 0.59
capsules
91.72 ± 1.91
95.54 ± 1.14
88.72 ± 3.27
97.14 ± 0.60
42.23 ± 0.11
94.59 ± 0.88
cashew
91.43 ± 2.99
95.67 ± 2.05
89.72 ± 5.08
98.18 ± 0.30
43.73 ± 2.26
96.62 ± 0.10
chewinggum
99.20 ± 0.10
99.59 ± 0.03
96.59 ± 0.31
99.54 ± 0.10
63.72 ± 7.07
95.38 ± 0.74
fryum
94.18 ± 0.07
97.28 ± 0.02
91.65 ± 0.50
93.34 ± 3.27
33.69 ± 1.95
89.68 ± 1.15
Appendix
Table D6 : Per-category results on VisA under the 1-, 2-, and 4-shot settings, averaged over three random seeds (mean ± std).
Image-level
Pixel-level
Setting
AUROC
AP
F1
AUROC
F1
PRO
1-shot
73.69 ± 4.14
92.12 ± 1.43
91.55 ± 0.79
95.81 ± 0.84
46.44 ± 4.83
76.14 ± 3.64
2-shot
79.83 ± 4.16
94.04 ± 1.33
92.10 ± 0.64
96.53 ± 0.53
51.06 ± 4.03
78.50 ± 1.61
4-shot
83.80 ± 2.59
95.39 ± 0.83
92.38 ± 0.59
96.97 ± 0.29
54.32 ± 2.39
79.76 ± 1.26
Appendix
Table D7 : Cross-domain results on BraTS under the 1-, 2-, and 4-shot settings, averaged over three random seeds (mean ± std). BraTS is single-class in the BMAD reorganization [ 1 ] , so no per-category breakdown applies.
Image-level
Pixel-level
Configuration
AUROC
AP
F1
AUROC
F1
PRO
Simage only (training-free)
93.79
96.60
94.77
95.61
54.21
91.48
(a) gate ≡1
93.99
96.58
94.61
95.03
54.91
92.22
(b) single direction (tˉa−tˉn)
93.93
96.60
94.45
95.44
54.18
92.04
(c) generic prompts
95.09
97.56
95.86
95.64
54.82
91.69
(d) wrong-dataset taxonomy
95.32
97.45
95.47
95.81
55.09
92.15
Appendix
Table E8 : Control experiments (VisA → MVTec AD, 1-shot, three seeds). Rows are not cumulative.
Figure G1 : Additional qualitative results on MVTec AD.
Figure G2 : Additional qualitative results on VisA.
Figure G3 : Additional qualitative results on BraTS.
Industrial anomaly detection has historically been a unimodal task. Recent multimodal vision-language models have produced systems that admit textual input alongside the image and are presented as enabling text-guided zero- and few-shot inspection. Yet these methods are evaluated with protocols inherited from unimodal benchmarks that hold the textual condition constant and therefore cannot measure whether language conditions the decision; whether reported gains reflect text guidance or strong pretrained visual features remains open. We introduce Text-Guided Anomaly Detection (TGAD), a structured benchmark that progressively increases the functional role of language across three scenarios: a controlled prompt-sensitivity setting on MVTec AD; a component-tagged extension of MVTec AD that requires the model to restrict its assessment to an instructed part; and the new Assembled Panel Dataset (APD), a realistic industrial setting that requires both defect-type and component-location knowledge. We evaluate one representative model per paradigm: generative large vision-language, training-free discriminative, and embedding-adaptive discriminative. In all three, the textual interface conditions the decision only superficially: prompt content is absorbed unless the object noun is removed (the generative model's I-AUROC drops from 97.4 to 82.6); component-level instructions do not constrain the decision once defects outside the instructed part are admitted as normal (from 90.3 to 66.3); and when both combine on APD, image-level discrimination collapses below the MVTec level, in one case below chance (71.2, 50.5, 31.5). These results suggest that standard benchmarks overstate the text-guided capabilities of current multimodal anomaly detection systems, and that a protocol of this kind is a prerequisite for models that can be reliably controlled through language for industrial deployment.
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
Muhammad Aqeel, Maham Nazir, Marco Cristani +1
University of Verona · Beihang University · Reykjavik University
Few-shot Generalist Anomaly Detection requires models to generalize to novel categories without retraining, posing significant challenges in real-world scenarios with scarce samples and rapidly changing categories. Existing CLIP-based methods face two major challenges: coarse-grained unified text prompts struggle to adapt to fine-grained foreground-background differences, causing cross-granularity mismatch; and fine-tuning on auxiliary datasets disrupts CLIP's inherent open-world generalization due to domain shift, leading to cross-category generalization degradation. To address these, we propose to shift multimodal alignment entirely into a unified residual space, where residual representations naturally eliminate fine-grained normal feature differences across regions and class-specific biases, simultaneously resolving both problems. Based on this insight, Res2CLIP, the first residual-to-residual alignment framework that symmetrically bridges visual and text modalities within CLIP's residual space, is designed. The framework is developed from a residual perspective into three branches: a text prompt-based branch, a visual prompt-based branch, and a novel residual-to-residual alignment branch. All learnable optimizations are constrained within the residual domain, and the residual alignment optimization objectives are designed to force the model to focus on relative anomaly deviations rather than optimizing class-specific features. Experiments on multiple datasets demonstrate the effectiveness of our architecture. The code is available at https://github.com/hito2448/Res2CLIP.
Xinyue Liu, Jianyuan Wang, Biao Leng +1
Beihang University · University of Science and Technology Beijing · Beijing Jiaotong University