TL;DR
Anchor and Adapt is a two-stage prompt learning framework for few-shot industrial anomaly detection that eliminates the need for labor-intensive, product-specific manual anomaly descriptions. By first learning transferable "anchors" for normal and abnormal states from auxiliary data and then asymmetrically adapting only the normal representation to a new product, it achieves state-of-the-art performance in detecting and localizing defects with as few as one training image.
What Problem Does This Paper Address?
Industrial Anomaly Detection (IAD) is the task of identifying defective products on a production line. In a "few-shot" setting (FS-IAD), a model must learn to identify defects in a new product category using only a handful of normal samples (e.g., 1 to 4 images) and zero examples of defects.
Current state-of-the-art methods often leverage Vision-Language Models (VLMs) like CLIP. However, they typically rely on manually designed text prompts (e.g., "metal nut with a bent shape") to define what an anomaly looks like. This approach has two major flaws:
- High Manual Effort: Designing specific prompts for every new product is time-consuming.
- Instability: As shown in the paper's analysis, small changes in the choice of manual prompts can lead to significant swings in performance across different product categories.
Methods
The authors propose a two-stage framework that separates the acquisition of general anomaly knowledge from the adaptation to a specific product's appearance.
Stage I: Learning Transferable Prompt Anchors
The model is first trained on an auxiliary dataset that contains annotated defects for various products. During this stage, it learns generic "normal" and "abnormal" prompt anchors (learnable embeddings). These anchors capture the semantic essence of what makes an object look "damaged" versus "normal" in a way that generalizes across categories.
Stage II: Asymmetric Target Prompt Adaptation
When a new product arrives, the model enters the adaptation phase using only a few normal samples.
- Asymmetric Design: The previously learned abnormal anchors are kept frozen. Since the target data contains no defects, trying to update the abnormal side would be counterproductive.
- Dual-Normal Representation: The model maintains the generic normal anchor from Stage I and learns a new class-specific normal branch. This branch uses low-rank residual updates (similar to LoRA) and new learnable tokens to capture the unique textures and features of the new product.
- Text-Anchor Regularization: A specialized loss function ensures the new class-specific prompts stay consistent with the generic normal prior while remaining distinct from the abnormal anchors.
Datasets
The framework was evaluated on three major industrial benchmarks:
- VisA: 12 product categories (e.g., printed circuit boards, capsules).
- MVTec-AD: 15 categories (e.g., bottles, cables, wood).
- MPDD: 6 categories of metal parts, used specifically to test the model's ability to transfer knowledge to a different domain.
The experiments were conducted under 1-, 2-, and 4-shot settings, meaning the model only saw 1, 2, or 4 normal images of the target product during adaptation.
Key Insights and Ideas
- Separation of Concerns: The core "aha moment" is that learning "what a defect is" (semantics) and "what this product looks like" (appearance) are two different tasks that require different supervision.
- Asymmetry is Key: In few-shot learning, you only have evidence for one side of the coin (normality). By freezing the abnormal anchors, the model retains its "knowledge" of defects learned from auxiliary data while focusing its limited target data on refining the definition of "normal."
- Dual-Normality: Combining a generic "object" prior with a specific "metal nut" adaptation provides a more robust baseline. The generic branch prevents the model from over-specializing on the few available samples, which might not represent the full variety of normal appearances.
Key Results
Anchor and Adapt achieves top-tier results across all benchmarks, particularly excelling in the more challenging VisA dataset.
- VisA (4-shot): Achieved 92.1% I-AUROC (Image-level Area Under the Receiver Operating Characteristic curve), outperforming the previous best method by 1.3 percentage points.
- MVTec-AD (4-shot): Reached 98.3% I-AUROC.
- Localization: The model provides highly accurate heatmaps for defects, achieving a 91.1% PRO score (Per-Region Overlap) on VisA, which measures how well the model localizes individual defect regions.
Limitations and Future Work
While the model significantly reduces manual effort, it still requires an annotated auxiliary dataset for Stage I. While such datasets (like VisA or MVTec-AD) are readily available in the research community, a truly "zero-supervision" approach for the auxiliary stage remains an open challenge. The authors also suggest that integrating larger, more powerful Vision-Language Models could further improve the semantic richness of the learned anchors.
Summary updated