NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Finding Counterfactually Optimal Action Sequences in Continuous State Spaces

Stratis Tsirtsis, Manuel Gomez-Rodriguez · DOI

Abstract

Retrospective analysis in high-stakes domains like medicine often hinges on counterfactual questions: "What would have happened if a different action had been taken?" While Reinforcement Learning excels at forward-looking policy optimization, identifying optimal counterfactual action sequences in continuous state spaces remains a significant challenge. This paper introduces a framework that combines Bijective Structural Causal Models (SCMs) with a specialized A* search algorithm. By leveraging Lipschitz continuity to derive consistent heuristics, the proposed method efficiently navigates the NP-hard search space of continuous states to find optimal "what-if" scenarios.

Introduction

In fields such as clinical medicine or autonomous driving, experts frequently perform retrospective audits. For instance, a physician might ask if a patient's recovery would have been accelerated had antibiotics been administered earlier. This is the essence of counterfactual reasoning.

Existing methods for "retrospective optimization" typically assume discrete state spaces (e.g., grid worlds), where every possible state can be enumerated. However, real-world variables like blood pressure, temperature, or velocity are continuous. In these environments, the number of possible paths is infinite, and finding an alternative sequence that is "close" to the observed history (e.g., changing only a few actions) introduces a combinatorial explosion. This paper proves that finding the optimal counterfactual sequence in continuous space is NP-hard, necessitating smarter search strategies.

Methodology

The authors bridge the gap between causal inference and sequential decision-making using three key components:

Bijective Structural Causal Models (SCMs)

To "replay" a specific individual's history, the environment's transitions are modeled using SCMs. By ensuring the model is bijective, the specific "noise" or randomness (e.g., a patient's unique physiological response) can be uniquely recovered from observed data. This makes the counterfactual world deterministic for that specific episode.

Causal graph showing the relationship between states (S), actions (A), and recovered noise variables (U, Z).

A* Search with Lipschitz Heuristics

To overcome the NP-hardness of the search, the researchers employ an A algorithm. The efficiency of A depends on a "consistent heuristic" that estimates the remaining reward without overestimating it. The authors derive this heuristic from the Lipschitz continuity of the environment. If two states are proximal in the continuous space, their potential future rewards are mathematically bounded. This property provides a "safety net" that allows the algorithm to prune large parts of the search space safely.

Monte Carlo Anchor Sets

To accelerate the search, the algorithm uses "anchor" states sampled via Monte Carlo simulations. The rewards for these anchors are pre-calculated, and Lipschitz bounds are used to interpolate upper bounds for any new state encountered during the search.

The search graph (a) illustrates the branching of counterfactual actions, while the heuristic computation (b) shows how Lipschitz bounds and anchor states are used to prune the search space.

Key Results and Clinical Impact

The framework was evaluated on a cohort of 15,992 sepsis patients from the MIMIC-III dataset. The state space included 13 vital features, and actions consisted of 25 dosage combinations of vasopressors and IV fluids.

  • Computational Efficiency: Despite a search space exceeding 3 million possible sequences, the A* algorithm found optimal solutions by exploring only a tiny fraction of paths, effectively reducing the branching factor to approximately 2.1.
  • Clinical Relevance: For 176 patients, the model identified that changing just three past actions could have improved SOFA scores (a measure of organ failure) by at least 15%.
  • Plausibility: Qualitative analysis showed the model's suggestions, such as earlier IV fluid administration for specific septic shock cases, often aligned with established medical guidelines.

Discussion and Future Work

While powerful, the method's success depends on the accuracy of the underlying SCM and the assumption of "no unobserved confounding"—the absence of hidden factors influencing both decisions and outcomes. While A* is faster than brute force, it remains an exponential-time algorithm in the worst case. Future work will look into polynomial-time approximation algorithms that offer "good enough" counterfactuals with guaranteed speed.

Summary updated

BibTeX
@inproceedings{tsirtsis2023finding,
  author = {Stratis Tsirtsis and Manuel Gomez-Rodriguez},
  title = {{Finding Counterfactually Optimal Action Sequences in Continuous State Spaces}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=YDCpf85eXc},
}
Figure