Papers
Topics
Authors
Recent
Search
2000 character limit reached

Self-Navigated Residual Mamba (SNARM)

Updated 7 July 2026
  • Self-Navigated Residual Mamba (SNARM) is a universal industrial anomaly detection framework that fuses inter-residual and self-referential intra-residual learning to detect anomalies across diverse settings.
  • It computes hybrid residuals by comparing test patches to both a compact bank of normal features and self-generated references, enhancing precision in single-class, multi-class, and few-shot scenarios.
  • The framework employs a self-navigated Mamba decoder with multi-view ensemble decoding to dynamically scan and aggregate directional anomaly cues, achieving state-of-the-art performance on benchmarks.

Searching arXiv for the specified paper to ground the response. Self-Navigated Residual Mamba (SNARM) is a framework for universal industrial anomaly detection that combines two-stage residual learning, residual-guided sequence modeling, and multi-view ensemble decoding to operate across single-class AD, multi-class AD, cross-class AD, and few-shot AD. The method is introduced in “Self-Navigated Residual Mamba for Universal Industrial Anomaly Detection” (Li et al., 3 Aug 2025). Its defining mechanism is “self-referential learning” within test images: test patches are first contrasted with a compact bank of normal training features to form inter-residuals, and patches exhibiting small-norm residuals are then reused as self-generated references to form intra-residuals. These residuals are fused and processed by a self-navigated Mamba decoder whose token selection and directional scanning are guided by residual properties, with final anomaly maps obtained by ensemble averaging across multiple directions and receptive fields (Li et al., 3 Aug 2025).

1. Problem setting and design rationale

SNARM is formulated for the universal setting of industrial anomaly detection, where a single scalable framework is intended to work across single-class AD, multi-class AD, cross-class AD, and few-shot AD (Li et al., 3 Aug 2025). The motivating diagnosis is that many prior methods depend primarily on pretrained normal features and a one-stage patch comparison against a memory bank of normal data. In that regime, a test patch is typically compared only with stored normal prototypes, and the resulting residual is used directly for anomaly scoring.

The central claim of SNARM is that a single residual against pretrained normal features is insufficient for robust discrimination in difficult scenes. The method therefore introduces three coupled components: inter-residuals obtained from comparison to the external normal feature bank; intra-residuals obtained by reusing the most normal-looking test patches as self-generated references; and a self-navigated Mamba decoder that dynamically scans informative regions according to residual properties (Li et al., 3 Aug 2025). This design is intended to improve discriminative power while also improving efficiency through reduced matching or search and a compact bank.

A plausible implication is that SNARM treats anomaly detection not as a single nearest-neighbor deviation test, but as a residual refinement process in which global deviation from training normality is supplemented by context-sensitive, image-internal comparison. The paper explicitly distinguishes this from PatchCore-like residual pipelines that stop after inter-image matching.

2. Architecture and processing pipeline

The overall SNARM pipeline begins with universal visual feature extraction from a pretrained encoder, with DINOv2-R ViT-Base/14 as the default encoder (Li et al., 3 Aug 2025). A compact feature bank is then constructed from normal training images using coreset sampling. For each test image patch, SNARM computes inter-residuals against the bank and derives a Waypoint Map (WM) from these residuals. The lowest-residual patches in the test image are selected as pseudo-normal references, and intra-residuals are computed by matching test patches against these self-generated references. Inter- and intra-residuals are concatenated into hybrid residuals, which are fed into a Self-Navigated Mamba Module (SNMM). The decoder then produces anomaly maps via a Multi-View Decoder (MVD), and branch outputs are aggregated through ensemble averaging (Li et al., 3 Aug 2025).

The feature extractor is written as ΨEN()\Psi_{\mathrm{EN}}(\cdot), with intermediate-layer outputs

{F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).

Early and late layers are fused as

F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),

and after upsampling and flattening,

[f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),

where each fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f} is a local patch descriptor (Li et al., 3 Aug 2025).

