Abstract
Counterfactual explanations are essential for interpreting black-box AI models, yet generating them for structured tabular data remains challenging due to the need for logical consistency across features. We present Structured Counterfactual Diffuser (SCD), a plug-and-play framework that leverages diffusion models to generate realistic and diverse counterfactuals. By treating generation as a guided denoising process, SCD ensures that "what-if" scenarios remain within the manifold of real-world data. Our evaluation on standard benchmarks demonstrates that SCD significantly improves plausibility and diversity compared to existing state-of-the-art methods.
Introduction
In the context of black-box AI, counterfactual explanations provide actionable insights by answering "what-if" questions. For instance, if a loan application is denied, a counterfactual might suggest: "If your income were $10,000 higher, the loan would have been approved." However, generating these for structured (tabular) data is difficult because traditional methods often ignore the underlying relationships between features. This frequently results in "hallucinated" individuals—instances that are logically inconsistent, such as a person labeled as both "Divorced" and "Husband."
Methodology: Structured Counterfactual Diffuser (SCD)
SCD addresses these inconsistencies by treating counterfactual generation as a guided denoising process. The framework operates in three distinct stages:
- Row Embedding: To handle mixed categorical and numerical data, SCD discretizes numerical values and maps all attributes to a learned embedding space, representing each row as a concatenated vector.
- Diffusion Modeling: A diffusion model is trained to learn the distribution of the real data. It learns to iteratively clean a noisy version of a data row until it resembles a valid entry from the dataset.
- Guided Diffusion: At inference, SCD takes an input row and a target label. It adds noise to the input and performs iterative denoising. During this process, the gradient of the black-box model "steers" the denoising toward the desired outcome.
Because the diffusion model is trained on the data distribution, it naturally resists moving into "impossible" regions of the feature space, ensuring the resulting counterfactual is plausible.
Experimental Evaluation
The authors evaluated SCD on three standard benchmarks: the Adult Income dataset, the UCI Bank dataset, and the California Housing Price dataset. SCD was compared against established baselines, including DiCE and Wachter et al., across four key metrics: Validity, Proximity, Diversity, and Plausibility (measured by Negative Log-Likelihood).
Key Results
SCD demonstrates a significant advantage in generating realistic data points. On the Adult Income dataset, SCD achieved a plausibility score of 21.21, a massive improvement over DiCE's 121.0 (where lower scores indicate higher plausibility).
- Superior Realism: Qualitative analysis confirmed that SCD maintains logical consistency (e.g., matching Marital Status with Relationship) where baselines often fail.
- Natural Diversity: Unlike other methods that require explicit diversity loss terms, SCD's stochastic denoising process naturally produces diverse counterfactuals.
- The Validity Trade-off: SCD showed slightly lower validity scores (0.75–0.86) compared to baselines (0.96–0.99). This occurs because SCD prioritizes realism, refusing to generate "impossible" points simply to satisfy a classifier's label flip.
Conclusion and Future Work
SCD introduces a robust, plug-and-play framework for generating high-quality counterfactuals for tabular data. By leveraging the generative power of diffusion, it bridges the gap between model interpretability and real-world plausibility. While the iterative nature of diffusion models introduces higher computational costs at inference time, the gains in realism and logical consistency represent a significant step forward for trustworthy AI. Future research may focus on distilling these models for faster inference or incorporating stricter user-defined constraints into the guidance process.
Summary updated