TLDR: This research introduces a new method for creating understandable “what-if” explanations for AI decisions in medical imaging. By combining Variational Autoencoders (VAEs) with Sum-Product Networks (SPNs), the approach generates plausible counterfactual images that show how small changes can alter an AI’s diagnosis. The SPN guides the process in the VAE’s compressed data space, making the explanations more robust and interpretable than traditional methods, especially for complex medical images like X-rays.
Artificial intelligence (AI) is increasingly used in critical areas like medical image analysis, where deep learning models show impressive performance. However, these models are often “black boxes,” meaning their decision-making processes are difficult to understand. This lack of transparency raises concerns about their reliability and trustworthiness, especially in sensitive applications like disease diagnosis from medical images.
To address this, researchers are exploring “explainable artificial intelligence” (XAI), and one promising direction is counterfactual explanations. These explanations work by showing hypothetical “what-if” scenarios. For instance, if a model predicts a certain disease, a counterfactual explanation would show what minimal changes to the input image would make the model predict a different outcome (e.g., no disease). This helps medical practitioners understand which features in an image influence a diagnosis and how slight variations might alter predictions.
A recent paper, “Counterfactual Explanations in Medical Imaging: Exploring SPN-Guided Latent Space Manipulation,” by Julia Siekiera and Stefan Kramer, delves into this challenge. The authors propose a novel approach that combines deep neural networks with a type of probabilistic model called Sum-Product Networks (SPNs) to generate more plausible and interpretable counterfactual explanations, particularly for medical imaging data.
Deep generative models like Variational Autoencoders (VAEs) are powerful for generating new data, while SPNs are excellent at representing complex probability distributions and performing efficient inference. The core idea of this research is to integrate an SPN into the “latent space” of a VAE. The latent space is a compressed, meaningful representation of the input data learned by the VAE. By modeling this latent space with an SPN, the system gains the ability to describe the data distribution and classify it simultaneously.
How the SPN-Guided Approach Works
The proposed method involves three key steps. First, a VAE is trained to learn a latent feature space that is useful for both generating new images and for classification. This VAE uses convolutional layers, which are common in image processing. Initially, a standard neural network (Multi-Layer Perceptron or MLP) acts as a classifier within the VAE.
In the second step, after the VAE is trained, the MLP classifier is replaced by an SPN. This SPN learns the structure of the latent space, capturing statistical dependencies within the data. The authors adapted existing tools to convert the learned SPN structure into a format compatible with deep learning frameworks, allowing for gradient-based optimization.
Finally, in the third step, counterfactual examples are generated. Instead of directly manipulating the complex input image, the system manipulates the simpler, more controllable latent representation within the VAE. The SPN guides this manipulation, ensuring that the generated counterfactuals are not only close to the original data but also align with the desired target class. This optimization aims to find a counterfactual latent representation that increases the probability of the target class with minimal changes to the original, while maintaining the likelihood of the altered representation.
Evaluation and Results
The researchers evaluated their method on the CheXpert dataset, which contains chest X-ray images. They focused on a binary classification task (e.g., ‘cardiomegaly’ vs. ‘no finding’). Their experiments compared the SPN-guided approach against a standard MLP baseline. They found that the SPN-guided method consistently maintained moderate to high “validity” (meaning the counterfactuals successfully changed the model’s prediction) even under weaker regularization, where the MLP baseline struggled significantly.
The study also analyzed the trade-offs between different objectives, such as reconstruction quality, latent space regularization, and classification performance. While metrics like L2 norm (measuring distance from original) and Fréchet Inception Distance (FID, measuring plausibility) were influenced by the VAE’s overall reconstruction, the SPN demonstrated greater robustness in generating effective counterfactuals. Visualizations showed that the SPN consistently identified relevant regions (like the heart area) for modification across different settings, providing more convincing explanations.
Also Read:
- Navigating Model Multiplicity in Medical AI: Ensuring Consistent Diagnoses
- Advancing Chest X-Ray Diagnosis for Rare Diseases with CXR-CML
Conclusion
In conclusion, this research presents a promising hybrid approach for generating counterfactual explanations in medical imaging by integrating Sum-Product Networks into Variational Autoencoders. This method enhances the interpretability of AI models in sensitive domains by providing plausible “what-if” scenarios that help understand model decisions. For more technical details, you can read the full research paper available at https://arxiv.org/pdf/2507.19368.


