arXiv:2609.07917cs.LGSep 2026

Manuscript Offprint

arXiv:2609.07917

AVCG: A Generalized Variational Framework for Counterfactual Generation under Hypothesis Distributions

Jamie Duell, Alejandro Jimenez Rodriguez, Mahault Albarracin

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Counterfactual explanations formalize “what-if” scenarios by identifying modifications to an input instance that obtain a desired alternative prediction. Traditionally, whether generated via instance-specific optimization or amortized single-pass models, these approaches rely on a single, deterministic point-estimate predictor. However, this ignores predictive uncertainty and hypothesis variability, leading to brittle explanations that frequently become invalid if the underlying model is retrained or updated. To address this fragility, we propose the Amortized Variational Counterfactual Generator (AVCG), a generalized optimization framework that formulates counterfactual generation as optimization over an arbitrary distribution of plausible predictive hypotheses rather than a single deterministic predictor. This formulation naturally accommodates Bayesian posteriors, Rashomon-restricted hypothesis spaces, and other uncertainty representations within a unified optimization framework. Evaluation across multiple benchmark datasets demonstrates that the AVCG framework produces counterfactual explanations that remain highly valid under predictive uncertainty and model changes, while maintaining competitive plausibility and single-pass runtime performance.

Introduction

The deployment of machine learning models in high-stakes domains has necessitated the development of algorithmic recourse, typically provided through counterfactual explanations. However, a critical vulnerability in standard counterfactual generation is its reliance on a single, fixed predictive model. Explanations optimized against a deterministic decision boundary are often notoriously brittle; they frequently fail to remain valid if the model is retrained with a different random seed, subjected to minor data shifts, or if there is inherent epistemic uncertainty in the parameter space (Jiang et al. 2024; Sokol and Hüllermeier 2025).

To provide reliable recourse, counterfactual generation must transition from targeting a single point-estimate predictor to optimizing over distributions of plausible hypotheses. Such hypothesis distributions arise naturally in several settings. Bayesian predictive models represent predictive uncertainty through posterior inference, as expressed through Bayesian Neural Networks (Blundell et al. 2015) and Monte Carlo Dropout (Gal and Ghahramani 2016), while model

multiplicity motivates restricting attention to empirically near-optimal hypotheses, such as the Rashomon set. Many existing uncertainty-aware counterfactual approaches, however, are typically tied to a specific uncertainty representation and frequently rely on computationally expensive post-hoc optimization at inference time. Notably, existing approaches remain specialized to particular uncertainty representations e.g., (Schut et al. 2021; Duell et al. 2024) rather than providing a unified optimization framework capable of operating over arbitrary hypothesis distributions. For example, while Bayesian approaches optimize robustness in expectation under a posterior distribution, they do not directly support optimization over constrained hypothesis spaces, such as the Rashomon set (Hsu et al. 2025), where the objective is robustness across empirically near-optimal models rather than posterior expectation alone. Recent work has shown that Monte Carlo Dropout can be used to construct empirical approximations of such Rashomon sets by applying dropout to pretrained weights (Hsu et al. 2024).

To address these limitations, we propose the Amortized Variational Counterfactual Generator (AVCG), a generalized optimization framework for counterfactual generation over arbitrary hypothesis distributions. Unlike existing uncertainty-aware approaches (Duell et al. 2024; Batten et al. 2025; Schut et al. 2021) that predominantly generate explanations through iterative post-hoc optimization at inference time, AVCG learns a single amortized generator that produces counterfactuals in one forward pass while optimizing expected validity with respect to an arbitrary hypothesis distribution. Thus, the proposed AVCG framework generalizes the optimization objective beyond deterministic or Bayesian predictors and retains the computational efficiency required for practical deployment. Thus, to summarise AVCG shifts counterfactual generation from optimizing against a single decision boundary to optimizing against an entire distribution of plausible decision boundaries. This abstraction decouples the optimization objective from the mechanism used to represent uncertainty, allowing new uncertainty models or constrained hypothesis spaces to be incorporated without redesigning the counterfactual generation framework.

To this end, the contributions of this work can be summarized as follows:

  1. We formulate counterfactual generation as optimiza-tion over arbitrary hypothesis distributions, introducing AVCG, a generalized variational framework independent of any specific uncertainty representation.

  2. We derive a generalized variational lower bound whose predictive objective is taken with respect to arbitrary hypothesis distributions, subsuming existing Bayesian formulations as special cases.

  3. We demonstrate the generality of AVCG by instantiated two fundamentally different robustness paradigms: Bayesian uncertainty and Rashomon model multiplicity, within a single optimization framework.

  4. We provide theoretical and empirical evaluations demonstrating robustness, validity and inference speed.

References (21)