acceptodds
Withdrawn from ICLR 2027

Beyond Feature Direction: Magnitude-Aware Matching of Patches and Spatial Contexts for Training-Free Anomaly Detection

Withdrawn from ICLR 2027, so left out of the paper lists and the map.

Abstract

In this paper, we introduce a training-free anomaly detection framework that exploits both feature magnitude and local spatial context in pretrained DINOv2 representations. Existing nearest-neighbor-based anomaly detection methods commonly rely on normalized patch features, emphasizing feature direction while leaving the magnitude information of the original representation largely unused. They also often compare individual patches independently, which can overlook anomalies that are better characterized by abnormal local spatial configurations. To address these limitations, we construct a magnitude-aware patch representation by combining the direction of the post-LayerNorm feature with the centered magnitude of its pre-LayerNorm counterpart. The magnitude is normalized using statistics from normal reference patches and softly incorporated through square-root scaling, preserving semantic direction while retaining relative feature strength. We further represent each patch together with its ordered neighborhood to capture local spatial configurations without introducing any learnable parameters. Separate normal memory banks are constructed for individual patches and spatial contexts, and anomaly scores are obtained through nearest-neighbor distances in the two representation spaces and combined at inference time. The proposed method requires neither additional training nor anomaly validation data and can be directly applied under few-shot normal-reference settings. Experiments on MVTec AD and VisA under 1-, 2-, and 4-shot settings demonstrate consistent gains over the AnomalyDINO baseline at both image and pixel levels. These results suggest that feature magnitude and spatial context provide complementary normality cues for training-free industrial anomaly detection.

Primary area:
applications to computer vision, audio, language, and other modalities
Keywords:
Training-Free Anomaly Detection, Vision Foundation Model, Few-Shot Anomaly Detection

Reviews

Among:
Shape:
1234this paper, Bottom 2%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 1.33 over 3 reviews, above 2% of the others.
Reviewer_DHYUOpenReview ↗
Rating
1
Confidence
4
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This work proposes a training-free anomaly detection method that adds pre-LayerNorm feature magnitude and ordered local neighborhoods to DINOv2 patch matching. Combining patch and context distances improves detection and localization over AnomalyDINO on MVTec AD and VisA across 1-, 2-, and 4-shot settings.

Critical strengths
  1. The paper identifies two pieces of information that normalized, independent patch matching leaves out: feature magnitude and neighboring spatial structure. Both identifies can be added without training the backbone or introducing learnable parameters, making the method easy to build on.

  2. The authors compare methods using identical references, repeat evaluation with randomly sampled references, and include an all-Euclidean ablation to separate magnitude gains from a change in distance metric. These checks make the improvements over AnomalyDINO more convincing.

Critical weaknesses
  1. All experiments use DINOv2-S/14 on two datasets. The observation that anomalous patches have higher average magnitude is interesting, but it does not establish whether this cue remains reliable with other backbones or normal changes in lighting, contrast, and image quality.

2 The context experiments compare neighborhood sizes, but do not compare ordered concatenation with average pooling or an order-invariant alternative. Context alone also slightly hurts VisA localization, while the full method increases inference time by 1.25–1.67×. More evidence is needed to show when this added complexity pays off.

3 This work moves quickly into equations without clearly explaining the motivation for the design choices or what each component is meant to achieve.

Questions for authors

1 Does the magnitude benefit hold for larger DINOv2 models and models with register tokens? How does it compare with directly matching unnormalized pre-LayerNorm features?

2 How sensitive is the method to benign lighting, contrast, rotation, or alignment changes? Could these produce high anomaly scores even when the object is normal?

3 Could you please compare ordered context matching with neighborhood average pooling and an order-invariant matching alternative? This would help establish whether spatial arrangement itself drives the gain.

4 How does context-bank memory usage scale with the number of references, and can dimensionality reduction or bank subsampling retain the gains while reducing the reported inference overhead?

