AR-Pro: Counterfactual Explanations for Anomaly Repair with Formal Properties

Anomaly detection is widely used for identifying critical errors and suspicious behaviors, but current methods lack interpretability. We leverage common properties of existing methods and recent advances in generative models to introduce counterfactual explanations for anomaly detection. Given an input, we generate its counterfactual as a diffusion-based repair that shows what a non-anomalous version should have looked like. A key advantage of this approach is that it enables a domain-independent formal specification of explainability desiderata, offering a unified framework for generating and evaluating explanations. We demonstrate the effectiveness of our anomaly explainability framework, AR-Pro, on vision (MVTec, VisA) and time-series (SWaT, WADI, HAI) anomaly datasets. The code used for the experiments is accessible at: https://github.com/xjiae/arpro.

Paper

Similar papers

Peer review

Reviewer k8Af6/10 · confidence 4/52024-06-27

Summary

The paper addresses the anomaly explanation task by repairing the normal appearances of input inputs. Specifically, this paper designs four properties to guide the repair process that works in both image and time series domains. To demonstrate the effectiveness of the proposed method, this paper conducts experiments on the VisA and SWaT datasets.

Strengths

The motivation is clear, thus, repairing the normal appearances for better anomaly explanation. The designed four properties to guide the repair process are reasonable. The proposed metrics are reasonable and the proposed method achieves significant improvements versus the utilized baseline.

Weaknesses

This paper exploits fixed anomaly detection methods, i.e., Fastflow and GPT2, to guide the anomaly repair process. The two selected methods are out-of-date, and the influence of the utilized anomaly detection methods should also be investigated. More datasets should be included but not only VisA and SWaT. For example, for industrial image anomaly detection, MVTec AD should also be included. For me, Property 1 is a combination of Property 3 and 4, and maybe only Property 2, 3, and 4 are enough. The figure quality should be improved, especially for Figure 3. For the fourth metric M_{1-w}, should it be the absolute value? Or it will encourage lower anomaly scores for normal regions in the fixed results. Sec 3.3 is quite important but is not clear. The author may condense Sec. 2 a lot and then extend Sec 3.3, at least elaborating on the details of the generation process and adding proper references. ------------post rebuttal response-------- the authors have addressed all my concerns, so I raise my rate from 5 to 6.

Questions

See the Weaknesses.

Rating

6

Confidence

4

Soundness

3

Presentation

3

Contribution

3

Limitations

See the Weaknesses.

Reviewer F7R53/10 · confidence 4/52024-07-12

Summary

The paper proposes an anomaly repair technique. Based on proposed four properties, it trains a generative model that can fix anomaly data to a benign one. The proposed properties include similar to the data, etc., which are globally applicable to any dataset. The evaluation is performed on VisA dataset and the GPT2 on SWat Dataset. The results show that the proposed method can effectively repair the anomaly data.

Strengths

The paper can properly formulate the proposed properties and mix them into the training of the generative model. The proposed method can effectively repair the anomaly data. The paper is well-written and easy to follow.

Weaknesses

* I do not get the motivation of fixing anomaly data. If it is detected and considered as anomaly, our typical action is to determine if it is a false positive and then improve the detection model and following downstream models. What is the rationale of fixing the anomaly data? * Properties 3 and 4 seem to be generalized version of 1 and 2. Typically, this should be solved in the training of models, either a vision model or time-series. Why not directly embedding these properties into the training of final model instead of training a separate model? * The method assumes the availability of anomaly map, which seems to be impractical in real-world scenarios. How can the method be applied to real-world scenarios where anomaly maps are not available? In the real world, we tend to only have individual anomaly data points, not a map. Similarly, it would be great if you can extend the discussion to the region selector.

Questions

What is the motivation of fixing the anomaly data?

Rating

3

Confidence

4

Soundness

2

Presentation

2

Contribution

1

Limitations

The paper does not explicitly discuss the limitations and potential negative. As for me, my concern is this can be used as a tool to evade anomaly detection models. The authors should discuss this in the paper.

Reviewer DUtN7/10 · confidence 4/52024-07-19

Summary

Paper proposes a method for anomaly repair that goes one step beyond an anomaly detection and/or an anomaly localization method. While anomaly detection focuses on identifying which objects (images, time series, etc.) are anomalous, and anomaly localization focuses on identifying regions within the object (image or time series) which is anomalous, anomaly repair focuses on producing the normal object that the anomalous object is derived from. Authors identify properties for the repair, and develop a generative model that can take an anomalous object and produces the corresponding normal (and repaired) object. Paper describes experimental results to demonstrate the effectiveness of the proposed approach on different data sets. Evaluation is done both quantitatively and qualitatively.

Strengths

Paper is well written except for some minor notational inconsistencies (see my questions). The idea is interesting and novel and targets an important and practical issue of anomaly repair. Experimental evaluation is robust and provides evidence regarding the effectiveness of the proposed method.

Weaknesses

A primary weakness of this paper is that it does not state the assumptions regarding the scope of the methods upfront. The analysis holds for methods that follow the reconstruction-based anomaly detection recipe, i.e., each input is reconstructed, and the anomaly score is calculated using the difference between the input and reconstruction. While that is true for many methods, there is still a vast majority of methods for which this is not applicable. In fact, even in the reconstruction based methods, the analysis holds for those in which the scoring function can be decomposed over the individual features. Again, this is not true for all reconstruction-based methods. It would be good if the authors can make this clear in the beginning to avoid confusion.

