Diverse Counterfactuals are a set of multiple, distinct counterfactual instances generated to provide a user with alternative paths to flip a model's prediction to a desired outcome. Unlike single counterfactual generation, which may produce an infeasible recommendation, this approach explicitly optimizes for variety in the feature changes, ensuring the user has a portfolio of actionable options for algorithmic recourse.
Glossary
Diverse Counterfactuals

What is Diverse Counterfactuals?
A set of multiple, distinct counterfactual instances that provide a user with alternative paths to achieve a desired outcome, avoiding a single, potentially infeasible recommendation.
The generation process typically uses a loss function that penalizes similarity between generated instances, often employing a Determinantal Point Process (DPP) or a pairwise distance metric to enforce diversity. This technique is critical for addressing recourse feasibility, as a diverse set increases the probability that at least one counterfactual respects a user's unobserved real-world constraints and personal preferences.
Key Properties of Diverse Counterfactuals
Diverse counterfactuals provide a set of distinct, alternative explanations, ensuring users are not trapped by a single, infeasible recommendation. This approach maximizes actionable recourse by exploring the geometry of the decision boundary.
Determinantal Point Processes (DPP)
A probabilistic mechanism used to enforce diversity in the generated set. DPPs model the probability of selecting a subset of counterfactuals, assigning higher probability to subsets where items are dissimilar. This mathematically penalizes redundancy, ensuring the algorithm explores distinct regions of the feature space rather than returning minor variations of the same explanation.
Coverage over Proximity
While standard counterfactuals optimize for proximity (minimal change), diverse counterfactuals prioritize coverage. The goal shifts from finding the single closest point on the decision boundary to mapping the boundary's topology. This provides a user with a menu of trade-offs, such as:
- A high-cost, immediate change
- A low-cost, gradual change
- A change affecting feature A vs. feature B
Submodular Optimization
The selection of a diverse set is often framed as a submodular maximization problem. A utility function measures the value of a set of counterfactuals, balancing relevance (validity and proximity) with diversity. Because submodular functions exhibit diminishing returns, a greedy algorithm can efficiently construct a near-optimal diverse set by iteratively adding the counterfactual that provides the maximum marginal gain in utility.
Latent Space Diversity
For high-dimensional data like images, diversity is often enforced in a learned latent space (e.g., using a Variational Autoencoder). Instead of perturbing raw pixels, the algorithm searches for distinct latent codes that decode into valid counterfactuals. This ensures that the diverse explanations are semantically meaningful and lie on the data manifold, avoiding unrealistic adversarial examples that merely exploit pixel-level noise.
Actionable Set Partitioning
Diversity can be explicitly structured around an action set. The algorithm partitions the feasible actions into distinct clusters (e.g., 'education-based changes' vs. 'financial-based changes') and generates at least one counterfactual per cluster. This guarantees that the user receives a portfolio of options spanning different life domains, directly addressing the feasibility of recourse rather than just mathematical diversity.
MMD Critic Constraint
The Maximum Mean Discrepancy (MMD) can be used as a statistical constraint to enforce diversity. The algorithm minimizes the MMD between the generated set of counterfactuals and a target distribution that represents ideal diversity. This prevents the set from collapsing into a single mode of the data distribution and ensures the explanations are representative of the full range of possible recourse paths available to the user.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Explore the core concepts behind generating multiple, distinct counterfactual explanations that provide users with alternative paths to a desired outcome, avoiding single, potentially infeasible recommendations.
Diverse counterfactuals are a set of multiple, distinct counterfactual instances that each independently flip a model's prediction to a desired target outcome. Unlike single counterfactual generation, which provides only one path for recourse, diverse counterfactual algorithms explicitly optimize for variety in the feature space. They work by incorporating a diversity metric—often based on distance between generated instances or determinant maximization of a kernel matrix—into the objective function alongside standard goals like counterfactual proximity and counterfactual validity. This ensures the user receives a portfolio of actionable options, such as 'increase income by $5,000' or 'reduce revolving debt by $10,000,' rather than a single, potentially infeasible recommendation. The underlying mechanism often involves solving a constrained optimization problem that penalizes similarity between generated points, forcing the algorithm to explore different regions near the decision boundary.
Real-World Applications of Diverse Counterfactuals
Diverse counterfactuals provide users with a portfolio of distinct, actionable paths to achieve a desired outcome, avoiding single-point recommendations that may be infeasible due to real-world constraints.
Loan Application Recourse
A loan applicant rejected for a high debt-to-income ratio receives multiple distinct paths to approval:
- Path A: Reduce revolving credit card balance by $4,200.
- Path B: Increase annual gross income by $8,500.
- Path C: Close two unused credit lines and reduce balance by $1,800.
This prevents a single infeasible recommendation (e.g., 'increase income by $20k') and lets the applicant choose the most actionable recourse based on their circumstances.
College Admissions Guidance
A graduate school applicant receives a rejection prediction. A determinantal point process (DPP) generates diverse counterfactuals:
- Path A: Increase GRE quantitative score from 158 to 165.
- Path B: Add one first-author publication while maintaining current scores.
- Path C: Gain 2 years of relevant research experience.
Each path represents a distinct subspace of the feature space, ensuring the student can pursue the option aligned with their timeline and resources.
Medical Treatment Planning
A clinical decision support model predicts high risk of diabetes complications. Diverse counterfactuals offer alternative intervention strategies:
- Path A: Reduce HbA1c from 8.2% to 6.8% through medication adjustment.
- Path B: Lower BMI from 32 to 28 through lifestyle intervention.
- Path C: Combination of moderate HbA1c reduction (to 7.3%) and blood pressure normalization.
Physicians evaluate feasibility constraints like patient adherence and contraindications before recommending a specific path.
Criminal Justice Risk Assessment
A recidivism risk model flags an individual as high-risk. Diverse counterfactuals identify distinct rehabilitation pathways:
- Path A: Complete substance abuse treatment program and secure stable housing.
- Path B: Obtain full-time employment for 12 consecutive months.
- Path C: Complete GED and enroll in vocational training.
Diversity ensures recommendations don't inadvertently encode algorithmic bias by forcing all individuals toward a single socioeconomic path that may be structurally inaccessible.
Credit Score Improvement
A consumer with a 620 FICO score seeks mortgage qualification at 680+. Diverse counterfactuals generated via gradient-based optimization with diversity constraints:
- Path A: Reduce credit utilization from 78% to 30%.
- Path B: Remove two collection accounts and maintain on-time payments for 6 months.
- Path C: Increase average account age by 18 months (no new credit inquiries).
The action set is constrained to only modifiable features, excluding immutable attributes like credit history length.
Automated Hiring Decisions
A resume screening model rejects a candidate. Diverse counterfactuals reveal multiple skill acquisition paths:
- Path A: Obtain AWS Solutions Architect certification.
- Path B: Complete 3 open-source contributions to relevant GitHub repositories.
- Path C: Gain 1 year of experience with Kubernetes in current role.
Diversity is critical here to avoid proxy discrimination—ensuring the model doesn't systematically recommend paths correlated with protected attributes.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us