Reviewer_oiycOpenReview ↗
Rating
1
Confidence
3
Informativeness
1
Presentation
3
Soundness
2
Read review
Paper summary

This paper studies training-free few-shot industrial anomaly detection based on frozen DINOv2 features. The authors argue that conventional normalized patch matching discards potentially useful feature-magnitude information and treats patches independently without modeling their local spatial configurations. To address these limitations, the paper proposes a magnitude-aware patch representation that combines post-LayerNorm feature direction with relative pre-LayerNorm magnitude, together with an ordered local-context representation constructed from 3×33\times3 neighboring patches. Patch-level and context-level nearest-neighbor distances to normal reference memory banks are then combined to produce anomaly scores, without additional training or learnable parameters. Experiments on MVTec AD and VisA under 1-, 2-, and 4-shot settings show consistent improvements over AnomalyDINO, and additional ablations suggest that magnitude and local context provide complementary anomaly cues.

Critical strengths
  1. The paper identifies a simple but interesting anomaly cue that is discarded by conventional normalized feature matching. The analysis of pre-LayerNorm feature magnitude is one of the strongest aspects of the paper. The authors show that anomalous patches have higher average relative magnitude across all evaluated MVTec AD and VisA categories, and controlled ablations indicate that the gain is not merely caused by switching from cosine to Euclidean distance. This provides meaningful empirical support for the central observation.

  2. The method remains simple and fully training-free while producing consistent improvements. The method keeps DINOv2 frozen, introduces no learnable parameters, and only modifies the representation and matching stages. The improvements over AnomalyDINO are consistent across two datasets, multiple shot settings, and randomly sampled reference sets, making the approach practically attractive.

Critical weaknesses
  1. The methodological novelty appears limited. The overall framework remains close to the existing frozen-DINOv2 nearest-neighbor paradigm. The main modifications are a scalar rescaling of normalized patch features using pre-LayerNorm magnitude and direct concatenation of a 3×33\times3 neighborhood for context matching. In particular, exploiting local neighborhoods to preserve spatial information has already been explored in prior patch-based anomaly detection methods such as PatchCore. Therefore, while the magnitude observation is interesting, the methodological advance appears incremental for ICLR.

The comparison with prior methods is not sufficiently fair or controlled. In the 1-, 2-, and 4-shot setting, performance can depend substantially on which normal reference images are selected. However, Table 1 directly takes baseline results from the corresponding papers rather than re-running them using exactly the same reference sets as the proposed method. This is particularly problematic because the paper itself demonstrates non-negligible variability across different reference selections. For a fair comparison, the main competing training-free few-shot methods should be re-evaluated using the same backbone/configuration where applicable and, most importantly, exactly the same 1-, 2-, and 4-shot reference sets.

Questions for authors

See weaknesses.

Reviewer_M4qZOpenReview ↗
Rating
2
Confidence
4
Informativeness
2
Presentation
3
Soundness
2
Read review
Paper summary

The paper modifies AnomalyDINO for training-free few-shot anomaly detection with a frozen DINOv2-S/14. Each patch descriptor keeps the post-LayerNorm direction and is rescaled by (r/m)0.5(r/m)^{0.5}, where rr is the centered pre-LayerNorm norm and mm its median over the reference patches, and matching uses Euclidean distance. A second memory bank stores ordered 3×33\times3 concatenations of these descriptors, and the final score averages the patch-level and context-level nearest-neighbor distances. On MVTec AD and VisA with 1, 2 and 4 shots the method improves over AnomalyDINO, for example from 96.65 to 97.25 image AUROC on MVTec AD and from 87.43 to 89.76 on VisA at 1 shot.

Critical strengths
  1. The method is simple, training-free and easy to add to an existing pipeline. The observation that the pre-LayerNorm norm is larger on anomalous patches in all 27 categories (Fig. 3) is a useful diagnostic.
  2. The evaluation is careful about variance. It uses paired comparisons over fixed and random reference sets, an all-Euclidean control for the change of metric, and runtime measurements.
