Table of Contents
Fetching ...

Interpretable Logical Anomaly Classification via Constraint Decomposition and Instruction Fine-Tuning

Xufei Zhang, Xinjiao Zhou, Ziling Deng, Dongdong Geng, Jianxiong Wang

TL;DR

The work tackles industrial logical anomalies by elevating detection to Logical Anomaly Classification (LAC), which identifies both the presence and the specific violation category. It introduces LogiCls, a compact vision-language framework that decomposes high-level logical constraints into atomic, verifiable subqueries and trains with fine-grained Chain-of-Thought data and targeted augmentations. A difficulty-aware resampling strategy prioritizes hard subqueries to improve performance on long-tail constraint types. On MVTec LOCO FC, LogiCls with small-scale VLMs achieves strong accuracy and provides interpretable reasoning trails, demonstrating improved robustness and practicality for quality assurance in constrained industrial settings. The approach highlights the value of constraint decomposition and data-centric instruction tuning for interpretable visual reasoning under data scarcity.

Abstract

Logical anomalies are violations of predefined constraints on object quantity, spatial layout, and compositional relationships in industrial images. While prior work largely treats anomaly detection as a binary decision, such formulations cannot indicate which logical rule is broken and therefore offer limited value for quality assurance. We introduce Logical Anomaly Classification (LAC), a task that unifies anomaly detection and fine-grained violation classification in a single inference step. To tackle LAC, we propose LogiCls, a vision-language framework that decomposes complex logical constraints into a sequence of verifiable subqueries. We further present a data-centric instruction synthesis pipeline that generates chain-of-thought (CoT) supervision for these subqueries, coupling precise grounding annotations with diverse image-text augmentations to adapt vision language models (VLMs) to logic-sensitive reasoning. Training is stabilized by a difficulty-aware resampling strategy that emphasizes challenging subqueries and long tail constraint types. Extensive experiments demonstrate that LogiCls delivers robust, interpretable, and accurate industrial logical anomaly classification, providing both the predicted violation categories and their evidence trails.

Interpretable Logical Anomaly Classification via Constraint Decomposition and Instruction Fine-Tuning

TL;DR

The work tackles industrial logical anomalies by elevating detection to Logical Anomaly Classification (LAC), which identifies both the presence and the specific violation category. It introduces LogiCls, a compact vision-language framework that decomposes high-level logical constraints into atomic, verifiable subqueries and trains with fine-grained Chain-of-Thought data and targeted augmentations. A difficulty-aware resampling strategy prioritizes hard subqueries to improve performance on long-tail constraint types. On MVTec LOCO FC, LogiCls with small-scale VLMs achieves strong accuracy and provides interpretable reasoning trails, demonstrating improved robustness and practicality for quality assurance in constrained industrial settings. The approach highlights the value of constraint decomposition and data-centric instruction tuning for interpretable visual reasoning under data scarcity.

Abstract

Logical anomalies are violations of predefined constraints on object quantity, spatial layout, and compositional relationships in industrial images. While prior work largely treats anomaly detection as a binary decision, such formulations cannot indicate which logical rule is broken and therefore offer limited value for quality assurance. We introduce Logical Anomaly Classification (LAC), a task that unifies anomaly detection and fine-grained violation classification in a single inference step. To tackle LAC, we propose LogiCls, a vision-language framework that decomposes complex logical constraints into a sequence of verifiable subqueries. We further present a data-centric instruction synthesis pipeline that generates chain-of-thought (CoT) supervision for these subqueries, coupling precise grounding annotations with diverse image-text augmentations to adapt vision language models (VLMs) to logic-sensitive reasoning. Training is stabilized by a difficulty-aware resampling strategy that emphasizes challenging subqueries and long tail constraint types. Extensive experiments demonstrate that LogiCls delivers robust, interpretable, and accurate industrial logical anomaly classification, providing both the predicted violation categories and their evidence trails.
Paper Structure (12 sections, 5 equations, 4 figures, 3 tables)

This paper contains 12 sections, 5 equations, 4 figures, 3 tables.

Figures (4)

  • Figure 1: Comparison of different approaches to logical anomalies. Existing methods typically output an anomaly score or a normal abnormal binary decision, whereas our setting aims to explicitly identify normal samples and classify specific logical violation types.
  • Figure 2: Overview of the proposed LogiCls framework. The method first decomposes complex logical constraints into atomic subqueries. Then, an instruction dataset is constructed through image annotation, fine-grained reasoning templates, and data augmentation. During training, a difficulty-aware resampling strategy dynamically adjusts sampling probabilities. Finally, a fine-tuned model performs inference by aggregating subquery outputs for accurate logical anomaly classification.
  • Figure 3: Illustration of ICL. The content inside the brackets will be replaced with real samples during the experiments.
  • Figure 4: A comparison with VLMs on the decomposed subqueries. Correct answers are in green and incorrect answers are in red.