Diffusion Models Based Unconditional Counterfactual Explanations Generation
ZHONG Zhi1, WANG Yu2, ZHU Ziye1, LI Yun1
1. School of Computer Science, Nanjing University of Posts and Telecommunications, Nanjing 210023; 2. School of Science, China Pharmaceutical University, Nanjing 211198
Abstract Counterfactual explanations alter the model output by implementing minimal and interpretable modifications to input data, revealing key factors influencing model decisions. Existing counterfactual explanation methods based on diffusion models rely on conditional generation, requiring additional semantic information related to classification. However, ensuring semantic quality of the semantic information is challenging and computational costs are increased. To address these issues, an unconditional counterfactual explanation generation method based on the denoising diffusion implicit model(DDIM)is proposed. By leveraging the consistency exhibited by DDIM during the reverse denoising process, noisy images are treated as latent variables to control the generated outputs, thus making the diffusion model suitable for unconditional counterfactual explanation generation workflows. Then, the advantages of DDIM in filtering high-frequency noise and out-of-distribution perturbations are fully utilized, thereby reconstructing the unconditional counterfactual explanation workflow to generate semantically interpretable modifications. Extensive experiments on different datasets demonstrate that the proposed method achieves superior results across multiple metrics.
Fund:Supported by National Natural Science Foundation of China(No.61772284,62406148,62306339), Natural Science Foundation of Jiangsu Province(No.SBK2024047556)
Corresponding Authors:
LI Yun, Ph.D., professor. His research interests include trusted artificial intelligence.
About author:: ZHONG Zhi, Master student. His research interests include machine learning.WANG Yu, Ph.D., lecturer. His research interests include machine learning and natural language processing.ZHU Ziye, Ph.D., lecturer. Her research interests include machine learning and natural language processing.
[1] CHANG C H, CREAGER E, GOLDENBERG A, et al. Explaining Image Classifiers by Counterfactual Generation[C/OL].[2024-08-15]. https://arxiv.org/abs/1807.08024. [2] VERMA S, BOONSANONG V, HOANG M, et al. Counterfactual Explanations for Machine Learning: A Review[C/OL].[2024-08-15]. https://arxiv.org/abs/2010.10596. [3] WACHTER S, MITTELSTADT B, RUSSELL C. Counterfactual Explanations without Opening the Black Box: Automated Decisions and the GDPR[C/OL]. [2024-08-15]. https://arxiv.org/pdf/1711.00399. [4] GOODFELLOW I J, SHLENS J, SZEGEDY C. Explaining and Har-nessing Adversarial Examples[C/OL]. [2024-08-15]. https://arxiv.org/pdf/1412.6572. [5] GOODFELLOW I J, POUGET-ABADIE J, MIRZA M, et al. Gene-rative Adversarial Nets // Proc of the 27th International Conference on Neural Information Processing Systems. Cambridge, USA: MIT Press, 2014, II: 2672-2680. [6] KINGMA D P, WELLING M. Auto-Encoding Variational Bayes[C/OL]. [2024-08-15]. https://arxiv.org/pdf/1312.6114. [7] HO J, JAIN A, ABBEEL P. Denoising Diffusion Probabilistic Mo-dels // Proc of the 34th International Conference on Neural Informa-tion Processing Systems. Cambridge, USA: MIT Press, 2020: 6840-6851. [8] SONG J M, MENG C L, ERMON S. Denoising Diffusion Implicit Models[C/OL]. [2024-08-15]. https://arxiv.org/pdf/2010.02502. [9] BÖHLE M, FRITZ M, SCHIELE B. Convolutional Dynamic Alignment Networks for Interpretable Classifications // Proc of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2021: 10024-10033. [10] BÖHLE M, FRITZ M, SCHIELE B. B-cos Networks: Alignment Is All We Need for Interpretability // Proc of the IEEE/CVF Confe-rence on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2022: 10319-10328. [11] HUANG Z X, LI Y. Interpretable and Accurate Fine Grained Re-cognition via Region Grouping // Proc of the IEEE/CVF Confe-rence on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2020: 8659-8669. [12] RYMARCZYK D, STRUSKI Ł, GÖRSZCZAK M, et al. Interpre-table Image Classification with Differentiable Prototypes Assignment // Proc of the European Conference on Computer Vision. Berlin, Germany: Springer, 2022: 351-368. [13] CHATTOPADHAY A, SARKAR A, HOWLADER P, et al. Grad-CAM++: Generalized Gradient-Based Visual Explanations for Deep Convolutional Networks // Proc of the IEEE Winter Conference on Applications of Computer Vision. Washington, USA: IEEE, 2018: 839-847. [14] JALWANA M A A K, AKHTAR N, BENNAMOUN M, et al. CA-MERAS: Enhanced Resolution and Sanity Preserving Class Activation Mapping for Image Saliency // Proc of the IEEE/CVF Confe-rence on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2021: 16322-16331. [15] KIM S S Y, MEISTER N, RAMASWAMY V V, et al. HIVE: Evaluating the Human Interpretability of Visual Explanations // Proc of the European Conference on Computer Vision. Berlin, Germany: Springer, 2022: 280-298. [16] LEE J R, KIM S, PARK I, et al. Relevance-CAM: Your Model Already Knows Where to Look // Proc of the IEEE/CVF Confe-rence on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2021: 14939-14948. [17] WANG H F, WANG Z F, DU M N, et al. Score-CAM: Score-Weighted Visual Explanations for Convolutional Neural Networks // Proc of the IEEE/CVF Conference on Computer Vision and Pa-ttern Recognition. Washington, USA: IEEE, 2020: 111-119. [18] ZHENG Q, WANG Z W, ZHOU J, et al. Shap-CAM: Visual Explanations for Convolutional Neural Networks Based on Shapley Value // Proc of the European Conference on Computer Vision. Berlin, Germany: Springer, 2022: 459-474. [19] GHORBANI A, WEXLER J, ZOU J, et al. Towards Automatic Concept-Based Explanations // Proc of the 33rd International Conference on Neural Information Processing Systems. Cambridge, USA: MIT Press, 2019: 9277-9286. [20] KIM B, WATTENBERG M, GILMER J, et al. Interpretability Beyond Feature Attribution: Quantitative Testing with Concept Activation Vectors(TCAV)[C/OL].[2024-08-15]. https://arxiv.org/abs/1711.11279. [21] KOLEK S, NGUYEN D A, LEVIE R, et al. Cartoon Explanations of Image Classifiers // Proc of the European Conference on Computer Vision. Berlin, Germany: Springer, 2022: 443-458. [22] GE Y H, XIAO Y, XU Z, et al. A Peek into the Reasoning of Neural Networks: Interpreting with Structural Visual Concepts // Proc of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2021: 2195-2204. [23] TAN S, CARUANA R, HOOKER G, et al. Learning Global Additive Explanations for Neural Nets Using Model Distillation.Statistical Analysis and Data Mining[C/OL]. [2024-08-15]. https://arxiv.org/abs/1801.08640v2. [24] GOYAL Y, WU Z Y, ERNST J, et al. Counterfactual Visual Explanations[C/OL].[2024-08-15]. https://arxiv.org/abs/1904.07451. [25] VANDENHENDE S, MAHAJAN D, RADENOVIC F, et al. Ma-king Heads or Tails: Towards Semantically Consistent Visual Counterfactuals // Proc of the European Conference on Computer Vision. Berlin, Germany: Springer, 2022: 261-279. [26] WANG P, LI Y J, SINGH K K, et al. IMAGINE: Image Synthesis by Image-Guided Model Inversion // Proc of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2021: 3680-3689. [27] WANG P, VASCONCELOS N. SCOUT: Self-Aware Discriminant Counterfactual Explanations // Proc of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2020: 8978-8987. [28] VAN LOOVEREN A, KLAISE J. Interpretable Counterfactual Explanations Guided by Prototypes // Proc of the European Confe-rence on Machine Learning and Knowledge Discovery in Databases. Berlin, Germany: Springer, 2021: 650-665. [29] THIAGARAJAN J J, NARAYANASWAMY V, RAJAN D, et al. Designing Counterfactual Generators Using Deep Model Inversion // Proc of the 35th International Conference on Neural Information Processing Systems. Cambridge, USA: MIT Press, 2021: 16873-16884. [30] HVILSHØJ F, IOSIFIDIS A, ASSENT I. ECINN: Efficient Counterfactuals from Invertible Neural Networks[C/OL].[2024-08-15]. https://arxiv.org/abs/2103.13701. [31] BOREIKO V, AUGUSTIN M, CROCE F, et al. Sparse Visual Coun-terfactual Explanations in Image Space // Proc of the 44th DAGM German Conference on Pattern Recognition. Berlin, Germany: Springer, 2022: 133-148. [32] SCHUT L, KEY O, MC GRATH R, et al. Generating Interpretable Counterfactual Explanations by Implicit Minimisation of Epistemic and Aleatoric Uncertainties // Proc of the 24th International Conference on Artificial Intelligence and Statistics. San Diego, USA: JMLR, 2021: 1756-1764. [33] SINGLA S, POLLACK B, CHEN J X, et al. Explanation by Progressive Exaggeration[C/OL].[2024-08-15]. https://arxiv.org/pdf/1911.00483. [34] VAN LOOVEREN A, KLAISE J, VACANTI G, et al. Conditional Generative Models for Counterfactual Explanations[C/OL].[2024-08-15]. https://arxiv.org/abs/2101.10123. [35] JEANNERET G, SIMON L, JURIE F. Diffusion Models for Counterfactual Explanations. Computer Vision and Image Understan-ding, 2024, 249. DOI: 10.1016/j.cviu.2024.104207. [36] KHORRAM S, FUXIN L. Cycle-Consistent Counterfactuals by Latent Transformations // Proc of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2022: 10193-10202. [37] NEMIROVSKY D, THIEBAUT N, XU Y, et al. CounteRGAN: Generating Realistic Counterfactuals with Residual Generative Adversarial Nets[C/OL].[2024-08-15]. https://arxiv.org/abs/2009.05199. [38] RODRIGUEZ P, CACCIA M, LACOSTE A, et al. Beyond Trivial Counterfactual Explanations with Diverse Valuable Explanations // Proc of the IEEE/CVF International Conference on Computer Vision. Washington, USA: IEEE, 2021: 1036-1045. [39] SHIH S M, TIEN P J, KARNIN Z. GANMEX: One-vs-One Attributions Using GAN-Based Model Explainability // Proc of the 38th International Conference on Machine Learning. San Diego, USA: JMLR, 2021: 9592-9602. [40] ZHAO Z L, DUA D, SINGH S. Generating Natural Adversarial Examples[C/OL]. [2024-08-15]. https://arxiv.org/pdf/1710.11342. [41] JEANNERET G, SIMON L, JURIE F. Adversarial Counterfactual Visual Explanations // Proc of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2023: 16425-16435. [42] JOSHI S, KOYEJO O, KIM B, et al. XGEMs: Generating Exam-plars to Explain Black-Box Models[C/OL].[2024-08-15]. https://arxiv.org/abs/1806.08867. [43] HUANG G, LIU Z, VAN DER MAATEN L, et al. Densely Connected Convolutional Networks // Proc of the IEEE Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2017: 2261-2269. [44] DENG J, DONG W, SOCHER R, et al. ImageNet: A Large-Scale Hierarchical Image Database // Proc of the IEEE Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2009: 248-255. [45] HE K M, ZHANG X Y, REN S Q, et al. Deep Residual Learning for Image Recognition // Proc of the IEEE Conference on Computer Vision and Pattern Recognition. Washington, USA: IEEE, 2016: 770-778. [46] JACOB P, ZABLOCKI E, BEN-YOUNES H,et al. STEEX: Stee-ring Counterfactual Explanations with Semantics // Proc of the European Conference on Computer Vision. Berlin, Germany: Sprin-ger, 2022: 387-403. [47] CAO Q, SHEN L, XIE W D, et al. VGGFace2: A Dataset for Recognising Faces Across Pose and Age // Proc of the 13th IEEE International Conference on Automatic Face Gesture Recognition. Washington, USA: IEEE, 2018: 67-74. [48] HEUSEL M, RAMSAUER H, UNTERTHINER T, et al. GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium // Proc of the 31st International Conference on Neural Information Processing Systems. Cambridge, USA: MIT Press, 2017: 6629-6640. [49] KINGMA D P, BA J L. Adam: A Method for Stochastic Optimization[C/OL]. [2024-08-15]. https://arxiv.org/pdf/1412.6980. [50] FARID K, SCHRODI S, ARGUS M, et al. Latent Diffusion Counterfactual Explanations[C/OL].[2024-08-15]. https://arxiv.org/abs/2310.06668. [51] JEANNERET G, SIMON L, JURIE F. Text-to-Image Models for Counterfactual Explanations: A Black-Box Approach // Proc of the IEEE/CVF Winter Conference on Applications of Computer Vision. Washington, USA: IEEE, 2024: 4745-4755.