acceptodds
Under review as a conference paper at ICLR 2027

Specification-Conditioned Counterfactual Repair for Industrial Anomaly Detection

Abstract

Industrial anomaly detectors can achieve strong benchmark performance while relying on visual mechanisms that do not match the intended inspection logic. For example, a detector may respond strongly to a tolerated appearance change, overlook the specified defect, or depend on interactions between the two. We study this problem as post-training repair under an explicit inspection specification rather than as learning from a new set of anomaly labels. Our approach uses matched counterfactual probes to separate the detector's responses to the target defect, tolerated variation, and their interaction, and evaluates these responses against a user-defined behavioral contract. Based on this formulation, we introduce Specification-Conditioned Counterfactual Gap Repair (SC-CGR), which adjusts a fitted detector through a lightweight head on frozen features while using typed replay and ranking constraints to preserve trusted behavior on real images and clean controls. Across five industrial anomaly-detection datasets, we systematically screen a 71-category inventory to obtain 37 feasible inspection contracts, revealing semantic response violations that are not reflected by the area under the receiver operating characteristic curve or average precision. Evaluation of the 13 contracts taken to the repair stage shows that SC-CGR substantially improves strict contract satisfaction on MVTec AD bottle and metal nut and generalizes to counterfactual probes from held-out Real-IAD bottle-cap anchors. The broader evaluation also identifies cases where pairwise constraints alone are sufficient and cases where enforcing the specification conflicts with retaining real-data behavior. These results show that specification-conditioned counterfactual responses provide a practical interface for auditing and repairing fitted industrial inspection systems beyond conventional anomaly-detection accuracy.

Then back it, or bet against it.

Related papers

Open the market on this paper to see 7 more related papers.