Critical weaknesses
  1. The contribution is small. Aggregating each patch with its 3×33\times3 neighborhood is already part of PatchCore (cited), and replacing the average with an ordered concatenation is a minor variant that the paper does not compare against. Adding magnitude moves the matching back toward the unnormalized Euclidean matching that PatchCore uses, but there is no plain Euclidean baseline on raw DINOv2 features; the only magnitude comparison is post-LN vs. pre-LN (Fig. 4c). The pre-LN norm rr equals D\sqrt{D} times the token standard deviation that the final LayerNorm divides out, so the "magnitude" is the LayerNorm scale statistic. It would help to say this and relate it to high-norm tokens (Darcet et al., 2024), for example by testing DINOv2 with registers.

  2. The gains are small, and the main comparison is not clean.

  • On MVTec AD, the paired image AUROC gains over five random reference sets are +0.38±0.43+0.38 \pm 0.43, +0.41±0.28+0.41 \pm 0.28 and +0.28±0.15+0.28 \pm 0.15 for 1, 2 and 4 shots (Table 5). The 1-shot gain is not distinguishable from zero (one-sample tt-test, p≈0.12p \approx 0.12). Pixel AUROC gains on VisA are 0.04 to 0.14 points.
  • The Table 1 caption says baseline results are taken from the original papers, but the SubspaceAD row (listed as DINOv2-S) does not match the SubspaceAD paper. That paper reports 97.1 / 98.6 / 97.5 / 94.5 on MVTec AD and 93.2 / 93.0 / 98.2 / 95.5 on VisA at 1 shot (DINOv2-G, 672 px). That is better than the proposed method on 7 of the 8 metrics, and by 3.4 image AUROC on VisA. If the row is a re-run with ViT-S, it should say so. Either way, the claim of the best results on all metrics depends on this choice, and the table mixes backbones anyway (PatchEAD+ uses DINOv2-B).
  • Only DINOv2-S is evaluated. Since the method is training-free and should work with any backbone, results with DINOv2-B/L/G are needed to show that the magnitude and context cues still help when the baseline is stronger.
  1. Design choices are selected on the test sets. Fig. 4 chooses the magnitude source, α\alpha, ww and the context size from image AUROC and PRO measured on the MVTec AD and VisA test sets, with the same reference sets as the main results. This does not fit the statement that no anomalous samples are used for parameter selection. With MVTec AD gains of a few tenths of a point, this selection matters.

  2. The evaluation is limited. Only MVTec AD and VisA are used, and both are close to saturation in this setting (97 to 98 image AUROC on MVTec AD). A harder benchmark (e.g., MVTec AD 2, Real-IAD or MPDD) would show whether the cues generalize. The ordered concatenation is not rotation-invariant, and the only two MVTec AD classes where image AUROC drops are capsule (90.2 to 89.4) and screw (93.2 to 92.8), both of which appear in varying orientations. The context bank stores vectors 9 times longer than patch features (9×3849 \times 384), runtime grows by 1.25×1.25\times to 1.67×1.67\times (Table 7), and memory use is not reported.

  3. Minor: the main ablation (Table 2) mixes cosine and Euclidean distances, and the all-Euclidean control is only in the appendix. The examples in Fig. 1 are anecdotal, and code is only promised for later.

Questions for authors
  1. How does the method compare with PatchCore-style 3×33\times3 average-pooled aggregation, and with plain Euclidean matching on raw DINOv2 features?
  2. Where do the SubspaceAD numbers in Table 1 come from?
  3. Do the gains hold with DINOv2-B/L/G, and with DINOv2 with registers?
  4. How were α\alpha, ww, the magnitude source and the context size chosen, and what happens if they are fixed without looking at test performance?
  5. Can you add results on at least one harder benchmark?

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Discussion (0)

Sign in to comment.