ACE: Adaptive Sampling for Counterfactual Explanations
- The paper introduces the 2025 ACE algorithm that leverages Bayesian optimization and Gaussian Process surrogates to approximate decision boundaries with significantly fewer model queries.
- ACE adapts query allocation via penalty formulations and localized sampling, balancing proximity, sparsity, and plausibility in counterfactual generation.
- Empirical evaluations demonstrate up to 30× reduction in query counts while improving explanation validity and efficiency compared to traditional methods.
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 (Guerrero et al., 30 Sep 2025). In a broader ACE-style reading, adjacent work treats adaptivity as model-conditioned augmentation along decision boundaries (Singla et al., 2022), reuse of native counterfactual templates selected by similarity (Smyth et al., 2021), biased-yet-reweighted query sampling via umbrella sampling (Yang et al., 2021), distribution-aware metric design (Williams et al., 2024), or timestep-wise localized diffusion masks for visual explanations (Guo et al., 21 Feb 2026). 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 , and for an instance with prediction , 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
Under this definition, a CFE is the closest point to that would change the classifier’s prediction (Guerrero et al., 30 Sep 2025).
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, 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 (Smyth et al., 2021); another seeks query-conditional counterfactual distributions rather than a single nearest point (Yang et al., 2021); another reframes similarity through a joint distribution over reference and counterfactual rather than a local ball (Williams et al., 2024); and visual methods increasingly treat counterfactual generation as localized sampling near decision-relevant regions (Singla et al., 2022, Guo et al., 21 Feb 2026).
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 (Guerrero et al., 30 Sep 2025). 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,
with the decision boundary approximated by the level set . It then replaces the constrained optimization with a penalty formulation,
0
The extended objective incorporates sparsity, actionability, and plausibility: 1 Here 2 fixes immutable features, 3, and 4 is an LOF-based plausibility term (Guerrero et al., 30 Sep 2025).
The adaptive component is a Bayesian optimization loop over that penalized cost. ACE fits a Gaussian Process classifier surrogate 5 with a Matérn 6 kernel, updates it after each new query, and chooses the next query by maximizing Expected Improvement,
7
Because 8 depends on the random surrogate, EI is estimated by Monte Carlo using correlated samples of 9 and 0. 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 1, driving the search toward 2, and a final Sobol sampling stage extracts the surrogate point closest to posterior probability 3 and nearest to 4 (Guerrero et al., 30 Sep 2025).
The implementation reported in the paper uses 5, 6, 7, 8, 9, $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$0, and convergence tolerance $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$1. 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 (Guerrero et al., 30 Sep 2025).
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 (Guerrero et al., 30 Sep 2025) | GP surrogate + EI + penalty schedule | Black-box query selection |
| Augmentation by Counterfactual Explanation (Singla et al., 2022) | Counterfactual generation conditioned on a fixed classifier | Boundary-focused data augmentation |
| A Few Good Counterfactuals (Smyth et al., 2021) | k-NN selection of explanation cases and NUN adaptation | Template reuse in tabular space |
| Model-Based Counterfactual Synthesizer (Yang et al., 2021) | Umbrella sampling with reweighting | Query-space training distribution |
| Rethinking Distance Metrics (Williams et al., 2024) | Joint-distribution Mahalanobis geometry | Proposal metric and search direction |
| MaskDiME (Guo et al., 21 Feb 2026) | Gradient-derived dual masks recomputed per diffusion step | Localized visual sampling |
In the augmentation-based line, a pre-trained classifier $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$2 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 $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$3 real data and $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$4 generated counterfactuals (Singla et al., 2022). 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 $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$5 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 (Smyth et al., 2021). In the query-conditional generative line, umbrella sampling oversamples rare query regions while importance reweighting preserves the original query distribution during training (Yang et al., 2021). In the visual diffusion line, MaskDiME computes a gradient relevance map at every reverse step and defines two masks, $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$6 and $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$7, so that only decision-relevant pixels are stochastically updated (Guo et al., 21 Feb 2026).
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: $\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$8 and the case base is
$\underset{x}{\text{minimize}\quad d(x,\tilde{x}) \quad\text{s.t.}\quad x\in\mathcal{S}_{db},$9
Sparsity is therefore enforced as a hard constraint on the number of differing features rather than as an explicit 0 or 1 regularizer (Smyth et al., 2021).
In the distribution-aware metric line, the proximity term itself becomes adaptive. Instead of 2, the proposed similarity is
3
The center of the search is interpolated between the population mean 4 and the reference 5, and the precision matrix 6 makes the geometry Mahalanobis rather than Euclidean (Williams et al., 2024). 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 7. For an original class 8 and a counterfactual class 9, the generator traverses a path by decreasing 0 from 1 to 2, with 3 and all other coordinates set to 4. The reported semantics are explicit: 5 denotes a high-likelihood region for the original class, 6 movement toward the decision hyper-plane, 7 points just across the decision boundary, and 8 a high-likelihood region for the counterfactual class (Singla et al., 2022).
In query-conditional generative training, the adaptive object is the query distribution itself. Umbrella sampling defines biased query windows 9 through umbrella profiles 0, then reconstructs expectations under the original 1 by solving for the weight vector 2 satisfying 3 (Yang et al., 2021). 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 4 of relevance values, and the clean-level mask selects the top 5 within that region (Guo et al., 21 Feb 2026).
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 6 on Diabetes, 7–8 on KC2, and 9–0 on Tic-Tac-Toe, compared with BayCon at 1–2, 3–4, and 5–6, MOC at about 7 or 8–9, and Growing Spheres at roughly 0k–1k, 2k–3k, or up to about 4M queries with failures, respectively (Guerrero et al., 30 Sep 2025). Validity is reported as typically 5, and plausibility 6, whereas BayCon often yields 7–8. On a 2D make-moons example, ACE needs 9 evaluations for a CFE distance of about 0, whereas Growing Spheres uses 1 evaluations for a slightly shorter distance of 2 but changes both coordinates.
The explanation-case approach is evaluated by test coverage, relative distance, and feature diversity. For 3, coverage improves significantly over the 1NN* baseline for all datasets and 4, exceeds 5 in all datasets for sufficiently large 6, and is increased by almost a factor of 7 on average. Relative distance decreases by about 8 on average, and feature diversity often improves by about 9 over 1NN* (Smyth et al., 2021). These results formalize an adaptive trade-off between sparsity, coverage, and diversity through the parameters 00 and 01.
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 02 to 03; on skin lesions, TNR@TPR95 improves from about 04 to about 05. For near-OOD detection on Dirty MNIST, AUC-ROC improves from 06 to 07. For far-OOD detection, discriminator-based AUC-ROC values such as 08 on AFHQ versus CIFAR10 and 09 on CelebA versus AFHQ are reported, together with robustness improvements under FGSM, CW, and DeepFool attacks (Singla et al., 2022).
Visual localized sampling emphasizes fidelity, flip rate, and efficiency. MaskDiME is reported as more than 10 faster than DiME, about 11 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 12 versus ACE 13 and ACE 14; on ImageNet Sorrel–Zebra, it reports FR 15 versus ACE 16 and ACE 17 (Guo et al., 21 Feb 2026). Query-conditional generative training with umbrella sampling also reports substantially lower inference time than algorithm-based methods when generating counterfactuals for 18, 19, or 20 queries, while MCS-US improves modeling of rare categories relative to MCS-base and log-frequency sampling (Yang et al., 2021). Distribution-aware metric replacement consistently increases yNN across multiple datasets, usually with only modest increases in 21 proximity cost (Williams et al., 2024).
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 (Guerrero et al., 30 Sep 2025). 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 (Singla et al., 2022). 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 (Smyth et al., 2021, Yang et al., 2021, Guo et al., 21 Feb 2026).
The black-box ACE algorithm inherits the usual limitations of GP-based Bayesian optimization: naive GP training is 22, performance depends on kernel choice, and the published method currently focuses on binary classification (Guerrero et al., 30 Sep 2025). 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 (Singla et al., 2022). Native-template methods depend on the existence of useful explanation cases; the cited motivation is that in 23 of examined datasets, fewer than 24 of instances had a native counterfactual with 25 feature differences (Smyth et al., 2021). Umbrella sampling introduces its own design burden through the number and shape of windows, overlap estimation, and causal-graph specification for the generator (Yang et al., 2021).
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 (Williams et al., 2024). 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 (Guo et al., 21 Feb 2026).
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 (Guerrero et al., 30 Sep 2025); adaptive 26 selection, uncertainty-based sampling, density-aware sampling, and active learning loops for explanation-case reuse (Smyth et al., 2021); latent Gaussian formulations and causal extensions for distribution-aware metrics (Williams et al., 2024); adaptive scheduling of umbrella windows and alternative biasing potentials in query-space generative training (Yang et al., 2021); iterative retraining cycles for counterfactual augmentation (Singla et al., 2022); and learned or more robust mask extractors for localized diffusion (Guo et al., 21 Feb 2026). Taken together, these directions indicate that adaptive sampling in counterfactual explanation remains a methodological family rather than a settled recipe.