This organization places feature extraction, residual construction, navigation, and decoding into distinct stages. The paper’s framing suggests that the separation is deliberate: residuals are not merely scores but structural signals used to control subsequent computation.

3. Two-stage residual learning and self-referential comparison

SNARM’s first residual stage compares test patches with a training feature bank. Patch features from normal training images are collected into a raw bank and compressed by a coreset into a compact bank B\mathcal{B} with size TMNtrnT \ll M \cdot N_{\text{trn}} (Li et al., 3 Aug 2025). For each test patch fitst\mathbf{f}^{\text{tst}}_i, the nearest reference patch is

t=argmint=1,,Tfitstftref2,t^\ast = \arg\min_{t=1,\cdots,T} \left\| \mathbf{f}^{\text{tst}}_i - \mathbf{f}^{\text{ref}}_t \right\|_2,

and the inter-residual is defined as the powered absolute difference

ri=(ABS(fitstftref))θ,\mathbf{r}_i = \left(\mathrm{ABS}\left(\mathbf{f}^{\text{tst}}_i - \mathbf{f}^{\text{ref}}_{t^\ast}\right)\right)^\theta,

with {F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).0 tuning contrast (Li et al., 3 Aug 2025).

From the inter-residual map {F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).1, SNARM constructs a coarse anomaly confidence map called the Waypoint Map. The navigator has two branches:

{F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).2

Here, {F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).3 is a learned unary anomaly score from a {F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).4 convolution followed by sigmoid, and the second term is the channel-averaged residual magnitude; {F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).5 is the final Waypoint Map (Li et al., 3 Aug 2025). The map is used both to guide the second residual stage and to navigate token processing in Mamba.

The second residual stage is the self-referential component. SNARM assumes that patches with the lowest waypoint scores are likely normal and uses them as pseudo-reference patches:

{F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).6

where the paper uses {F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).7 (Li et al., 3 Aug 2025). Each test patch is then matched against {F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).8,

{F1,F2,,FL}=ΨEN(I).\{\mathbf{F}^1, \mathbf{F}^2, \cdots, \mathbf{F}^L \} = \Psi_{\mathrm{EN}}(\mathrm{I}).9

and the intra-residual is

F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),0

The paper characterizes this as self-referential comparison: the test image generates its own “normal-ish” references, making matching more context-aware within the specific image and potentially making subtle deviations more visible when the external memory bank is not perfectly representative (Li et al., 3 Aug 2025). Inter- and intra-residuals are then concatenated:

F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),1

yielding a F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),2-dimensional residual representation per spatial location (Li et al., 3 Aug 2025).

4. Self-navigated Mamba and multi-view decoding

SNARM’s decoder is built around a Self-Navigated Mamba Module. The paper motivates the use of Mamba by citing its strong long-range modeling capacity and lower complexity than Transformers, while noting that naive application to dense anomaly localization is expensive because of the large number of spatial tokens (Li et al., 3 Aug 2025). The proposed Self-Navigated Mamba Block (SMB) uses the Waypoint Map to select a compact informative subset of tokens, performs directional scanning, and inserts a F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),3 convolution before each scan to enrich local context.

The four scan directions are left-to-right, right-to-left, top-down, and bottom-up. The SNMM stacks a feature embedding layer and two SMBs, producing four direction-aware feature maps:

F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),4

The paper’s interpretation is that residual properties determine which patches are worth scanning and where the Mamba path should emphasize computation; the image is therefore not read uniformly but navigated by residual saliency (Li et al., 3 Aug 2025).

To accommodate defects that vary in shape and scale, SNARM uses a Multi-View Decoder with multiple view-specific branches. Each directional feature F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),5 is processed by branch-specific atrous convolution,

F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),6

with dilation rates F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),7 (Li et al., 3 Aug 2025). A prediction head then outputs an anomaly map:

F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),8

