---
title: 'ACE: Adaptive Sampling for Counterfactual Explanations'
url: https://www.emergentmind.com/topics/adaptive-sampling-for-counterfactual-explanations-ace
type: topic
---

# ACE: Adaptive Sampling for Counterfactual Explanations

Adaptive sampling for Counterfactual Explanations (ACE) denotes a family of counterfactual-generation procedures in which search, synthesis, or refinement effort is allocated non-uniformly toward informative regions of the input space. In the narrow sense, the term refers to the binary-classification method that combines Bayesian estimation and stochastic optimization to approximate a decision boundary with fewer black-box queries [2509.26322]. In a broader ACE-style reading, adjacent work treats adaptivity as model-conditioned augmentation along decision boundaries [2210.12196], reuse of native counterfactual templates selected by similarity [2101.09056], biased-yet-reweighted query sampling via umbrella sampling [2106.08971], distribution-aware metric design [2410.14522], or timestep-wise localized diffusion masks for visual explanations [2602.18792]. This suggests that ACE is both a named algorithm and a broader design pattern for concentrating counterfactual search on informative, plausible, or underrepresented regions.

## 1. Problem formulation and conceptual scope

In the black-box formulation of ACE, a trained binary classifier is written as \(h:\mathcal{X}\to\{0,1\}\), and for an instance \(\tilde{x}\) with prediction \(\tilde{y}=h(\tilde{x})\), a counterfactual explanation is defined as the solution of
\[
\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},
\]
where
\[
\mathcal{S}_{db}=\{x\in\mathcal{X}: h(x)\neq h(\tilde{x})\}.
\]
Under this definition, a CFE is the closest point to \(\tilde{x}\) that would change the classifier’s prediction [2509.26322].

The same literature also treats “smallest change” as a structured notion rather than a purely geometric one. The 2025 ACE method uses Euclidean distance for proximity, \(\ell_1\) for sparsity, explicit actionability constraints on immutable features, and a plausibility term based on Local Outlier Factor. Related papers broaden the target further: one line seeks sparse, plausible, and diverse tabular counterfactuals by adapting “nearest unlike neighbour” templates [2101.09056]; another seeks query-conditional counterfactual distributions rather than a single nearest point [2106.08971]; another reframes similarity through a joint distribution over reference and counterfactual rather than a local \(\ell_2\) ball [2410.14522]; and visual methods increasingly treat counterfactual generation as localized sampling near decision-relevant regions [2210.12196], [2602.18792].

A recurrent motivation is sample inefficiency. Existing black-box CFE methods are described as often requiring thousands to hundreds of thousands of calls to a model, with global or weakly informed search becoming impractical when access is costly or rate-limited [2509.26322]. Adaptive sampling addresses that difficulty by learning where to query, which templates to reuse, which regions of an image to edit, or which query strata need oversampling.

## 2. The 2025 ACE algorithm

