Reasoning-Driven Anomaly Detection and Localization with Image-Level Supervision

Yizhou Jin, Yuezhu Feng, Jinjin Zhang, Peng Wang, Qingjie Liu, Yunhong WangarXiv 2026

TL;DR

This paper introduces a framework that enables Multimodal Large Language Models (MLLMs) to perform both anomaly detection and pixel-level defect localization using only image-level labels (normal vs. abnormal). By extracting and aligning anomaly-specific reasoning tokens with visual attention via reinforcement learning, the method eliminates the need for expensive pixel-wise masks or external vision modules.

What Problem Does This Paper Address?

In industrial manufacturing, identifying and locating defects (Industrial Anomaly Detection or IAD) is critical for quality control. While Multimodal Large Language Models (MLLMs) excel at high-level reasoning and stating if an anomaly exists, they traditionally struggle to pinpoint where it is at a pixel level.

To get pixel-level localization, existing approaches either rely on costly, dense pixel-level annotations or patch together complex pipelines using external vision experts like the Segment Anything Model (SAM). These multi-stage designs suffer from error propagation, misalignment between textual reasoning and visual focus, and high deployment complexity.

The authors address this gap by asking: Can we unlock an MLLM's intrinsic attention mechanism to localize defects directly, using only cheap, image-level supervision?

Methods

The authors propose a training framework built on top of an open-source MLLM (Qwen2.5-VL) consisting of two core components:

  1. Reasoning-Driven Anomaly Localization (ReAL): During the model's autoregressive text generation, it produces a chain-of-thought explanation. ReAL filters out the most relevant tokens from this process based on two metrics:
  2. Inter-modality semantic relevance ($S_T$): How strongly a token attends to anomaly-related words in the prompt (e.g., "defect", "scratch").
  3. Intra-modality attention concentration ($S_I$): The spatial entropy of the token's visual attention map. Lower entropy means the token is focusing tightly on a specific image region rather than diffusing across the whole scene.

The visual attention maps of these highly localized, semantically relevant tokens are then aggregated into a final pixel-level anomaly map.

  1. Consistency-Guided Reasoning Optimization (CGRO): Under weak supervision, MLLMs often suffer from hallucinations or contradictions (e.g., correctly answering "Yes, there is a defect" while its internal attention maps are scattered randomly). CGRO uses reinforcement learning (specifically a group-based policy optimization variant) to enforce a class-conditional consistency reward. For anomalous images, it rewards high spatial consensus (measured via the Jaccard Index) among key reasoning tokens. For normal images, it rewards low consensus, forcing the model to ground its textual arguments in visual evidence.
Figure 2. Overview of the proposed reasoning-driven anomaly detection framework. Given an input image, the MLLM generates a reasoning process and a final anomaly answer. The ReAL module selects anomaly-related tokens based on semantic relevance ST and spatial entropy SI, then aggregates their visual attentions to obtain a pixel-level anomaly map. During training, these selected tokens are further used by the CGRO module to leverage reinforcement learning jointly driven by a reasoning–localization consistency reward and R1-based accuracy and format rewards, enabling the model to align reasoning tokens with their corresponding visual attentions while simultaneously improving reasoning correctness, structural quality, and anomaly localization accuracy.

Datasets

  • Training: A curated dataset of 4,000 industrial images with weak image-level labels (normal/anomaly) aggregated from public benchmarks: VisA, GoodsAD, Vision, PR-REAL, Real-IAD, and BSData.
  • Evaluation: Zero-shot evaluation across four distinct benchmarks to test generalization: MVTec-AD, WFDD, SDD, and DTD.
  • New Benchmark: The authors introduce MVTec-COT, a dataset pairing MVTec-AD test images with expert-verified ground-truth anomaly descriptions to quantitatively evaluate the quality and accuracy of the model's textual reasoning using SBERT and ROUGE-L scores.

Key Insights and Ideas

  • The Hidden Map in the Text: Only a tiny fraction of reasoning tokens (like "scratch" or "mark") hold precise spatial cues. As shown in the paper's analysis, averaging all tokens dilutes localization accuracy, but filtering by semantic relevance and spatial concentration unlocks sharp localization maps without any explicit pixel training.
Figure 1. Visualization of token-to-patch attention maps for cer- tain reasoning tokens. Only a small subset of tokens (highlighted in red) exhibits focused attention on the true anomaly regions (red boxes), and these tokens are also semantically related to anomaly concepts (e.g., “scratch”, “mark”).
  • Self-Correction via RL Consistency: Instead of feeding the model dense masks, you can teach it where to look by rewarding internal consistency. If the model's text output claims a defect is present, its internal attention maps for those descriptive tokens must tightly overlap on the image.

Key Results

  • Competitive with Dense Supervision: Despite using zero pixel-level masks during training, the full 7B model variant achieved a pixel-level Area Under the ROC Curve (AUROC) of 80.7% and an Accuracy (ACC) of 97.1%, performing on par with MLLM methods that require dense pixel supervision.
  • Superior Interpretability: The model achieved the highest reasoning scores on the new MVTec-COT benchmark compared to all baselines (including commercial models like GPT-4o), proving its explanations are highly aligned with actual visual defects.
  • Ablation Validation: Combining both spatial entropy ($S_I$) and semantic relevance ($S_T$) filters yielded significantly cleaner and more accurate anomaly maps than using either filter alone.
Figure 4. Visualization of different token selection used in ReAL. Each column shows anomaly maps generated by: (a) keeping all tokens (b) filtering with spatial entropy SI, (c) filtering with se- mantic relevance ST, (d) combining both scores with weighted ag- gregation. ST measures semantic alignment with anomaly-related concepts, while SI measures attention concentration. Methods that incorporate both criteria yield more accurate anomaly maps.

Limitations and Future Work

  • Boundary Fidelity: A performance gap still remains compared to fully supervised pixel-level methods, particularly regarding sharp defect boundaries and highly complex textures.
  • Multi-Spot Scenarios: The model occasionally suffers from missed detections when an image contains multiple separate defect spots.
  • Inference Latency: Because the localization relies on the autoregressive decoding of an MLLM backbone, inference is inherently slower than conventional, specialized industrial vision pipelines, posing a challenge for real-time deployment on fast production lines.

Summary updated

BibTeX
@misc{jin2026reasoning,
  author = {Yizhou Jin and Yuezhu Feng and Jinjin Zhang and Peng Wang and Qingjie Liu and Yunhong Wang},
  title = {{Reasoning-Driven Anomaly Detection and Localization with Image-Level Supervision}},
  year = {2026},
  eprint = {2603.27179},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.27179},
}
Figure