This yields F=Concat(2Ll=1L/2Fl, 2Ll=L/2+1LFl),\mathbf{F} = \mathrm{Concat}\left(\frac{2}{L}\sum_{l=1}^{L/2}\mathbf{F}^l,\ \frac{2}{L}\sum_{l=L/2+1}^{L}\mathbf{F}^l\right),9 view-specific predictions, and inference averages all 16 outputs:

[f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),0

The stated rationale is improved robustness across scan directions, receptive-field scales, and defect shapes (Li et al., 3 Aug 2025).

5. Optimization, augmentation, and implementation

SNARM uses cyclic optimization to encourage diversity among view-specific branches. The procedure sequentially updates one branch at a time while freezing the others for [f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),1 steps, with [f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),2 in the reported setting (Li et al., 3 Aug 2025). Both the Residual Navigator and the MVD are supervised using Focal Loss. The total loss is given as

[f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),3

and the focal loss is

[f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),4

The reported settings are [f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),5 for the navigator loss and [f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),6 for the view-specific branches (Li et al., 3 Aug 2025).

Two feature augmentation strategies are also reported. First, top-[f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),7 feature averaging replaces the single nearest reference with the average of the top-[f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),8 nearest features,

[f1,f2,,fM]=Flatten(Up(F)),[\mathbf{f}_1, \mathbf{f}_2, \cdots, \mathbf{f}_M] = \mathrm{Flatten}(\mathrm{Up}(\mathbf{F})),9

with fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}0 (Li et al., 3 Aug 2025). Second, consistent feature jittering adds a shared Gaussian perturbation consistently to both the feature and residual:

fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}1

where fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}2 and fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}3 (Li et al., 3 Aug 2025).

The default implementation uses ViT-Base/14 with DINOv2-R weights, intermediate outputs from transformer blocks 1–8, input resize fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}4, center crop fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}5, coreset size fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}6, percentile fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}7, top-fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}8 value fiRdf\mathbf{f}_i \in \mathbb{R}^{d_f}9, training cycles B\mathcal{B}0, Adam, learning rate B\mathcal{B}1, and weight decay B\mathcal{B}2 (Li et al., 3 Aug 2025). The reported hardware is an Intel i5-13450 CPU, 64 GB RAM, and an NVIDIA RTX 4090 GPU.

6. Benchmarks, results, and ablations

SNARM is evaluated on MVTec AD, MVTec 3D AD, and VisA using Image-AUROC, Pixel-AUROC, PRO, and Average Precision (Li et al., 3 Aug 2025). The abstract states that the method achieves state-of-the-art performance with notable improvements in all metrics, including Image-AUROC, Pixel-AURC, PRO, and AP; the detailed experimental section in the provided summary specifies that the paper reports Pixel-AUROC rather than Pixel-AURC. This discrepancy is best read as a terminology inconsistency between the abstract summary and the benchmark description, not as a difference in the underlying evaluation protocol.

In the multi-class setting, the reported results for SNARM with B\mathcal{B}3 are 79.0 P-AP / 96.6 PRO / 99.1 P-AUROC / 99.4 I-AUROC on MVTec AD, 63.6 / 97.4 / 99.2 / 93.9 on MVTec 3D, and 55.8 / 94.7 / 99.1 / 98.1 on VisA (Li et al., 3 Aug 2025). The paper reports improvements over prior best methods of +1.9 AP, +1.7 PRO, and +0.6 P-AUROC on MVTec AD; +7.7 / +0.4 / +0.0 / +1.3 on MVTec 3D; and +2.6 / +0.2 / +10.2 on the reported VisA metrics, together with strong competitiveness on image-level metrics (Li et al., 3 Aug 2025).

