Manuscript Offprint

arXiv:2608.29783

InspectorGPT: A Comparative Reasoning Enhanced VLM for Comprehensive Industrial Anomaly Detection

Weifei Chen, Honghao Zhang, Zhiyuan You, Xinyi Le

Abstract

Industrial anomaly detection is a critical component of modern manufacturing. Most traditional unsupervised methods rely on modelling normal feature distributions, inherently limiting generalization to unknown categories. To improve generalizability, some recent methods incorporate vision-language models (VLMs) for zero-shot detection via text prompts. However, we observe that reasoning-oriented post-training can cause anomaly discrimination to collapse, with some fine-tuned models performing worse than their base VLMs. Existing methods also provide only textual decisions or coarse boxes, without pixel-level segmentation. A more explicit detection principle comes from human inspection: anomalies are identified by comparing a query image with a defect-free reference. Inspired by this, we propose InspectorGPT, a VLM framework centered on comparative reasoning. Given a normal reference and a query image, InspectorGPT compares them to identify discrepancies and perform multiple inspection tasks with detailed reasoning. We internalize this capability through Chain-of-Thought (CoT) fine-tuning and Group Relative Policy Optimization (GRPO) with tailored, verifiable rewards. We further introduce InspectorGPT-Seg for pixel-level anomaly masks. Segmentation supervision improves anomaly discrimination but weakens semantic reasoning, while joint training fails to balance them. We therefore train the two branches separately and combine them through task-vector fusion. Extensive experiments demonstrate superior multi-dimensional performance and generalization to unseen benchmarks, validating comparative reasoning for comprehensive industrial inspection.

Introduction

Industrial Anomaly Detection (IAD) is a core component of manufacturing quality control, aiming to identify and localize image regions that deviate from normal patterns. As industrial production moves towards higher variety and faster iteration, anomaly detectors are increasingly required to transfer across categories. Traditional pure-vision methods (Defard et al. 2021; Yu et al. 2021; You et al. 2022) learn a normal distribution (e.g., the “one cell one pin” distribution in Figure 1) from defect-free samples and derive anomaly scores from feature distances (Roth et al. 2022; Cohen and Hoshen 2020). However, when product types change, normal prototypes for new types are unavailable without retraining. Their binary anomaly scores also lack semantic descriptions for defect identification and interpretable evidence.

To enhance generalization and interpretability, recent studies have adopted Vision-Language Models (VLMs) as backbone architectures for anomaly detection. CLIP-based approaches (Jeong et al. 2023; Cao et al. 2024; Qu et al. 2024) enable zero-shot detection via text prompts, but rely on accurate class definitions or hand-crafted priors. More recent methods (Gu et al. 2024; Li et al. 2025d; Xu et al. 2025) therefore turn to multimodal large language models (MLLMs), which produce fluent and interpretable explanations. To further align these models with anomaly inspection, several approaches post-train them on anomaly data using CoT supervision and reinforcement learning (Li et al. 2026; Chao et al. 2025; Liao et al. 2026; Kang et al. 2026). However, two critical issues remain. First, anomaly discrimination, the most fundamental capability of detection, can collapse after reasoning-oriented post-training: some fine-tuned models score even lower than their own base VLMs (Kang et al. 2026). This suggests that the model may learn dataset-dependent response patterns rather than a transferable detection principle. Second, localization outputs are often limited to text decisions or coarse bounding boxes. This granularity is insufficient for pixel-level defect delineation and quantitative assessment.

We hypothesize that the discrimination collapse occurs because the model is taught to imitate answers rather than to ground its decisions in concrete visual discrepancies. Human experts instead follow a simple principle: given a defect-free reference, they judge each region of the query image through comparison. Each judgment is thus anchored to an observable discrepancy. Such comparative reasoning provides an explicit detection principle that can transfer beyond category-specific appearances.

Inspired by human perception, we propose InspectorGPT, a comparative-reasoning-enhanced framework. Our InspectorGPT elevates a general-purpose VLM into an industrial expert by teaching it structured comparative reasoning. Specifically, it works with three processes. First, InspectorGPT takes a normal reference image as a template and compares the query image with the normal template (Figure 1, left). Then, as illustrated in the middle of Figure 1, it performs semantic-level comparisons and generates a structured Chain-of-Thought covering diverse inspection dimensions. Finally, based on the detailed reasoning results, InspectorGPT performs multiple tasks including anomaly

Figure

Figure 1: Multi-dimensional comparative reasoning in InspectorGPT. Given a normal reference image and a query image, our model performs structured comparative reasoning and generates a Chain-of-Thought covering diverse inspection dimensions (color-coded).

discrimination, detection, classification, segmentation, and so on (Figure 1, right). To empower InspectorGPT with these capabilities, we leverage Chain-of-Thought (CoT) fine-tuning alongside Group Relative Policy Optimization (GRPO) with tailored rewards. We introduce InspectorGPT-Seg, integrating a segmentation module to enhance its localization and segmentation abilities.

Interestingly, we observe that dense segmentation supervision substantially improves anomaly discrimination, but fails to fully preserve the semantic reasoning capability. Directly optimizing the reasoning and segmentation objectives in a single model also fails to balance the two capabilities. We therefore train the reasoning and segmentation branches separately from a shared SFT checkpoint and assemble them through task-vector fusion. This design preserves most of the semantic reasoning capability while recovering anomaly discrimination.

By anchoring its decisions to reference-conditioned discrepancies rather than a category-specific fixed normal prototype, InspectorGPT can generalize to unseen benchmarks without target-domain adaptation. The main contributions of this work are summarized as follows:

  • We propose InspectorGPT, a multimodal framework that trains a VLM to facilitate comparative reasoning for industrial inspection. Training combines CoT-style supervised fine-tuning and GRPO with task-specific rewards, prompting the model to internalize generalizable detection principles. The model supports interpretable outputs and strong transfer to novel categories without retraining.
  • We identify the discrimination collapse of reasoning-oriented post-training and address it with a staged training strategy combined with task vector fusion. We further introduce InspectorGPT-Seg, which couples a lightweight segmentation decoder to produce pixel-level anomaly masks instead of coarse boundaries.
  • Extensive experiments demonstrate superior multi-

dimensional performance and generalization to unseen benchmarks, outperforming existing commercial, open-source, and AD-specific models. These results validate comparative reasoning as a robust paradigm for comprehensive industrial inspection.

References (50)