Executable Counterfactuals
- Executable counterfactuals are minimally altered, plausible modifications to inputs, policies, or trajectories that enable feasible interventions under various modeling paradigms.
- They integrate constraints from dynamical systems, sequential decision processes, and causal models to ensure actions are physically and empirically realizable.
- Optimization frameworks for executable counterfactuals balance validity, minimality, and interpretability to provide localized, actionable guidance across applied settings.
Executable counterfactuals are minimal, plausibly implementable modifications to inputs, policies, plans, or trajectories that are not just hypothetical but are guaranteed to be actionable, physically realizable, and causally coherent under either mechanistic, data-driven, or sequential decision-making models. Unlike classical counterfactual explanations—which may simply identify a nearby alternative input that produces a different prediction—executable counterfactuals rigorously incorporate constraints and dynamics to ensure that the prescribed changes correspond to feasible interventions in the real or modeled world.
1. Formalization Across Dynamical, Structural, and Decision-Theoretic Frameworks
Executable counterfactuals arise in multiple modeling paradigms:
| Paradigm | Core Object Modified | Executability Criterion |
|---|---|---|
| Control/Dynamical | Trajectories, controls | System dynamics , endpoints reach desired outcome via feasible (Paola et al., 22 Jan 2025) |
| MDP/Sequential | Policies/Strategies | Modified policy respects Markov constraints, reachability bounds, and is close (in total variation) to original (Kobialka et al., 14 May 2025, Tsirtsis et al., 2021) |
| ML/Recourse | Feature-modification sequences | Changes align with plausible, observed transitions in longitudinal data (Asemota et al., 2024); stepwise recourse actions are feasible and pass through high-density regions (Small et al., 2023) |
| Causal/SCM | Variables, units | Intervention and abduction over latent variables; realizability under fundamental physical and experimental constraints (Raghavan et al., 14 Mar 2025, Shpitser et al., 2012) |
| Planning | Action sequences | The plan is executable, minimal, and achieves specified goal fluents within the agent's knowledge/model (Belle, 13 Feb 2025) |
Executable counterfactuals are distinguished by three interlocking requirements:
- Validity: They achieve the specified target (e.g., outcome flip, risk reduction, or goal satisfaction).
- Plausibility/Feasibility: Prescribed changes must conform to physical laws, system constraints, or empirically observed capabilities (e.g., what users have changed in real longitudinal datasets or what actions are allowed for the system under control).
- Minimality/Sparsity: The modifications are as small or as localized as possible, measured by norms (e.g., , , total variation), support size, or deviation from original actions or strategies.
2. Optimization and Algorithmic Foundations
a. Sequential Decision Processes (Markov Decision Processes)
In the context of MDPs, executable counterfactuals are operationalized by repairing policies. Given a policy with undesirable risk (e.g., excessive probability of reaching a target ), the task is to find 0 that reduces risk below a threshold 1, while 2 remains minimally perturbed from 3 in state-action distributions. The problem is encoded as a nonconvex MIQCQP: 4 where 5 combines statewise total variation via 6, 7, 8 norms (Kobialka et al., 14 May 2025). The global optimal 9 may change only a sparse subset of state policies (sometimes a single node in large transition graphs), yielding interpretable recourse strategies.
b. Finite-Horizon Sequential Explanations
For fixed realization trajectories in finite-horizon MDPs, counterfactuals can be synthesized subject to a fixed budget 0 of modifications. Embedding the MDP in a Gumbel–Max SCM, the optimal alternative policy maximizing expected reward is computed via dynamic programming, ensuring that every counterfactual trajectory differs in no more than 1 actions from the factual sequence (Tsirtsis et al., 2021). The solution yields both a policy 2 and explicit, executable action sequences for intervention.
c. Control-Theoretic Objectives
Under control system formulations, executable counterfactuals are synthesized as optimal control trajectories 3 that respect the full system dynamics 4 and reach a classifier-flipping set (e.g., safe vs. unsafe region) in minimum effort or time, strictly obeying underlying physics (Paola et al., 22 Jan 2025). The problem is relaxed and solved via occupation measure LPs and moment-SOS hierarchies, producing both endpoint counterfactuals and full intervention schedules suitable to be enacted in the real system.
d. Counterfactuals in ML Algorithmic Recourse
Local, sequential recourse methods such as LocalFACE generate executable counterfactuals by sequentially constructing dense, feasible action paths from a factual instance to a counterfactual prediction, subject to density and actionability constraints at every step (Small et al., 2023). Genetically optimized counterfactuals can be additionally filtered for executability by comparing their change vectors to longitudinal data, using normalized Euclidean (or Mahalanobis-type) distances to observed human transitions (Asemota et al., 2024).
3. Causal, Realizability, and SCM Frameworks
From a structural causal model (SCM) perspective, executable counterfactuals require explicit abduction (inferring latents given observations), performing interventions on the chosen variables, and predicting under the altered model. The framework of executable counterfactuals for LLMs—anchored in SCM formalism—operationalizes abduction–action–prediction via code, requiring models to infer hidden variables, apply controlled interventions, and produce candidate outputs (Vashishtha et al., 2 Oct 2025). Evaluation, training, and code-based benchmarking enforce that generation traces truly correspond to this three-step process, not mere interventional or associative reasoning.
Realizability, as formalized in recent causal literature, codifies whether a given counterfactual distribution 5 is not only identifiable but "physically constructible" from experimental actions in the real world. The realization algorithm (CTF-REALIZE) checks, under the constraint of no time-travel and unit-consistency, when unit-level counterfactuals can be sampled directly under given experimental designs (Raghavan et al., 14 Mar 2025).
4. Diversity, Minimality, and Interpretability
Many frameworks explicitly optimize for diverse, sparse, and interpretable executable counterfactuals:
- Policy diversity: In sequential settings, diversity-promoting determinants are introduced into the objective to generate multiple, maximally "spread" strategies differing from the original policy and from each other (Kobialka et al., 14 May 2025).
- Minimality guarantees: Optimization objectives enforce 6 (support-size), average (7), or maximum (8) total-variation distances to ensure counterfactuals change as few individual decisions as possible.
- Trajectory coherence: Explanations generated as plans or recourse sequences are only accepted if all intermediate steps are executable in the modeled system, leveraging feasibility checks at every planning or optimization stage (Belle, 13 Feb 2025, Small et al., 2023).
Sample scenario (loan-application MDP): Original policy yields high rejection risk; the counterfactual policy alters only the action distribution at the "Rework" state, switching "Submit" from 9 to 0 probability, cutting rejection risk from 1 to 2—with minimal, highly interpretable intervention (Kobialka et al., 14 May 2025).
5. Practical Implications, Empirical Findings, and Limitations
Empirical studies across domains confirm the benefits and nuances of executable counterfactuals:
- Sequential domains: In loan approval, music streaming, or service interaction logs, counterfactual strategy repair rapidly lowers undesirable outcome probabilities with extremely localized changes (Kobialka et al., 14 May 2025).
- Clinical decision-making: In cognitive behavioral therapy, optimal 3-action-close counterfactual policies yield modest but actionable depression reduction improvements, with explanations remaining interpretable for small 4 (Tsirtsis et al., 2021).
- Control and physiological systems: In glucose–insulin regulation, executable trajectories computed via SDPs achieve safe regimens minimizing intervention effort while strictly adhering to biological dynamics; further, endpoint counterfactuals concentrate near clinically relevant boundaries (Paola et al., 22 Jan 2025).
- Algorithmic recourse: Integration of longitudinal constraints guarantees recommendations never propose changes unobserved in the target population. However, stricter executability often narrows the set of valid counterfactuals and exposes populations for whom recourse is effectively unavailable under the model (Asemota et al., 2024).
Principal limitations noted include reliance on exact transition probabilities, model knowledge, low-dimensional or discrete state/action spaces, and the intractability of extension to adversarial or partially observable settings in most current frameworks (Kobialka et al., 14 May 2025, Tsirtsis et al., 2021, Paola et al., 22 Jan 2025).
6. Generalizations and Theoretical Limits
Executable counterfactuals span all layers of the Pearl Causal Hierarchy, but realizability constraints impose strict boundaries:
- Certain counterfactual queries (e.g., 5 for two conflicting regimes) are proven non-realizable for a single unit under physical constraints and no time-reversal (Raghavan et al., 14 Mar 2025).
- In interventional versus counterfactual reasoning benchmarks for LLMs, there is a consistent 6–7 percentage point accuracy drop, confirming that "execution"—full abduction plus intervention plus prediction—is significantly harder and more discriminating than mere intervention (Vashishtha et al., 2 Oct 2025).
- In plan-based models, executability is guaranteed by construction in the returned action sequence; reconciliation between user and agent models is handled via explicit modal updates, refining the search space for feasible explanations (Belle, 13 Feb 2025).
7. Future Directions
Open research directions include:
- Extending frameworks to high-dimensional, continuous control, and adversarial or partially observable decision-making.
- Tight coupling of executable counterfactuals with learned or hybrid mechanistic–statistical models to bridge physics, data, and logical feasibilities.
- Enabling scalable, interactive generation—and verification—of counterfactual explanations in large, real-world systems, from robotics controllers to AI-assisted recourse for policy and medical interventions.
- Studying the integration of global constraints (fairness, safety, regulatory) and their enforcement through realizability-aware counterfactual planning (Raghavan et al., 14 Mar 2025, Karvanen et al., 2023).
In sum, executable counterfactuals provide the mathematically principled bridge between hypothetical counterfactual reasoning and actionably grounded, intervention-compliant recommendations in dynamic, causal, and multi-step environments. These constructs unify control theory, causal inference, decision processes, and recourse under a rigorous executability criterion, enabling minimally invasive yet fully realizable intervention strategies across science and engineering domains.