TL;DR
MambaAD is the first framework to apply Mamba State Space Models (SSMs) to multi-class unsupervised anomaly detection. By combining global Mamba-based modeling with local convolutional features, it achieves state-of-the-art accuracy across multiple benchmarks while being significantly more computationally efficient than Transformer-based alternatives.
What Problem Does This Paper Address?
Industrial visual Anomaly Detection (AD) is a cornerstone of smart manufacturing, helping to identify defects in products ranging from microchips to textiles. Traditionally, researchers have used a "single-class" setting, training a dedicated model for every single type of object. This is incredibly inefficient as the number of product categories grows.
"Multi-class" AD aims to train one unified model for all categories. However, this presents a major architectural challenge:
- CNNs are efficient but struggle to capture long-range dependencies (global context).
- Transformers capture global context perfectly but suffer from quadratic computational complexity, making them too slow and memory-hungry for high-resolution, multi-scale feature processing.
As shown in Figure 1, MambaAD seeks to bridge this gap by leveraging the linear complexity of State Space Models to integrate both global and local modeling across multiple scales.
Methods
The authors introduce MambaAD, a pyramidal auto-encoder framework consisting of a pre-trained CNN encoder and a novel Mamba-based decoder. The core innovation lies in the Locality-Enhanced State Space (LSS) module.
Key Components:
- Locality-Enhanced State Space (LSS) Module: Instead of relying solely on Mamba, the LSS module processes features through two parallel branches: a series of Hybrid State Space (HSS) blocks for global interaction and multi-kernel depth-wise convolutions for local detail.
- Hybrid State Space (HSS) Block: To adapt 1D Mamba sequences to 2D images, the HSS block uses Hybrid Scanning (HS). It explores five scanning methods (Sweep, Scan, Z-order, Zigzag, and Hilbert) across eight directions.
- Hilbert Scanning: The authors found that Hilbert curves are particularly effective for industrial images because they maintain spatial locality better than simple raster scans, especially for objects centrally located in the frame.
- Multi-Scale Reconstruction: The model reconstructs features at three different scales. The final anomaly map is generated by summing the reconstruction errors across these scales, allowing the model to catch both tiny scratches and large structural defects.
Datasets
The model was evaluated on six diverse anomaly detection datasets:
- MVTec-AD: The industry standard with 15 categories of objects and textures.
- VisA: Features complex structures and multiple instances of objects.
- Real-IAD: A large-scale dataset with 30 categories and 150k high-resolution images.
- MVTec-3D, Uni-Medical, and COCO-AD: Used to further demonstrate the model's versatility across 3D data, medical imaging, and general-purpose benchmarks.
Key Insights and Ideas
- The Best of Both Worlds: Ablation studies showed that the "Local + Global" approach in the LSS module outperformed using either branch alone. The CNN branch provides the "fine-grained" details, while the Mamba branch provides the "big picture."
- Linear Scaling is the Secret Sauce: Because Mamba scales linearly with sequence length, MambaAD can afford to process features at multiple scales simultaneously. Transformers are often confined to the smallest (lowest resolution) feature maps to avoid memory overflow.
- Scanning Matters: Moving beyond simple four-direction scans to eight-direction Hilbert scanning provided a measurable boost in performance, proving that how you "flatten" an image into a sequence significantly impacts an SSM's ability to learn spatial relationships.
Key Results
MambaAD achieved State-of-the-Art (SoTA) results across the board:
- MVTec-AD: Reached 98.6% AU-ROC at the image level, outperforming the previous leader, DiAD.
- Efficiency: Compared to the diffusion-based DiAD, MambaAD achieved better results with only 1/50th of the parameters and FLOPs (25.7M params vs. 1331.3M).
- Scalability: On the massive Real-IAD dataset, MambaAD maintained high performance (86.3% image-level AU-ROC), demonstrating its robustness for large-scale industrial applications.
Limitations and Future Work
While MambaAD is a significant step forward, the authors note that the model is still not "efficient enough" for the most extreme edge-computing scenarios. They suggest that future research should focus on even more lightweight designs. Additionally, this study marks an initial attempt to apply Mamba to AD; further exploration into different SSM variants or hybrid architectures could yield even higher precision.
Summary updated