Questions

- In Section 2, the definition of anomaly map has a term $\hat{x}$, which has not been defined. From the figure 2 it appears that $\hat{x}$ is the reconstructed version of the original data point. Does that mean that this analysis framework is applicable only to the class of anomaly detection methods that involve reconstruction. While those methods are certainly capable, there is a large class of anomaly detection methods that do not necessarily have a reconstruction step involved. In fact, does the whole approach rely on availability of a base anomaly detector? - Can this method be applied of multivariate instances (no spatial or temporal relationships). It is unclear how a single threshold ($\tau$) in line 106 be applied to a case where each feature could have a different scale. - What is $\alpha_i(x)$ in Definition 2.1? Is it the absolute difference between the actual value and the reconstructed value for the $i^{th}$ feature? - In Section 3.1, what does a "normal input" mean? Does it refer to an entire observation (an image) that does not have any anomalous features or does it refer to the non-anomalous parts of an image? - In Figure 5(a), why do the authors infer that the proposed method is not adding a spurious signal, when the plot shows that it is different from the normal signal

Rating

7

Confidence

4

Soundness

4

Presentation

4

Contribution

4

Limitations

I think the paper does not quite scope the method - identify what kind of problems will it work on and what it won't.

Reviewer k8Af2024-08-07

Response

Dear Authors, Thank you so much for your efforts. Explaining anomalies by repairing them is an interesting direction, and your responses have addressed my concerns. I would suggest trying to repair semantic anomalies, like those anomalies in MVTec LOCO in the future since the structural anomalies are typically easy for users to understand the reason to be anomalous, but in comparison, users can suffer from explaining semantic anomalies without proper prior information.

Authorsrebuttal2024-08-07

Response to Reviewer k8Af

We thank the reviewer for their encouragement and dataset suggestions. We will try to incorporate MVTec LOCO into our paper. Meanwhile, if the reviewer has any additional comments, questions, or requests, please do let us know.

Reviewer F7R52024-08-12

Follow up

Could you explain why encoding the properties as training objectives fail? Thanks.

Authorsrebuttal2024-08-13

Explanation of why encoding as training objectives fail

Thank you for your response. We found that augmenting the training loss often failed to produce effective counterfactuals, either due to limitations in the model architecture or because of the model's natural training loss. After many attempts, we discovered that guided diffusion was a straightforward algorithm capable of achieving good performance. Our eventual choice of algorithm was primarily influenced by the available generative models for images (VAEs, GANs, Diffusion), and we elaborate on the challenges associated with each below. We initially tried VAEs for image repair but found the generated counterfactuals were often blurry, which is a known limitation of VAE [1,2]. Although later work describes methods for high-resolution VAE-based image generation [3,4], these methods often fell short in producing the same level of sharpness and detail compared to GANs and diffusion models—especially within the anomalous regions. So why are VAEs commonly used for reconstruction-based anomaly detection despite the blurry outputs? This is likely because although their ELBO loss tends to favor images that are the "average" of a distribution (i.e., blurry), this often suffices for detecting anomalous regions. Given the limitations of VAEs, we turned to GANs and diffusion models. However, GAN training was plagued by well-known issues of instability and non-convergence [5,6], thereby leading us to focus on diffusion models. With diffusion models, we found that incorporating the four properties into the training loss did not enhance counterfactual quality. This was likely because the diffusion model's noise prediction loss often led to static-like reconstructions (very noisy images) that were unsuitable for evaluation against our properties, especially at larger time steps. It was with guided diffusion methods [7] that we achieved high-quality counterfactuals, and these methods now form the foundation of our present methodology. We thank the reviewer for these questions, and we will update our manuscript to include a discussion of the lessons learned with various model architectures. **Additional References** [1] Tomczak, Jakub, and Max Welling. "VAE with a VampPrior." In International conference on artificial intelligence and statistics, pp. 1214-1223. PMLR, 2018. [2] Dai, Bin, and David Wipf. "Diagnosing and enhancing VAE models." arXiv preprint arXiv:1903.05789 (2019). [3] Razavi, Ali, Aaron Van den Oord, and Oriol Vinyals. "Generating diverse high-fidelity images with vq-vae-2." Advances in neural information processing systems 32 (2019). [4] Liu, Zhi-Song, Wan-Chi Siu, and Yui-Lam Chan. "Photo-realistic image super-resolution via variational autoencoders." IEEE Transactions on Circuits and Systems for video Technology 31, no. 4 (2020): 1351-1365. [5] Saxena, Divya, and Jiannong Cao. "Generative adversarial networks (GANs) challenges, solutions, and future directions." ACM Computing Surveys (CSUR) 54, no. 3 (2021): 1-42. [6] Lu, Yuzhen, Dong Chen, Ebenezer Olaniyi, and Yanbo Huang. "Generative adversarial networks (GANs) for image augmentation in agriculture: A systematic review." Computers and Electronics in Agriculture 200 (2022): 107208. [7] Dhariwal, Prafulla, and Alexander Nichol. "Diffusion models beat gans on image synthesis." Advances in neural information processing systems 34 (2021): 8780-8794.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC