Source-linked AI summary

LogicAD: Explainable Anomaly Detection via VLM-based Text Feature Extraction

Er Jin, Qihui Feng, Yongli Mou, Stefan Decker, Gerhard Lakemeyer, Oliver Simons, Johannes Stegmaier

arXiv:2501.01767v2cs.CV

TL;DR

Logical anomalies involve relationships that can extend beyond localized defects, yet AVLMs had not been explored for logical anomaly detection. LogicAD combines AVLM-derived text features with format embedding and a logic reasoner. On MVTec LOCO AD, it reports gains over the few-shot state-of-the-art AnomalyMoE of 18.1% in AUROC and 4.6% in F1-max score, alongside anomaly explanations.

  • Problem

    Logical anomalies involve nonlocalized relationships, but AVLM use for logical anomaly detection remained underexplored.

    Source: Introduction · pp. 1–2
  • Method

    LogicAD uses AVLM-extracted text features with format embedding and a theorem-prover-backed logic reasoner to detect anomalies and explain them.

    Source: LogicAD · p. 3, Logic Reasoner · p. 5, Conclusion · p. 7
  • Results

    LogicAD increases AUROC by 18.1% and F1-max score by 4.6% over the few-shot state-of-the-art AnomalyMoE on MVTec LOCO AD.

    Source: Results · p. 6
  • Takeaways & Limitations

    LogicAD demonstrates that AVLM-derived text features can be effective for one-shot logical anomaly detection and provide corresponding explanations.

    Source: Conclusion · p. 7

    Different AVLMs produce inconsistent results, inference averages a few seconds per image, and prompts still require minor manual input.

    Source: Limitations · p. 7

Abstract

from arXiv · show

Logical image understanding involves interpreting and reasoning about the relationships and consistency within an image's visual content. This capability is essential in applications such as industrial inspection, where logical anomaly detection is critical for maintaining high-quality standards and minimizing costly recalls. Previous research in anomaly detection (AD) has relied on prior knowledge for designing algorithms, which often requires extensive manual annotations, significant computing power, and large amounts of data for training. Autoregressive, multimodal Vision Language Models (AVLMs) offer a promising alternative due to their exceptional performance in visual reasoning across various domains. Despite this, their application to logical AD remains unexplored. In this work, we investigate using AVLMs for logical AD and demonstrate that they are well-suited to the task. Combining AVLMs with format embedding and a logic reasoner, we achieve SOTA performance on public benchmarks, MVTec LOCO AD, with an AUROC of 86.0% and F1-max of 83.7%, along with explanations of anomalies. This significantly outperforms the existing SOTA method by a large margin.

Introduction

Logical anomalies are relational and may appear across normal and abnormal objects, making them harder to detect than localized structural defects. LogicAD instead uses AVLM-derived text features for logical detection and reasoning without additional visual annotations.

Introduction

  • Logical anomalies such as missing objects and misplacements are not confined to one area, and some cues appear in both normal and abnormal objects.By contrast, structural anomalies are often localized defects observable in the abnormal object.Source: Introduction · p. 1
  • Figure 1 contrasts scratch-trained and visual-memory approaches with LogicAD’s AVLM text-feature route, which uses text prompts without additional visual annotations.The introduction reports that LogicAD surpasses the current state-of-the-art method by a large margin on multiple public datasets.Source: Figure 1 · p. 1, Introduction · p. 2
  • Full-shot memory-bank methods can detect structural anomalies effectively but struggle with logical anomalies; alternatives may require visual annotations or lack few-shot learning.Existing approaches also leave long-range global-feature understanding unresolved in few-shot logical anomaly detection.Source: Introduction · pp. 1–2
  • LogicAD uses AVLM-derived text features for one-shot logical anomaly detection, with a logic reasoner that generates explanations without manual or dynamic thresholding.The introduction presents text features and a theorem-prover-backed reasoner as the method’s central contributions.Source: Introduction · p. 2

Related Work

Prior logical anomaly detection methods use visual memories or reconstruction networks, while AVLM and formal-reasoning approaches offer complementary capabilities with practical trade-offs. LogicAD combines AVLM text features with format embedding and a logic reasoner.

LA in Industrial Images

  • Vision-memory and reconstruction methods address logical anomalies, but high-capacity reconstruction needs substantial data, while few-shot methods can depend on masks and multiple visual memory banks.GCAD uses global context and a local branch for structural anomalies; PSTD uses fully annotated masks and three vision-based memory banks.Source: Related Work · p. 2
  • AVLM-based task-code generation can add bias and computational cost, while fine-tuned vision-language approaches require synthesized anomalies and substantial resources.LogicAD is presented as a one-shot alternative that requires no fine-tuning.Source: Related Work · p. 2

Autoregressive, multimodal Vision Language Models (AVLMs)

  • AVLMs show strong image-understanding abilities but may hallucinate, and their quantitative and logical understanding declines as data complexity increases.Chain-of-Thought can partially mitigate hallucination, though its effectiveness in industrial anomaly detection remains unexplored.Source: Related Work · p. 2

Logic Reasoning

  • Neuro-symbolic systems translate natural-language problems into formal specifications for automated theorem provers, which can outperform in-context reasoning on complex logical relations.This prior work motivates combining AVLMs with formal methods for object relations and anomaly explanations.Source: Related Work · p. 2

LogicAD pipeline

  • LogicAD processes AVLM-extracted text features through format embedding for anomaly scoring and a logic reasoner that applies normal-data rules to classify and explain inputs.Figure 2 depicts the two modules as separate branches after text feature extraction.Source: Figure 2 · p. 3

LogicAD

LogicAD combines AVLM-generated logical descriptions, format embedding for anomaly scoring, and a logic reasoner for textual explanations. Its pipeline addresses prompt-based description quality, inconsistent AVLM outputs, and formal reasoning about normality.

LogicAD

  • LogicAD combines AVLM text feature extraction, format embedding for anomaly scoring, and a logic reasoner that explains observed anomalies.The text extraction stage aims to generate consistent logical descriptions; the reasoner converts summaries into formal specifications for logical reasoning.Source: LogicAD · p. 3, Logic Reasoner · p. 5
  • Guided CoT prompts ask AVLMs to inspect logical relationships; without specific location or numerical guides, models such as GPT-4o can produce logical hallucinations.The authors state that detailed, reusable prompts are easier in practice than methods requiring visual annotations.Source: Text Feature Extraction · p. 4
  • GPT-4o counting accuracy declines on homogeneous-object scenes, so LogicAD selects ROIs, generates three descriptions per region, and filters text embeddings with LOF.The filtered embedding space is used to randomly select corresponding text descriptions.Source: Text Feature Extraction · p. 4
  • The format embedding stage summarizes text into JSON and scores a query against a normal reference using one minus their normalized-embedding cosine similarity.The reference and query images are separately embedded before the cosine-similarity score is calculated.Source: Format Embedding · pp. 4–5
  • The reasoner uses an LLM to formalize image descriptions and normality rules; completion formulae address implicit counts and objects absent from descriptions.The normal specification can contain relational formulae, and the required normal specification and default values are supplied for each anomaly-detection class.Source: Logic Reasoner · p. 5
  • Prover9 labels an image abnormal when the hypotheses entail the negation of its formal description, then finds a minimal contradictory subset as an explanation.The hypotheses can include name equalities or inequalities, functional-predicate behavior, and domain-closure axioms.Source: Logic Reasoner · p. 5

Experiments and Results

Experiments evaluate training-free, one-shot LogicAD on MVTec LOCO AD and selected MVTec AD categories. Results show strong logical-anomaly performance, with additional evaluations of the logic reasoner, AVLM backbones, and structural anomalies.

Experimental setup

  • Experiments are training-free and use one training image, three AVLMs, MVTec LOCO AD, and selected MVTec AD categories, with F1-max and AUROC evaluation.The MVTec AD categories include screw, pill, toothbrush, capsule, and transistor.Source: Experiments and Results · p. 5, Dataset and Metrics · p. 6

Results

  • 18.1% in AUROC and 4.6% in F1-max over AnomalyMoE† on one-shot MVTec LOCO AD are the reported gains across all metrics.The comparison is against the SOTA few-shot VLM-based method.Source: Table 1 · p. 6, Results · p. 6
  • On MVTec AD logical-anomaly-related categories, LogicAD surpasses WinCLIP by 5.6%, outperforms VAND by 15%, and is comparable to AnomalyCLIP.These categories include capsule, transistor, and toothbrush; MVTec AD was not designed specifically to evaluate logical anomaly detection.Source: Results · p. 6, Table 2 · p. 6
  • The logic reasoner scores 83.3%, only 0.4% below format embedding, and adds explanations while eliminating manual or dynamic thresholding.With the logic reasoner, abnormal scores are 0 or 1, making AUROC inapplicable.Source: Table 3 · p. 6, Results · p. 7
  • LLaVA 1.5 and LLaVA 1.6 outperform the SOTA in AUROC, while LLaVA 1.6 is comparable to it in F1-max.LLaVA 1.5 performs worse in F1-max than the SOTA method.Source: Results · p. 7, Table 5 · p. 7
  • For structural anomalies, LogicAD is competitive with WinCLIP-based methods on MVTec AD; texture AUROC is 96.9%, versus 98.1% for WinCLIP and 98.7% for AnomalyCLIP.On MVTec LOCO AD, it outperforms one-shot WinCLIP and full-shot GCAD but is slightly below PatchCore and AST.Source: Results · p. 7, Table 6 · p. 7, Table 4 · p. 7

Limitations

The authors report variability across AVLMs, inference taking a few seconds per image on average, and minor manual prompt input as limitations.

Limitations

  • Results vary across different AVLMs.The paper also reports average inference time of a few seconds per image.Source: Limitations · p. 7
  • Inference averages a few seconds per image; proposed acceleration options are beyond this work's scope.The authors mention BitNet and AVLM pruning as possible optimizations.Source: Limitations · p. 7
  • Guided CoT prompts still need minor manual text input, but curated prompts can be reused and defined once per AD task.Source: Limitations · p. 7

Conclusion

LogicAD uses AVLM-extracted text with Guided CoT, ROI, and text formatting for one-shot logical anomaly detection. A theorem prover predicts anomalies with explanations; the authors identify automated prompting and reduced inference time as future directions.

Conclusion

  • The framework uses AVLM-extracted text, Guided CoT, ROI, and text formatting for one-shot logical anomaly detection.Source: Conclusion · p. 7
  • A theorem prover predicts logical anomalies with corresponding explanations.Source: Conclusion · p. 7
  • Future work aims to automate prompting and reduce inference time by fine-tuning and distilling AVLMs with logic-related data.Source: Conclusion · p. 7
Loading 2501.01767v2…