In the cross-class setting, SNARM reports 78.4 / 96.1 / 99.0 / 99.3 on MVTec AD, 68.9 / 97.3 / 99.1 / 94.5 on MVTec 3D, and 56.0 / 93.8 / 99.1 / 98.0 on VisA, with improvements over previous best methods of 10.4 / 0.3 / 0.4 / 0.1, 31.2 / 2.5 / 0.7 / 11.1, and 16.5 / 4.7 / 1.3 / 7.6 respectively (Li et al., 3 Aug 2025). In the single-class setting, the reported values are 79.2 / 96.6 / 99.0 / 99.3 on MVTec AD, 65.5 / 97.2 / 99.2 / 94.0 on MVTec 3D, and 55.4 / 92.3 / 99.0 / 98.0 on VisA. In the 4-shot few-shot setting, SNARM reports 68.6 / 94.6 / 97.9 / 98.3 on MVTec AD, with gains of +2.7 / +1.7 / +0.9 / +0.7 over the prior best, and 49.5 / 92.9 / 98.1 / 94.5 for one key comparison on VisA (Li et al., 3 Aug 2025).

A concise summary of the headline results is as follows.

Setting Benchmark Reported SNARM results
Multi-class MVTec AD 79.0 / 96.6 / 99.1 / 99.4
Multi-class MVTec 3D 63.6 / 97.4 / 99.2 / 93.9
Multi-class VisA 55.8 / 94.7 / 99.1 / 98.1
Cross-class MVTec AD 78.4 / 96.1 / 99.0 / 99.3
Cross-class MVTec 3D 68.9 / 97.3 / 99.1 / 94.5
Cross-class VisA 56.0 / 93.8 / 99.1 / 98.0
Single-class MVTec AD 79.2 / 96.6 / 99.0 / 99.3
Single-class MVTec 3D 65.5 / 97.2 / 99.2 / 94.0
Single-class VisA 55.4 / 92.3 / 99.0 / 98.0
4-shot few-shot MVTec AD 68.6 / 94.6 / 97.9 / 98.3

The paper also reports an efficiency profile of 92.7 mAD, 69 GFLOPs, 68.3M parameters, and 48 FPS, and characterizes this as a favorable trade-off versus heavier alternatives such as INP-Former and Dinomaly (Li et al., 3 Aug 2025). It further emphasizes that performance remains strong even with a compact memory bank.

The ablation study is presented as a progressive accumulation of components: a base model with inter-residuals and vanilla Mamba; addition of Hybrid-Matching; addition of SMB; addition of MVD; addition of Top-B\mathcal{B}4 averaging; addition of Jitter; addition of Cyclic Training; and finally all modules plus CT, which yields the best result (Li et al., 3 Aug 2025). The reported interpretation is that self-referential residual refinement and navigation-aware decoding are both essential.

7. Conceptual significance and scope

The paper summarizes SNARM’s contributions in four parts: Hybrid Matching through inter- and intra-residuals; Self-Navigated Mamba through residual-aware dynamic token navigation and efficient directional scanning; multi-view or multi-scale ensemble decoding via four directional branches and four dilation rates; and strong universal AD performance across MVTec AD, MVTec 3D, and VisA in single-class, multi-class, cross-class, and few-shot settings (Li et al., 3 Aug 2025).

The conceptual significance of SNARM lies in the interaction among these parts. Residual refinement supplies complementary signals: global deviation from training normality and local self-referenced refinement. Residual-guided navigation then determines which spatial tokens are emphasized by sequence modeling. Multi-view ensemble decoding aggregates predictions across direction and scale. This suggests that SNARM is designed not merely to score anomalies, but to transform residual structure into a control signal for representation learning and localization.

A common simplification would be to describe SNARM as only a memory-bank nearest-neighbor method or only a Mamba-based decoder. The paper argues against both reductions. It does not stop at inter-image matching, because the second residual stage derives references from the test image itself. It is also not a uniform dense Mamba scan, because the Waypoint Map guides token selection and directional traversal (Li et al., 3 Aug 2025). Within the scope of the reported evidence, SNARM is therefore best understood as a universal industrial anomaly detection framework organized around self-referential residual learning and residual-aware state-space decoding.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Self-Navigated Residual Mamba (SNARM).