The specific algorithm titled ACE formulates the classifier as a thresholded smooth latent function,
\[
h(x)=\mathbb{H}(f(x)),
\]
with the decision boundary approximated by the level set \(f(x)=0.5\). It then replaces the constrained optimization with a penalty formulation,
\[
\underset{x}{\text{minimize}\quad d(x,\tilde{x})+\lambda_k|f(x)-0.5|.
\]
The extended objective incorporates sparsity, actionability, and plausibility:
\[
\underset{x\in\mathcal{A}\subset\mathcal{X}}{\arg\min}\; \underbrace{d(x,\tilde{x}) + \lambda_k |f(x)-0.5|}_{\text{proximity to instance and boundary}}
+ \underbrace{\beta\,g(x-\tilde{x})}_{\text{sparsity}}
+ \underbrace{l(x;X)}_{\text{plausibility}}.
\]
Here \(\mathcal{A}\) fixes immutable features, \(g(x-\tilde{x})=\|x-\tilde{x}\|_1\), and \(l(x;X)\) is an LOF-based plausibility term [2509.26322].

The adaptive component is a Bayesian optimization loop over that penalized cost. ACE fits a Gaussian Process classifier surrogate \(\hat f\) with a Matérn \(5/2\) kernel, updates it after each new query, and chooses the next query by maximizing Expected Improvement,
\[
\text{EI}_n(x) := \mathbb{E}_n\Big\{[J_n^\ast - J(x)]_+\Big\}.
\]
Because \(J(x)\) depends on the random surrogate, EI is estimated by Monte Carlo using correlated samples of \(\hat f(x)\) and \(\hat f(x^\ast)\). Continuous variables are optimized by multi-start L-BFGS-B; categorical variables are handled by Branch-and-Bound over integer-coded features. The penalty parameter is increased as \(\lambda_k\leftarrow\lambda_k^p\), driving the search toward \(f(x)=0.5\), and a final Sobol sampling stage extracts the surrogate point closest to posterior probability \(0.5\) and nearest to \(\tilde{x}\) [2509.26322].

The implementation reported in the paper uses \(\lambda_0=10\), \(\lambda_{\max}=10^{15}\), \(p=1.5\), \(MC=1000\), \(SS=8000\), \(\beta=5\), and convergence tolerance \(\epsilon=10^{-3}\). All distances are computed feature-wise normalized. The GP posterior is obtained by Laplace approximation, and the approximate class probability is computed through a probit approximation in logistic-GP classification. No explicit theorem with asymptotic query complexity is given, but the method is positioned within standard Bayesian optimization theory and penalty-method convergence arguments [2509.26322].

## 3. ACE-style adaptive mechanisms in related literature

The literature contains several non-equivalent mechanisms that can be read as ACE-style because each reallocates counterfactual effort toward informative regions, but they do so at different stages of the pipeline.

| Work | Adaptive mechanism | Primary locus |
|---|---|---|
| ACE [2509.26322] | GP surrogate + EI + penalty schedule | Black-box query selection |
| Augmentation by Counterfactual Explanation [2210.12196] | Counterfactual generation conditioned on a fixed classifier | Boundary-focused data augmentation |
| A Few Good Counterfactuals [2101.09056] | k-NN selection of explanation cases and NUN adaptation | Template reuse in tabular space |
| Model-Based Counterfactual Synthesizer [2106.08971] | Umbrella sampling with reweighting | Query-space training distribution |
| Rethinking Distance Metrics [2410.14522] | Joint-distribution Mahalanobis geometry | Proposal metric and search direction |
| MaskDiME [2602.18792] | Gradient-derived dual masks recomputed per diffusion step | Localized visual sampling |

In the augmentation-based line, a pre-trained classifier \(f_\theta\) is paired with a Progressive Counterfactual Explainer, a conditional GAN trained with adversarial loss, classifier consistency, and reconstruction constraints. Counterfactuals are generated along trajectories that move mass from the original class to a chosen counterfactual class through low-confidence regions, and the classifier is fine-tuned on a mixture of roughly \(70\%\) real data and \(30\%\) generated counterfactuals [2210.12196]. The adaptivity here is implicit: the generator is trained against the fixed classifier and therefore learns its current decision surface.

In the explanation-case line, adaptive sampling is data-driven rather than gradient-driven. A target instance is matched to the \(k\) nearest explanation cases whose sources share the same class, then each case is expanded through the native counterfactual and its like-neighbours, with candidates validated by requiring the classifier to predict the class of the original NUN [2101.09056]. In the query-conditional generative line, umbrella sampling oversamples rare query regions while importance reweighting preserves the original query distribution during training [2106.08971]. In the visual diffusion line, MaskDiME computes a gradient relevance map at every reverse step and defines two masks, \(M_t^z\) and \(M_t^x\), so that only decision-relevant pixels are stochastically updated [2602.18792].

This broader comparison indicates that “adaptive sampling” in counterfactual explanation is not tied to a single optimizer. It may refer to query selection, template retrieval, density-aware geometry, conditional data generation, or localized sampling within a generative process.

## 4. Objectives, geometry, and structural constraints

Across the literature, adaptivity is expressed through distinct mathematical objects. In native-template methods, the basic unit is an explanation case built from a nearest unlike neighbour:
\[
xc_d(x,x') \Rightarrow \text{NUN}(x,x') \wedge |\text{diffs}(x,x')| \le d,
\]
and the case base is
\[
XC_d = \{ xc_d(x,x') \mid x, x' \in I \}.
\]
Sparsity is therefore enforced as a hard constraint on the number of differing features rather than as an explicit \(L_0\) or \(L_1\) regularizer [2101.09056].

In the distribution-aware metric line, the proximity term itself becomes adaptive. Instead of \(\|x'-x\|_2^2\), the proposed similarity is
\[
d_{\text{joint}}(x,x') = (x' - c(x))^\top \Lambda (x' - c(x)),
\qquad
c(x) = (1-\alpha)\mu + \alpha x.
\]
The center of the search is interpolated between the population mean \(\mu\) and the reference \(x\), and the precision matrix \(\Lambda\) makes the geometry Mahalanobis rather than Euclidean [2410.14522]. Directions with high data variance are cheaper, and directions violating covariate dependencies are more expensive.

In classifier-conditioned augmentation, the key control variable is a continuous conditioning vector \(c\). For an original class \(k\) and a counterfactual class \(k_c\), the generator traverses a path by decreasing \(c[k]\) from \(1\) to \(0\), with \(c[k_c]=1-c[k]\) and all other coordinates set to \(0\). The reported semantics are explicit: \(c[k]\in[0.8,1.0]\) denotes a high-likelihood region for the original class, \(c[k]\in[0.5,0.8)\) movement toward the decision hyper-plane, \(c[k]\in[0.2,0.5)\) points just across the decision boundary, and \(c[k]\in[0.0,0.2)\) a high-likelihood region for the counterfactual class [2210.12196].

In query-conditional generative training, the adaptive object is the query distribution itself. Umbrella sampling defines biased query windows \(\mathcal{P}_{\mathbf{q}^i}\) through umbrella profiles \(u_i(\mathbf{q})\), then reconstructs expectations under the original \(\mathcal{P}_{\mathbf{q}}\) by solving for the weight vector \(\mathbf{w}\) satisfying \(\mathbf{wM}=\mathbf{w}\) [2106.08971]. In localized diffusion, the adaptive object is a spatial mask recomputed at each reverse step from classifier gradients: the noisy-level mask selects the top \(k\%\) of relevance values, and the clean-level mask selects the top \(\rho k\%\) within that region [2602.18792].

A plausible implication is that ACE methods can be organized by which quantity is adaptively updated: the candidate points, the metric, the data distribution, the support region, or the explanatory template.

## 5. Empirical findings and evaluation regimes

The 2025 ACE algorithm is primarily evaluated by black-box query count, proximity, sparsity, plausibility, and validity. On fixed-instance tests, reported query counts are approximately \(70\) on Diabetes, \(56\)–\(57\) on KC2, and \(60\)–\(67\) on Tic-Tac-Toe, compared with BayCon at \(1200\)–\(1500\), \(3500\)–\(3700\), and \(900\)–\(1500\), MOC at about \(2000\) or \(289\)–\(304\), and Growing Spheres at roughly \(28\)k–\(69\)k, \(100\)k–\(139\)k, or up to about \(1\)M queries with failures, respectively [2509.26322]. Validity is reported as typically \(\mathcal{V}\approx 1\), and plausibility \(\alpha(x)\approx 1\), whereas BayCon often yields \(\alpha(x)\approx 0.2\)–\(0.3\). On a 2D make-moons example, ACE needs \(14\) evaluations for a CFE distance of about \(0.68\), whereas Growing Spheres uses \(501\) evaluations for a slightly shorter distance of \(0.592\) but changes both coordinates.

The explanation-case approach is evaluated by test coverage, relative distance, and feature diversity. For \(d\le 2\), coverage improves significantly over the 1NN* baseline for all datasets and \(k>1\), exceeds \(80\%\) in all datasets for sufficiently large \(k\), and is increased by almost a factor of \(2\) on average. Relative distance decreases by about \(3\times\) on average, and feature diversity often improves by about \(3\times\) over 1NN* [2101.09056]. These results formalize an adaptive trade-off between sparsity, coverage, and diversity through the parameters \(d\) and \(k\).

In uncertainty-focused augmentation, the gains are measured on ambiguous in-distribution samples, near-OOD, far-OOD, and calibration. On AFHQ, ambiguous-sample detection improves from baseline AUC-ROC \(0.87\) to \(0.91\); on skin lesions, TNR@TPR95 improves from about \(20.5\%\) to about \(71.6\%\). For near-OOD detection on Dirty MNIST, AUC-ROC improves from \(0.86\) to \(0.94\). For far-OOD detection, discriminator-based AUC-ROC values such as \(0.98\) on AFHQ versus CIFAR10 and \(0.96\) on CelebA versus AFHQ are reported, together with robustness improvements under FGSM, CW, and DeepFool attacks [2210.12196].

Visual localized sampling emphasizes fidelity, flip rate, and efficiency. MaskDiME is reported as more than \(30\times\) faster than DiME, about \(2.5\times\) faster than FastDiME, and to use peak GPU memory of about one tenth of ACE and RCSB on CelebA. On CelebA Smile, it reports FID \(=0.71\) versus ACE \(\ell_1=1.27\) and ACE \(\ell_2=1.90\); on ImageNet Sorrel–Zebra, it reports FR \(=99.7\%\) versus ACE \(\ell_1=47\%\) and ACE \(\ell_2=81\%\) [2602.18792]. Query-conditional generative training with umbrella sampling also reports substantially lower inference time than algorithm-based methods when generating counterfactuals for \(10\), \(20\), or \(30\) queries, while MCS-US improves modeling of rare categories relative to MCS-base and log-frequency sampling [2106.08971]. Distribution-aware metric replacement consistently increases yNN across multiple datasets, usually with only modest increases in \(\ell_2\) proximity cost [2410.14522].

## 6. Limitations, misconceptions, and open problems

A common misconception is that adaptive sampling for counterfactual explanations denotes a single algorithm. In fact, only one work in the supplied corpus names itself ACE in that exact sense [2509.26322]. The augmentation paper uses ACE to mean “Augmentation by Counterfactual Explanation,” and its adaptivity is single-shot: the Progressive Counterfactual Explainer is trained against the initial classifier, but the generator is not retrained after the classifier is fine-tuned [2210.12196]. The explanation-case method is adaptive without gradients, the umbrella-sampling method is adaptive during training rather than inference, and MaskDiME is adaptive at every diffusion timestep [2101.09056], [2106.08971], [2602.18792].

The black-box ACE algorithm inherits the usual limitations of GP-based Bayesian optimization: naive GP training is \(O(n^3)\), performance depends on kernel choice, and the published method currently focuses on binary classification [2509.26322]. The augmentation approach depends on the quality and cost of training a conditional StyleGANv2-like generator and discriminator, and poor GAN training produces unrealistic augmentations and degraded performance [2210.12196]. Native-template methods depend on the existence of useful explanation cases; the cited motivation is that in \(95\%\) of examined datasets, fewer than \(1\%\) of instances had a native counterfactual with \(\le 2\) feature differences [2101.09056]. Umbrella sampling introduces its own design burden through the number and shape of windows, overlap estimation, and causal-graph specification for the generator [2106.08971].

Metric-based adaptivity is not uniformly beneficial. The joint-distribution metric assumes Gaussian structure, requires covariance estimation, and can encourage redundant changes when principal axes are poorly aligned with decision-relevant directions [2410.14522]. Localized diffusion depends on the quality of classifier gradients; on ImageNet, gradients may be noisy and spatially inconsistent, and evaluation remains indirect because ground-truth counterfactual annotations are generally unavailable [2602.18792].

The research directions stated across the papers are correspondingly heterogeneous. Proposed extensions include multi-class classification, regression, fairness and monotonicity constraints, and explicit diversity objectives for the 2025 ACE framework [2509.26322]; adaptive \(k\) selection, uncertainty-based sampling, density-aware sampling, and active learning loops for explanation-case reuse [2101.09056]; latent Gaussian formulations and causal extensions for distribution-aware metrics [2410.14522]; adaptive scheduling of umbrella windows and alternative biasing potentials in query-space generative training [2106.08971]; iterative retraining cycles for counterfactual augmentation [2210.12196]; and learned or more robust mask extractors for localized diffusion [2602.18792]. Taken together, these directions indicate that adaptive sampling in counterfactual explanation remains a methodological family rather than a settled recipe.

Source: https://www.emergentmind.com/topics/adaptive-sampling-for-counterfactual-explanations-ace