CoolFace
Modelpublic

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

sourceHugging Faceapache-2.0updated 9d agoView on Hugging Face
1likes44downloads
Model Card

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

This is a research-preview checkpoint and is NOT the thesis headline model. It is released for completeness alongside the AnomalyThink family. The headline model of the thesis is `aacudad/AnomalyThink-Qwen2.5-VL-7B-KCR` (DS-MVTec 82.80 / VisA 72.07), which is SFT only. The GRPO run below is discussed only as future work.

A reasoning-enhanced vision-language model for explainable industrial anomaly detection. It takes the Keep-Correct-Revise model as its starting point and then trains it further with GRPO, with the RL training prompt aligned to the evaluation prompt (KL penalty β = 0.1, 3 epochs, reward = accuracy + format). This is checkpoint-954 of that run.

What Keep-Correct-Revise (KCR) means

Keep-Correct-Revise (KCR) is the data recipe behind the model this run starts from. An SFT plus GRPO policy generates its own reasoning traces on Real-IAD images. Each trace is then kept when the verdict is correct, corrected by a teacher model when the verdict is wrong, and revised by a teacher model when the verdict is correct but the reasoning is only weakly grounded in the image. The base model is then fine-tuned from scratch on the curated 6,000-trace result. That fine-tune is the KCR model.

This model is one more GRPO stage stacked on top of that KCR model.

Why "future work" and not a result

GRPO on the already-strong KCR init edges the SFT ceiling on average but the trajectory bounces across epoch 3 rather than climbing monotonically, so the gain is small and not yet clearly stable. The thesis therefore reports the KCR SFT model as the headline and holds this run as future work. Do not read these numbers as "GRPO beat SFT".

Balanced accuracy (checkpoint-954)

Balanced accuracy BA = 0.5 * (TP/(TP+FN) + TN/(TN+FP)), recomputed from the raw tp/tn/fp/fn of each eval JSON (shipped in the code repo).

BenchmarkBAtptnfpfnn
DS-MVTec82.951004373712221670
VisA72.627198041404782141

Average 77.78, versus the KCR init's 77.44 (82.80 / 72.07).

The AnomalyThink Qwen family for context

ModelDS-MVTecVisANote
`…-7B-KCR`82.8072.07thesis headline
`…-7B-SFT`80.1664.78plain SFT baseline
`…-7B-SFT-GRPO`82.7370.39released RL model, the policy KCR rolls out from
this model (GRPO on KCR, ckpt-954)82.9572.62research preview / future work

Usage

python
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info

model_id = "aacudad/AnomalyThink-Qwen2.5-VL-7B-KCR-GRPO"
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
processor = AutoProcessor.from_pretrained(model_id)

messages = [{"role": "user", "content": [
    {"type": "image", "image": "file:///path/to/part.png"},
    {"type": "text", "text": "Is there a defect in this product? Analyze and answer yes or no."},
]}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
imgs, vids = process_vision_info(messages)
inputs = processor(text=[text], images=imgs, videos=vids, padding=True, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512)
print(processor.batch_decode(out[:, inputs.input_ids.shape[1]:], skip_special_tokens=True)[0])

Links

  • —Code, training/eval scripts, and the exact checkpoint-954 eval JSONs: https://github.com/aacudad/IAD-VLMs
  • —Dataset: https://huggingface.co/datasets/aacudad/AnomalyThink
  • —MSc thesis (TU Delft, 2026): Reasoning-Enhanced Vision-Language Models for Explainable Industrial Anomaly Detection, Adnane Acudad

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

Derived from Qwen2.5-VL-7B-Instruct (Apache-2.0). Evaluated on DS-MVTec and VisA (MMAD protocol), trained on AnomalyThink traces distilled from Gemini-2.5-Flash over Real-IAD.