Introduction
In industrial quality control, Multi-class Unsupervised Anomaly Detection (MUAD) is a highly sought-after capability. The objective is to build a unified system capable of detecting diverse defects—such as scratches, dents, or missing components—across various object categories using only "normal" (anomaly-free) examples as a reference.
Current state-of-the-art MUAD methods predominantly rely on an encoder-decoder architecture. These systems freeze a pre-trained encoder and train a custom decoder to reconstruct normal features. Anomalies are then flagged based on high residual scores where the decoder fails to reconstruct the unfamiliar anomalous features.
However, this approach introduces a fundamental fidelity-stability dilemma:
- Fidelity: The decoder must perfectly reconstruct normal features (acting nearly as an identity mapping) to be accurate.
- Stability: The decoder must simultaneously ignore small, benign variations to remain robust.
To prevent the decoder from simply copying the input, models use information bottlenecks. Consequently, the decoder is forced to act as a high-gain amplifier, making anomaly scores highly sensitive to minor, non-anomalous image variations and leading to false positives. Furthermore, training these models is computationally expensive and vulnerable to data distribution shifts.
Retrieval-Based Anomaly Detection (RAD)
To overcome the limitations of reconstruction-based methods, the authors propose Retrieval-based Anomaly Detection (RAD). RAD entirely bypasses task-specific training; instead of learning to reconstruct features, it simply remembers them.
The RAD framework operates through three primary steps:
- Multi-layer Memory Bank: Using a frozen foundation model (DINOv3), RAD extracts features from multiple layers. It stores these normal features in a memory bank alongside a global image descriptor (the
[CLS]token). - Global Context Retrieval: When evaluating a test image, RAD first identifies the $K$ most similar reference images in the memory bank using the global descriptor. This prevents semantic mismatches, ensuring that a test image of a screw is only compared to reference screws.
- Spatially Constrained Patch Retrieval: For every patch in the test image, RAD searches for the nearest neighbor within the retrieved reference images. Crucially, this search is restricted to a small local neighborhood (radius $\rho$). This spatial constraint accommodates slight variations in pose or alignment while ensuring that a "top-left corner" patch is only compared to other "top-left" regions.
The final anomaly score is computed as a weighted fusion of the nearest-neighbor distances across the network's multiple layers.
Key Insights and Theoretical Grounding
- Mathematical Stability: Unlike trained decoders that can amplify noise, the authors prove that retrieval-based scoring is non-expansive (1-Lipschitz). This guarantees that a small change in input features results in an equally small change in the anomaly score, ensuring robust and stable detection.
- Efficiency via Coresets: Storing every patch feature is memory-intensive. However, the authors demonstrate that coreset sampling can compress the memory bank by over 98% (e.g., reducing storage from 32.6 GB to 0.37 GB) with negligible impact on detection accuracy.
- The Power of Context: The two-stage retrieval process (global image-level followed by local patch-level) effectively filters the memory bank, making RAD highly effective in multi-class settings without requiring category-specific models.
Experimental Results
RAD was evaluated across four major benchmarks: MVTec-AD (the industry standard), VisA (complex backgrounds), Real-IAD (large-scale with high intra-class variation), and 3D-ADAM (machined parts).
- New State-of-the-Art: RAD outperformed all previous trained and training-free methods across MVTec-AD, VisA, and Real-IAD.
- Few-Shot Mastery: RAD excels in "cold-start" scenarios where data is scarce. On MVTec-AD, it achieved an impressive 96.7% Pixel AUROC using just a single reference image, nearly matching its full-dataset performance of 98.5%.
- Inference Speed: By utilizing global retrieval to narrow the patch-level search space, RAD significantly reduced inference latency on MVTec-AD from approximately 294ms to 45ms per image.
Limitations and Future Directions
While RAD establishes a new paradigm for MUAD, it has a few limitations. Even with coreset compression, maintaining a memory bank incurs a higher storage overhead than a standalone encoder-decoder model. Additionally, the retrieval step introduces latency compared to a simple feed-forward pass, suggesting that future work could explore more efficient indexing methods like FAISS. Finally, while RAD was tested on the RGB modality of the 3D-ADAM dataset, integrating depth and point cloud data into the retrieval framework presents a promising avenue for detecting geometric anomalies.
Ultimately, RAD challenges the prevailing assumption that MUAD requires task-specific training, proving that foundation models combined with intelligent retrieval can achieve superior, stable, and highly efficient anomaly detection.
Summary updated