CoolFace
Modelpublic

aacudad/AnomalyThink-Qwen2.5-VL-7B-KCR

sourceHugging Faceapache-2.0updated 8d agoView on Hugging Face
1likes34downloads
Model Card

AnomalyThink-Qwen2.5-VL-7B-KCR

The single best detector in the thesis (DS-MVTec 82.80 / VisA 72.07). Supervised fine-tuning only, no reinforcement-learning stage on top.

A Qwen2.5-VL-7B model fine-tuned for explainable industrial anomaly detection (IAD). Given a product image it produces a structured reasoning trace (<think>), a defect <location> and <type> (for anomalies), and a binary <answer>. Research artefact from the MSc thesis Reasoning-Enhanced Vision-Language Models for Explainable Industrial Anomaly Detection (TU Delft, 2026).

What Keep-Correct-Revise (KCR) means

Keep-Correct-Revise (KCR) is the data recipe this model is named after. It works in four steps:

  1. 1.An SFT plus GRPO policy generates its own reasoning traces on Real-IAD images.
  2. 2.A trace is kept when the policy got the verdict right and the reasoning holds up.
  3. 3.A trace is corrected by a teacher model when the verdict is wrong.
  4. 4.A trace is revised by a teacher model when the verdict is right but the reasoning is only weakly grounded in the image.

The curated traces are then used to fine-tune the base model again from scratch. So the policy supplies the raw material, the teacher only repairs what is broken or poorly grounded, and the final model is a fresh fine-tune of Qwen2.5-VL-7B on the result.

Results (MMAD subsets, balanced accuracy)

BenchmarkBalanced accuracy
DS-MVTec (1,670)82.80%
VisA (2,141)72.07%

Evaluated under a single common harness on the MMAD DS-MVTec and VisA subsets. It exceeds the released IAD-R1 checkpoint on both benchmarks under this harness, using supervised fine-tuning alone.

Training

Supervised fine-tuning from the Qwen2.5-VL-7B base on the curated KCR corpus. 6,000 balanced traces, 50/50 defect and non-defect, vision encoder frozen. No reinforcement-learning stage is used.

The traces that the teacher writes or repairs come from Gemini 2.5-Flash, on Real-IAD images. Training data: aacudad/AnomalyThink (folder iter2).

The AnomalyThink Qwen family

ModelDS-MVTecVisANote
`…-7B-KCR`82.8072.07this model, thesis headline
`…-7B-SFT`80.1664.78plain SFT baseline
`…-7B-SFT-GRPO`82.7370.39SFT then GRPO, the policy KCR rolls out from
`…-7B-KCR-GRPO`82.9572.62research preview, not a thesis result

Usage

python
import torch
from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
model_id = "aacudad/AnomalyThink-Qwen2.5-VL-7B-KCR"
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
processor = AutoProcessor.from_pretrained(model_id)
# Build the structured single-image IAD prompt + image, then generate.

Intended use and limitations

Research on explainable IAD. Known limitations: the model can confidently hallucinate a defect on a normal part (false positive), and GRPO-lineage variants can over-predict the "Missing Parts" type. As the public DS-MVTec/VisA images may appear in VLM pretraining, absolute numbers should be read with that caveat.

Citation

bibtex
@mastersthesis{acudad2026reasoning,
  author  = {Acudad, A.},
  title   = {Reasoning-Enhanced Vision-Language Models for Explainable Industrial Anomaly Detection},
  school  = {Delft University of Technology},
  year    = {2026},
  type    = {Master's thesis},
  url     = {https://resolver.tudelft.nl/uuid:65c62420-79c0-447f-b095-7fb11d4474fc}
}

Thesis: <https://resolver.tudelft.nl/uuid:65c62420-79c0-447f-b095-7fb11d4474fc>. Code and evaluation files: <https://github.com/aacudad/IAD-VLMs>.

License

Apache-2.0 (inherits the Qwen2.5-VL-7B base). Trained on Real-IAD (cite Real-IAD separately, images are not redistributed) with traces distilled from Gemini 2.5-Flash.