Beyond Common Sense: Grounding Logical Anomaly Detection in Inspection Criteria¶
Conference: ECCV 2026
Official Paper: 4468
Paper: Official PDF
Code: https://github.com/tzjtatata/SCAN
Area: Anomaly Detection
Keywords: logical anomaly detection, inspection criteria, vision-language models, rule-level rewards, credit assignment
TL;DR¶
SCAN turns industrial logical anomaly detection into explicit rule-by-rule visual inspection, combining FLAW training data, structured supervised fine-tuning, and rule-level reinforcement learning to raise an 8B model's strict scoring accuracy on MVTec-LOCO from 56.73% to 64.58%, while leaving substantial missed-detection concerns.
Background & Motivation¶
An industrial anomaly need not look damaged: intact components can still have the wrong count, type, or arrangement for the current manufacturing stage. A general vision-language model (VLM) may recognize a plausible product without knowing the particular factory's acceptance criteria. A capped bottle, for example, looks perfectly ordinary, yet its cap could violate a requirement at an inspection point before capping. Judging from pretrained common sense therefore substitutes general product knowledge for the actual operational standard.
Most existing anomaly data emphasize visible structural defects rather than this rule-dependent boundary between acceptable and unacceptable products. Providing rules and training sequential explanations does not automatically solve the problem: a model may repeat the expected count in the rule as if it had observed that count in the image, especially late in a long response. A reward based only on the final anomaly label cannot distinguish detecting the real violation from incorrectly flagging another rule and accidentally reaching the correct overall answer. Correct classification can therefore coexist with incorrect attribution.
The paper addresses both the data gap and the granularity of training feedback, rather than simply scaling the visual model. FLAW supplies images with checkable criteria and per-rule labels, while SCAN learns to execute those criteria through two-stage post-training. Core idea: anchor anomaly decisions to explicit manufacturing requirements, and assign each rule's correctness feedback only to its corresponding reasoning segment, so common sense does not replace standards and correct final labels do not conceal faulty attribution.
Method¶
Overall Architecture¶
The input is an inspection image together with product-specific rules; the output contains visual evidence and a satisfied/violated judgment for each rule, followed by a final anomaly decision. Training first constructs FLAW, then teaches structured rule inspection, and finally optimizes fine-grained decisions through rule-level rewards and rule-level credit assignment. βZero-shotβ here means that test product categories are unseen during task training, not that the model receives no training or no inspection criteria.
%%{init: {'flowchart': {'rankSpacing': 24, 'nodeSpacing': 28, 'padding': 6, 'wrappingWidth': 400}}}%%
flowchart TD
A["FLAW Rule Data"] --> B["Structured Rule Inspection"]
B --> C["Rule-Level Rewards"]
C --> D["Rule-Level Credit Assignment"]
D --> E["Trained SCAN"]
E --> F["Inference: image and criteria<br/>Per-rule judgments and final decision"]
Rewards and credit assignment are training components: deployment does not require ground-truth rule labels or a judge model to score each inspected image. Deployment still requires externally supplied standards; SCAN does not infer a factory's intended requirements from an image alone.
Key Designs¶
1. FLAW Rule Data: establish image facts before labeling rule violations
The synthesis branch extracts product instances using segmentation masks and places them on varied backgrounds, retaining their categories, counts, appearance, and bounding-box locations. Given this complete metadata, Qwen3-VL-32B generates criteria for quantities, object types, foreign objects, and structural consistency; some deliberately contradict the known facts, while the others agree with them. The important operation is not simply making every image look damaged, but creating a determinate relationship between image facts and a specified rule. Rule-by-rule chain-of-thought explanations are then generated from the image and annotations, checked against ground-truth labels by Qwen3-30B-A3B, and discarded when judgments disagree. Sources include MANTA and RealIAD, with structurally anomalous products retained, so this branch is not restricted to counting exercises.
Cut-and-paste composition does not adequately create attribute changes or realistic component relationships, so a collection branch searches detailed-caption corpora: ShareGPT4V, ALLaVA, and Denseworld-1m. Candidates are filtered for descriptions of attributes, component relationships, or structural irregularities, then paired with criteria, binary labels, and sequential explanations. The paper reports roughly 10K examples from approximately 100K candidate images for this branch; this is not the total size of FLAW. A third subset uses real anomaly data from InstructIAD and three MVTec-AD categories, with manually composed domain criteria and verified generated explanations. Together these sources supply imageβcriteriaβlabelβexplanation examples, although automatically generated descriptions and model-based verification can still introduce annotation noise.
2. Structured Rule Inspection: revisit the image instead of confirming the preceding text
Supervised fine-tuning (SFT) teaches the model to inspect each rule in sequence, discuss visual evidence, and conclude whether the condition is satisfied or violated. This structure supports both human inspection and regular-expression extraction of judgments and segment boundaries during reinforcement learning. The authors nevertheless observe βprefix interferenceβ: as the preceding response grows, the model increasingly treats the rule's expected state as the observed state. It effectively approves rules by default, causing missed detections later in the sequence.
The augmentation keeps an anomalous rule at its original position while permuting the normal rules preceding it. The same anomaly decision is consequently encountered under different prefixes, reducing reliance on a particular preceding-text pattern. This is not unrestricted shuffling of every rule, nor does it change anomaly labels; it specifically varies the context before the anomaly. After this stage the model can reliably produce a structured inspection, but individual judgments remain imperfect, motivating more targeted feedback.
3. Rule-Level Rewards: a correct final label must not validate the wrong explanation
A model can label an anomalous image correctly while falsely declaring a different, actually satisfied rule to be violated. An image-level reward credits that response despite its faulty attribution; conversely, one mistaken rule can cause an otherwise useful inspection to receive a negative overall signal. SCAN instead extracts the binary judgment for every rule in each sampled response and compares it with that rule's label. Equation (1) defines the reward as:
Here \(i\) indexes sampled responses to the same input and \(k\) indexes rules: a correct rule judgment receives 1, otherwise 0. The reward checks the rule's conclusion, not every factual statement in the natural-language explanation through a separate model judge. It is finer supervision than a final image label, but it is not fully verified process supervision for the entire explanation. Collapsing these rewards into one response-level advantage would still lose the useful structure, which is why credit assignment is a separate design.
4. Rule-Level Credit Assignment: compare responses for the same rule and update its tokens
After sampling multiple responses to one input, SCAN groups rewards by rule rather than assigning one normalized score to each complete response. For a given rule, it computes advantages using the mean and standard deviation of that rule's rewards across the sampled responses. Each resulting advantage is assigned to all tokens in the corresponding rule segment, replacing GRPO's uniform response-level advantage with a segment-varying one. A response can thus receive a favorable update for one correctly judged rule and an unfavorable update for another, without conflating their responsibility.
This requires reliably identifiable rule segments and useful variation in the sampled judgments for the rule being compared. It does not independently assess the truth of each token: a rule's feedback is broadcast within that rule's segment. Equation (2) and Algorithm 1 contain extraction-corrupted symbols in the local text, so this explanation follows the intact prose of Β§3.3 rather than reconstructing an unverified complete optimization equation. The main text does not fully specify zero-standard-deviation handling, malformed-output handling, or treatment of tokens outside rule segments; standard GRPO implementation conventions should not be presented as confirmed details of this paper.
A Worked Example¶
Figure 2 uses a criterion allowing only one blue cable, while the inspected image actually contains two. With criteria, SCAN checks the connectors, identifies the count mismatch, attributes the extra component to the relevant rules, and rejects the product. Without criteria, the same model can perceive two cables yet accept their apparently sound connection as normal. The example separates recognizing a count from knowing whether that count is allowed: the criteria are not optional background context. If a training response instead rejected the image because it falsely claimed a damaged connector, a correct final anomaly label would not earn a correct reward for that rule. That last statement illustrates the reward mechanism; it is not an additional experiment reported by the authors.
Loss & Training¶
SFT freezes the vision encoder and updates the remaining parameters, with a maximum image resolution of \(1024\times1024\). Section 4.1 specifies AdamW, a learning rate of \(10^{-5}\), a warmup ratio of 0.03, and batch size 32; SFT takes approximately 6 hours using 2 A100 GPUs for 3B and 4 for 7B/8B. The VeRL-based reinforcement-learning stage uses batch size 16, 8 sampled responses per input, a learning rate of \(10^{-6}\), and a KL penalty coefficient of \(10^{-2}\). It trains on 6,400 examples for 1 epoch, with temperature and top-p both 1.0, taking approximately 8 hours on the corresponding SFT hardware configuration. Inference instead uses temperature 0.01 and top-k 1 for near-deterministic output; the procedure does not continue reinforcement learning at test time.
Key Experimental Results¶
Main Results¶
The following selection comes from Table 1 on the MVTec-LOCO zero-shot test setting with unseen product categories; all values are percentages and higher is better. Binary accuracy checks the final label, whereas scoring metrics additionally require valid anomaly reasoning, assessed by Qwen3-30B-A3B with access to ground-truth annotations. Scoring accuracy is therefore neither ordinary label accuracy nor per-rule accuracy.
| Model | Binary Acc. β | Scoring Acc. β | Scoring F1 β | Scoring Recall β |
|---|---|---|---|---|
| Qwen3-VL-8B base | 62.98 | 56.73 | 35.55 | 24.57 |
| GPT-5.2-chat | 74.67 | 59.73 | 49.71 | 37.34 |
| Gemini-3.1-Pro | 74.98 | 63.64 | 53.78 | 71.15 |
| SCAN-8B | 75.16 | 64.58 | 53.50 | 39.83 |
SCAN improves scoring accuracy over its same-size base by 7.85 percentage points, and exceeds GPT-5.2-chat and Gemini by 4.85 and 0.94 points, respectively. However, its scoring F1 of 53.50 is below Gemini's 53.78, and its recall is substantially lower: this is not an across-the-board win. The paper's conclusion claims superiority over Gemini in both scoring accuracy and F1, contradicting Table 1; this note follows the tabulated values. Table 2 establishes that the relevant base-model and GPT main comparisons use explicit criteria; baselines use their recommended hyperparameters, and proprietary models versus task-post-trained models are not equal-training-budget comparisons.
Ablation Study¶
These selected results are from Table 5, using Qwen3-VL-8B under the same MVTec-LOCO test setting; values are percentages, all higher is better. SR denotes sequence-level rewards, RR rule-level rewards, and RCA rule-level credit assignment; the three RL rows are alternative configurations after SFT, not three consecutive RL stages.
| Configuration | Scoring Acc. β | Scoring Precision β | Scoring Recall β | Scoring F1 β |
|---|---|---|---|---|
| Base | 56.73 | 74.10 | 24.57 | 35.55 |
| SFT | 59.54 | 80.14 | 34.09 | 46.68 |
| SFT + SR | 60.78 | 76.73 | 40.10 | 51.92 |
| SFT + RR | 62.68 | 86.91 | 39.14 | 52.20 |
| SFT + RR + RCA | 64.58 | 90.05 | 39.83 | 53.50 |
Key Findings¶
- SFT first improves anomaly sensitivity, but SR reduces scoring precision from 80.14 to 76.73, illustrating how final-label optimization can compromise attribution reliability.
- RR raises precision over SR to 86.91, and RCA raises it further to 90.05; relative to RR, RCA adds 1.90 points of scoring accuracy and 1.30 points of scoring F1.
- Criteria have an independent effect: Table 2 gives SCAN scoring accuracy of 51.48 without criteria and 64.58 with them, a 13.10-point gap; not all gains should be attributed to post-training.
- Table 3 studies data branches during 7B SFT only: full FLAW reaches scoring F1 of 33.98, versus 32.60 for synthesis and 31.83 for collection, yet its precision remains below the base model's, so more data do not improve every metric simultaneously.
Highlights & Insights¶
- Anomaly is a relationship between an image and a standard. The same image can change labels across manufacturing-stage requirements, so useful training pairs need not rely exclusively on generating visible damage.
- Output structure supports training attribution. Rule-by-rule inspection provides common boundaries for reading, reward extraction, segment localization, and gradient assignment.
- Reward definition and reward placement must be designed together. Identifying the wrong rule is insufficient if the resulting gradient still treats the complete response as one unit.
Limitations & Future Work¶
- Author-acknowledged limitation: model and data scale constrain raw visual perception relative to Gemini, leaving a large scoring-recall gap; rule compliance cannot replace seeing the image correctly.
- Reader assessment: complete, correct criteria and reliable output parsing are deployment assumptions that require validation; conflicting or missing rules and parsing failures are not adequately evaluated.
- Evidence scope: the main validation centers on MVTec-LOCO and does not establish equivalent performance in other factories, continuous video, or medical anomaly detection, nor deployment latency across those settings.
- Evaluation limitation: scoring depends on a model judge; a study with 10 annotators reports humanβmodel Cohen's kappa of 0.841 versus humanβhuman agreement of 0.877, supporting but not eliminating concerns about scoring bias.
- Material boundary: the local cache includes the complete main Method and Experiments but not the referenced Appendix A, so total FLAW size, detailed subset distributions, and all reproduction parameters could not be checked; the code URL is the paper's announced release address and was not verified online.
Related Work & Insights¶
- vs AnomalyGPT / Myriad: these approaches emphasize combining visual experts with multimodal models; SCAN centers explicit rule verification and attribution, while missing scoring metrics for the former methods in Table 1 prevent a direct explanation-quality comparison.
- vs Triad: Triad already incorporates manufacturing-process priors; SCAN turns requirements into individually judged rules and distributes RL feedback per rule rather than merely supplying domain knowledge.
- vs OmniAD / AnomalyR1: all use reinforcement learning for industrial anomaly reasoning; SCAN emphasizes across-response normalization for each rule and segment-specific advantages instead of treating the full reasoning trace as indivisible.
Rating¶
- Novelty: 4/5 β Criteria, data construction, and credit assignment form a coherent solution to logical anomalies, although the approach builds on established post-training methods.
- Experimental Thoroughness: 3/5 β Multiple model scales, criteria/training ablations, and judge checks are useful, but benchmark coverage is concentrated and the appendix was unavailable for verification.
- Writing Quality: 3/5 β The mechanism is clearly explained, but the claimed Gemini F1 advantage conflicts with the main table.
- Value: 4/5 β Useful for inspections requiring explicit rejection reasons, without establishing that high precision is sufficient for production missed-detection requirements.