In the world of explainable AI, a counterfactual explanation answers the question: "What is the smallest change I could make to my input to get a different outcome?" If a bank denies your loan, a counterfactual might suggest, "If your income were $5,000 higher, your loan would have been approved."
While mathematically simple to calculate—often just finding the nearest point across a decision boundary—traditional counterfactuals frequently fail in practice. They often suggest "nonsense" scenarios: an age of -10, a person with 20 years of experience but only 18 years old, or an image that looks like static. To be useful, an explanation must not only be valid but also plausible.
Recent research has converged on a shared solution: constraining explanations to the data manifold—the low-dimensional structure where real-world data actually lives.
The Problem of Off-Manifold Explanations
Most machine learning models are "black boxes" that can be queried anywhere in a high-dimensional space. However, real-world data is sparse. If you perturb a data point in a random direction, you almost certainly move into a region where the model has never seen data during training.
As Sahil Verma and Chirag Shah note in their comprehensive review, minimizing mathematical distance often produces "adversarial-like" examples. These points satisfy the model's decision boundary but are physically or logically impossible. Christopher Frye and colleagues argue in Shapley explainability on the data manifold that evaluating models on these "nonsense" points leads to misleading explanations because the model's behavior in those regions is undefined and erratic.
Navigating the Latent Space
To ensure plausibility, researchers are moving away from raw feature-space optimization and toward generative modeling. By training a Variational Autoencoder (VAE) or a Generative Adversarial Network (GAN) on the training data, we can learn a "latent space" that captures the underlying distribution.
A prominent example is LAPACE, developed by Junqi Jiang, Francesco Leofante, and Francesca Toni. In Synthesising Counterfactual Explanations via Label-Conditional Gaussian Mixture Variational Autoencoders, they use a specialized VAE to create a structured latent space. Instead of jumping across a boundary, they interpolate between the user's representation and "prototypes" of the desired class. This ensures the path to recourse stays within the bounds of realistic data.
Similarly, Daniel Nemirovsky and Ye Xu introduced CounteRGAN (CounteRGAN: Generating counterfactuals for real-time recourse and interpretability using residual GANs), which uses a discriminator to penalize any counterfactual that looks "unreal." This forces the generator to produce perturbations that respect the natural correlations between features.
Diffusion and Density Guidance
The latest frontier in this area involves diffusion models and density estimation. Diffusion models are particularly adept at learning complex manifolds. Jialin Chen and Rex Ying proposed D4Explainer (D4Explainer: In-Distribution GNN Explanations via Discrete Denoising Diffusion), which uses discrete denoising to ensure that graph-based explanations remain "in-distribution."
For tabular data, where features are often a mix of numbers and categories, Brian Barr and John Paisley developed TDCE (Tabular Diffusion Counterfactual Explanations). Their work highlights a fundamental trade-off: adhering to the data manifold often requires larger feature changes than simple distance-based methods. However, these larger changes are more actionable because they represent states that actually exist in the real world.
Another approach, DensityFlow, by Jun Tan and colleagues (Density-Guided Robust Counterfactual Explanations on Tabular Data under Model Multiplicity), uses Neural ODEs to steer counterfactuals toward high-density regions. This is not just about realism; it's about robustness. Points in high-density regions are less likely to be affected by minor model updates or noise, making the recourse more reliable for the end-user.
Beyond the Individual: Collective Recourse
When we move from explaining a single decision to providing recourse for a population, new challenges emerge. If a thousand people are told to "increase their savings by $1,000" to get a loan, the resulting shift in the population might change the data manifold itself.
Ahmad Reza Ehyaei and Samira Samadi address this in Collective Counterfactual Explanations. By using optimal transport and population dynamics, they ensure that recommendations don't lead to a "tragedy of the commons," where everyone moves toward the same unrealistic point. Instead, they balance individual effort with the collective reality of the data distribution.
The Path Forward: Certified and Scientific Explanations
The shift toward manifold-aware explainability is also enabling more rigorous validation. Amit Dhurandhar and colleagues introduced Ecertify (Trust Regions for Explanations via Black-Box Probabilistic Certification), which finds "trust regions" around data points. They argue that incorporating manifold constraints into these regions makes stability guarantees much more practical.
Furthermore, researchers like Timo Freiesleben and Gunnar König are using these manifold-constrained methods for scientific inference. By ensuring that models are only probed on realistic data points, we can use AI to learn about real-world phenomena without being misled by the artifacts of high-dimensional geometry.
In summary, the field is moving away from the "nearest neighbor" and toward the "nearest plausible neighbor." By grounding explanations in the data manifold, researchers are creating AI systems that provide not just answers, but actionable, robust, and human-centric guidance.