Counterfactual Maps: What They Are and How to Find Them
Awa Khouna, Julien Ferry, Thibaut Vidal
NeurIPS 2026
TL;DR. Tree ensembles induce axis-aligned regions. We index them with a volumetric KD-tree to build a counterfactual map that maps any point to its nearest oppositely labeled region. This yields optimal counterfactual explanations in sublinear average time.
Abstract. Counterfactual explanations are a central tool in interpretable machine learning, yet computing them exactly for complex models remains challenging. For tree ensembles, predictions are piecewise constant over a large collection of axis-aligned hyperrectangles, implying that an optimal counterfactual for a point corresponds to its projection onto the nearest rectangle with an alternative label under a chosen metric. Existing methods largely overlook this geometric structure, relying either on heuristics with no optimality guarantees or on mixed-integer programming formulations that do not scale to interactive use. In this work, we revisit counterfactual generation through the lens of nearest-region search and introduce counterfactual maps, a global representation of recourse. Leveraging the fact that any tree ensemble can be compressed into an equivalent partition of labeled hyperrectangles, we cast counterfactual search as the problem of identifying the generalized Voronoi cell associated with the nearest rectangle of an alternative label. This leads to an exact, amortized algorithm based on volumetric k-dimensional (KD) trees, which performs branch-and-bound nearest-region queries with explicit optimality certificates and sublinear average query time after a one-time preprocessing phase. Our experimental analyses across several real datasets from high-stakes application domains show that this approach delivers globally optimal counterfactual explanations with millisecond-level latency, achieving query times that are orders of magnitude faster than existing exact, cold-start optimization methods.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:45 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
Tree ensembles are still widely used in many domains dealing with tabular datasets, where there are also requirements of interpretability. Think financial services. The submission casts counterfactual generation for tree ensembles as a nearest-region search problem. Tree ensembles partition the input space into axis-aligned hyperrectangles with constant predictions, so a globally optimal counterfactual is the projection onto the nearest hyperrectangle carrying the target label. In particular, the ensemble's hyperrectangle partition is computed via via Born-Again Trees, which may limit scalability, but the indexing with a volumetric KD-tree per target class is scalable. This beats three heuristic baselines (FT, LIRE, DiCE).
Strengths:
This is a substantial contribution towards the explainable AI literature.
Weaknesses:
The scalability of Born-Again Trees has been discussed. While it may be perceived as a shortcoming, it additional experiments reported by the authors in the discussion should get translated into the additional page of text of the paper in the camera ready version.
Final justification
The authors have provided a detailed rebuttal, including additional scalability experiments suggested by the reviewers. Together with the subsequent discussion, this led to improved scores and the suggestion that the paper be accepted.
Read meta-review
Meta-review
Tree ensembles are still widely used in many domains dealing with tabular datasets, where there are also requirements of interpretability. Think financial services. The submission casts counterfactual generation for tree ensembles as a nearest-region search problem. Tree ensembles partition the input space into axis-aligned hyperrectangles with constant predictions, so a globally optimal counterfactual is the projection onto the nearest hyperrectangle carrying the target label. In particular, the ensemble's hyperrectangle partition is computed via via Born-Again Trees, which may limit scalability, but the indexing with a volumetric KD-tree per target class is scalable. This beats three heuristic baselines (FT, LIRE, DiCE).
Strengths:
This is a substantial contribution towards the explainable AI literature.
Weaknesses:
The scalability of Born-Again Trees has been discussed. While it may be perceived as a shortcoming, it additional experiments reported by the authors in the discussion should get translated into the additional page of text of the paper in the camera ready version.
Final justification
The authors have provided a detailed rebuttal, including additional scalability experiments suggested by the reviewers. Together with the subsequent discussion, this led to improved scores and the suggestion that the paper be accepted.
1 comment
- Rating
- 5/6
- Confidence
- 4/5
- Quality
- 4/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper introduces a new efficient framework of optimal counterfactual explanation for tree ensemble models. The proposed method first extracts a set of regions from a learned tree ensemble and then constructs a KD-tree to store them. Given a query instance, the proposed algorithm can efficiently obtain an optimal counterfactual by searching the KD-tree using a pruning technique based on a cost lower bound. Through extensive experiments on real datasets, the authors demonstrated that the proposed method achieved superior or comparable scalability to the existing exact or heuristic methods, while maintaining solution optimality.
Strengths and weaknesses
Strengths
- This paper is well-written, well-motivated, and easy to follow.
- The design of the proposed method looks reasonable. I think the amortized approach is practical and effective because it is natural to anticipate situations where we need to handle multiple queries in real-world applications.
- The authors conducted extensive experiments and demonstrated that the proposed approach was efficient while ensuring solution optimality compared with existing methods.
Weaknesses
- My main concern is the technical novelty, as the proposed method seems to largely depend on BA-Trees, i.e., the existing technique.
- The paper shows the relationship between CE for tree ensembles and the generalized Voronoi partition in Figure 1 and in Proposition 2.2, but it looks unclear how this property is exploited in the proposed algorithm and how it contributes to the efficiency of the method.
Questions
- Algorithm 1 first enumerates regions by BA-Trees and then constructs a KD-tree that stores enumerated regions. What is the time complexity of constructing such a KD-tree? Also, how is the space complexity of the KD-tree compared to simply storing the enumerated regions?
Limitations
yes
Final justification
Thank you for addressing my questions. As noted in my original review, my primary concern was the originality of the work, but this concern has been largely alleviated by the budgeted variant of CF-Maps presented by the authors.
Formatting concerns
I could not find any formatting issues in this paper.
2 comments
Rebuttal
Thank you for your comments and overall positive evaluation of our paper. We address each main question and concern raised in your review below. We also introduce a custom budgeted variant of the hyperrectangle-extraction algorithm that enables our method to scale effectively to large tree ensembles while retaining optimality guarantees, thereby broadening the scope of our contribution.
- About technical novelty : the proposed method seems to largely depend on BA-Trees, i.e., an existing technique.
BA-Trees is indeed a key component of our approach. Yet it is originally designed to extract a faithful and minimal hyperrectangular representation of a tree ensemble; it does not address counterfactual generation, nearest-region search, or efficient online queries.
CF-Maps required three substantial methodological leaps: (i) adopting a preprocess-and-query perspective for counterfactual search; (ii) observing that heuristic BA-Trees is indeed a suitable tool to extract target regions; and (iii) organizing these regions in volumetric KD-trees to enable nearest-hyperrectangle search. Our query algorithm uses branch-and-bound to prune entire subtrees while preserving global optimality. Although the final design appears intuitive and natural in hindsight (a key quality of a useful machine-learning contribution), arriving at this design was nontrivial and required several conceptual and algorithmic insights. Overall, CF-Maps is the first method to provide amortized, globally optimal counterfactual explanations for tree ensembles with subsecond query latency.
Note: Budgeted variant of CF-Maps. Motivated by the reviewers' rebuttal questions, we tested an additional budgeted variant of the top-down BA-Trees procedure that substantially reduces preprocessing while retaining theoretical guarantees. Starting from the full feature space, it iteratively splits regions that cannot yet be certified as pure, using a priority score based on their size and distance to already certified regions, and stops once a prescribed budget of pure hyperrectangles has been reached. The resulting partition contains certified pure regions and unresolved regions. We build one KD-tree map per class from the certified regions and an additional map for all unresolved regions. For a query and target class, the nearest certified target region yields a valid counterfactual and upper bound , while the nearest unresolved region gives distance . Since any closer undiscovered target region must lie in an unresolved region, is a valid distance lower bound. Thus, certifies global optimality; otherwise, is a certified optimality gap. Our responses to Reviewers Dc4g and iZTp report additional comparisons of CF-Maps, its budgeted variant CF-Maps(B), LIRE, and the newly added EECE baseline on deeper and larger ensembles. CF-Maps(B) substantially reduces preprocessing and certifies global optimality in all evaluated configurations; more generally, when optimality cannot be certified, it provides a theoretically valid optimality gap. To the best of our knowledge, no previous exact counterfactual method has demonstrated scalability to ensembles of this size and depth.
- The paper shows the relationship between CE for tree ensembles and the generalized Voronoi partition in Figure 1 and in Proposition 2.2, but it looks unclear how this property is exploited in the proposed algorithm and how it contributes to the efficiency of the method.
The Voronoi representation provides an intuitive view of the counterfactual search process, tightly connecting our methodology to its underlying geometric view, while offering a visual map of the different counterfactual regions.
Algorithm 1 first enumerates regions by BA-Trees and then constructs a KD-tree that stores enumerated regions. What is the time complexity of constructing such a KD-tree? Also, how is the space complexity of the KD-tree compared to simply storing the enumerated regions?
Let be the number of enumerated hyperrectangles and the number of features. The time complexity of constructing our KD-Tree is . Storing the regions alone requires space, while the KD-tree additionally stores an -dimensional bounding box and a constant number of pointers per node. Therefore, the total space complexity remains , or for fixed , with only a constant-factor overhead compared with storing the regions alone.
These analyses will be provided in the revised paper.
Once again, thank you for your feedback. We hope our responses strengthen your assessment of this paper's merits. If these additions address your concerns, please consider updating your evaluation accordingly. We remain available throughout the discussion period should any further questions arise.
Thank you for addressing my questions. As noted in my original review, my primary concern was the originality of the work, but this concern has been largely alleviated by the budgeted variant of CF-Maps presented by the authors. Therefore, I am inclined to raise my score. Thank you again for taking the time to respond to my comments and address my concerns.
- Rating
- 5/6
- Confidence
- 4/5
- Quality
- 4/4
- Clarity
- 4/4
- Significance
- 3/4
- Originality
- 4/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper casts counterfactual generation for tree ensembles as a nearest-region search problem. Tree ensembles partition the input space into axis-aligned hyperrectangles with constant predictions, so a globally optimal counterfactual is the projection onto the nearest hyperrectangle carrying the target label. The authors formalize this as a "counterfactual map" (Definition 2.1) and show the resulting decision cells are finite unions of polyhedra under L1 and L-infinity distance but generally non-polyhedral under L2 (Proposition 2.2). They build a two-stage system: extract the ensemble's hyperrectangle partition via Born-Again Trees, index it with a volumetric KD-tree per target class, and answer queries with a branch-and-bound search that is exact under any Lp distance (Theorem 3.1). Across five tabular datasets, the method matches the optimality of the exact baseline OCEAN at orders-of-magnitude lower query latency, and clearly beats three heuristic baselines (FT, LIRE, DiCE) on validity and recourse distance.
Strengths and weaknesses
Proposition 2.2 is verified as correct: the clamp-distance decomposition, the sign-pattern partition where each box's distance is affine, and the resulting polyhedral structure for L1 and L-infinity all hold. The L2 counterexample is correct. This result is why counterfactual maps are represented implicitly via search rather than as an explicit Voronoi decomposition (Section 2).
Theorem 3.1 is verified as correct. The proof chains distance monotonicity (Lemma C.1), the bounding-box lower bound it it implies (Lemma C.2), running-minimum bookkeeping (Lemma C.3), and the coverage invariant for unvisited rectangles (Lemma C.4) into a clean contradiction argument covering both termination cases. The empirical results confirm this: Table 2 shows CF-Maps matching OCEAN's optimality (D = 1.0, percent fail = 0) at 1.4 seconds versus OCEAN's 620 seconds for 1000 queries on COMPAS, while FT and DiCE fail validity on a sizeable share of queries (up to 93% and 17% respectively).
The scalability claim is tested only on shallow trees. Figure 7 sweeps depth from 2 to 7, and the authors identify BA-Trees extraction as the bottleneck. Carreira-Perpiñán and Hada, the LIRE source, argue Random Forests need depth past 10 for competitive accuracy, and that evaluating on shallow trees gives "an incomplete, overly optimistic picture." The comparison against OCEAN should only improve at greater depth, but CF-Maps's own preprocessing cost there is untested.
Tuning OCEAN's solver settings likely wouldn't change much. The same paper reports that OCEAN already runs on Gurobi and still explodes on realistic forest sizes, with large runtime variance on identical problems regardless of settings. The 43,000-second outlier for Pima Diabetes in Table 2 is consistent with that documented variance rather than an unfair comparison.
Two parameters that directly determine Table 2's numbers are unspecified. Section 3 attributes two exact extraction algorithms to Born-Again Trees and says this paper uses the faster, non-minimal one; Vidal and Schiffer describe a single dynamic-programming algorithm with pruning. And Appendix C.2 fixes the KD-tree leaf capacity at "some fixed k" without giving its value anywhere, not in the main text, not in Appendix D, not near Table 5's KD-tree statistics.
The paper is organized cleanly, with the definition, geometric result, and exactness theorem building on each other, and both algorithms fully specified rather than sketched.
Questions
- What is preprocessing time and query latency at depths 8, 10, and 12, given the tested range (2–7) falls short of what Carreira-Perpiñán and Hada (2023) argue is needed for competitive accuracy?
- Which Born-Again Trees algorithm is used, and where in Vidal and Schiffer (2020) is the faster non-minimal variant specified?
- What value of k (KD-tree leaf capacity) was used, and how sensitive are preprocessing time and query latency to it?
- Does the oceanpy implementation use Gurobi here, as in the original OCEAN package ?
- Is the 43,000-second Pima Diabetes OCEAN runtime reproducible, or does it reflect the MIP runtime variance documented for OCEAN elsewhere?
Limitations
Yes.
Notes: Section 6 discloses the preprocessing bottleneck and its exponential worst-case growth with depth, with concrete mitigations proposed as future work. It doesn't name the specific gap this implies: the tested depth range (up to 7) stops short of the regime the paper's own cited baseline says matters for realistic forests.
Final justification
My review's main concern, shared by the meta-review, was that scalability was tested only at depths 2 to 7 while the paper's own cited baseline argues realistic forests need depth past 10. The rebuttal resolved this with delivered results: sweeps to depth 12 and 1,000 trees with the EECE baseline added, plus a budgeted CF-Maps(B) variant that cuts preprocessing by an order of magnitude while certifying either global optimality or a provable gap, with a zero gap in every evaluated configuration. My smaller questions were also resolved, and I checked the two verifiable claims: the BA-Trees variant is the Section 4.5 heuristic of Vidal and Schiffer, and the 43K-second OCEAN entry is a cumulative time over 1K queries, reproducible across seeds.
On the originality concern raised by another reviewer, I find the authors' distinction sound: CF-Maps indexes an exhaustive certified partition of the decision regions with optimality guarantees, which prototype methods searching representative samples do not provide. The remaining items are camera-ready incorporation of CF-Maps(B) with its lower-bound proof and budget-degradation results, and I weight them lightly against a now well-tested contribution.
Formatting concerns
None.
2 comments
Rebuttal
Thank you for your comments and overall positive evaluation of our paper. We hereafter address the key concerns raised in your review point by point and provide new results demonstrating that, with a custom-budgeted variant of the hyperrectangle-extraction algorithm, our method scales effectively to large tree ensembles while retaining optimality guarantees.
- What is preprocessing time and query latency at depths 8, 10, and 12 ?
In the table below, we report the preprocessing time , average query time , and average counterfactual distance for CF-Maps and the two best-performing baselines (LIRE and EECE), across the suggested regimes: up to trees and maximum depth up to . Recall that all counterfactuals returned by CF-Maps are globally optimal by construction.
The number of target decision regions can grow exponentially with the number and depth of the trees; therefore, explicitly enumerating the complete hyperrectangular partition can be a significant bottleneck. Accordingly, we implemented an additional budgeted (B) variant of the top-down BA-Trees procedure. Starting from the full feature space, this variant iteratively splits regions that cannot yet be certified as pure, using a priority score based on their size and distance to already certified regions. The procedure stops once a prescribed budget of pure hyperrectangles has been reached. At termination, the feature space is partitioned into certified pure hyperrectangles and unresolved hyperrectangles. We construct one KD-tree map for each class from its certified regions, together with an extra KD-tree map containing the unresolved regions. For a query and a target class, the target-class KD-tree returns the nearest certified target region, yielding a valid counterfactual and an upper bound on the optimal distance. The unresolved-region KD-tree returns the distance to the nearest unresolved region. Since any closer target-class counterfactual not yet represented in the certified map must lie in an unresolved region, is a valid lower bound. When , the returned counterfactual is certified globally optimal; otherwise, provides a certified optimality gap. Generally, we observe that the lower and upper bounds coincide in most cases.
We therefore added to the table the aforementioned metrics for the budgeted variant of our method, denoted CF-Maps(B), along with the proportion of counterfactuals certified as globally optimal (%OPT) and the average optimality gap (). For these experiments, we used . On CP and FI specifically, the total number of hyperrectangles remains well below this limit, so CF-Maps(B) is identical to CF-Maps; we therefore omit separate results for these datasets for brevity. For the more challenging datasets, CF-Maps(B) substantially reduces preprocessing time, demonstrating controlled scalability. Moreover, in those cases, all returned counterfactuals were certified as globally optimal, as indicated by a zero optimality gap. The final manuscript will present both the CF-Maps and CF-Maps(B) methodologies and experiments.
| Dataset | #trees | max. depth | CFMaps | CFMaps(B) | LiRE | EECE | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| %OPT | ||||||||||||||||
| BC | 100 | 8 | 532.38 | 0.032 | 8.062 | 14.74 | 0.0159 | 8.062 | 100 | 0 | 5.82 | 0.0011 | 13.432 | 5.98 | 0.037 | 9.422 |
| 100 | 10 | 595.31 | 0.0375 | 8.048 | 15.62 | 0.0166 | 8.048 | 100 | 0 | 5.82 | 0.0011 | 13.502 | 5.98 | 0.0389 | 9.284 | |
| 100 | 12 | 537.58 | 0.0319 | 8.046 | 16.94 | 0.0184 | 8.046 | 100 | 0 | 5.76 | 0.0011 | 13.488 | 5.92 | 0.0371 | 9.284 | |
| 200 | 10 | 1309.83 | 0.0415 | 8.65 | 30.48 | 0.0208 | 8.65 | 100 | 0 | 11.71 | 0.0012 | 14.36 | 12.04 | 0.0697 | 10.34 | |
| 500 | 10 | 2979.45 | 0.0419 | 8.75 | 82.54 | 0.0259 | 8.75 | 100 | 0 | 18.51 | 0.0012 | 13.92 | 19.43 | 0.1371 | 10.24 | |
| 1000 | 10 | 7882.77 | 0.0363 | 8.69 | 199.82 | 0.0286 | 8.69 | 100 | 0 | 36.03 | 0.0013 | 14.07 | 38.45 | 0.3625 | 10.02 | |
| CP | 100 | 8 | 0.21 | 0.0009 | 1.048 | * | 2.88 | 0.0008 | 1.092 | 3.66 | 0.1948 | 1.08 | ||||
| 100 | 10 | 0.25 | 0.001 | 1.042 | 2.93 | 0.0008 | 1.076 | 3.89 | 0.2372 | 1.062 | ||||||
| 100 | 12 | 0.25 | 0.0009 | 1.038 | 2.97 | 0.0008 | 1.074 | 3.97 | 0.241 | 1.058 | ||||||
| 200 | 10 | 0.38 | 0.001 | 1.04 | 5.65 | 0.0008 | 1.06 | 7.94 | 0.4684 | 1.06 | ||||||
| 500 | 10 | 0.82 | 0.0009 | 1.04 | 11.29 | 0.0008 | 1.06 | 53.92 | 1.242 | 1.05 | ||||||
| 1000 | 10 | 1.52 | 0.001 | 1.04 | 19.66 | 0.0009 | 1.07 | 173.79 | 2.794 | 1.07 | ||||||
| FI | 100 | 8 | 1.07 | 0.0071 | 1.295 | * | 48.99 | 0.0078 | 1.602 | 54.55 | 0.1132 | 1.59 | ||||
| 100 | 10 | 1.74 | 0.0076 | 1.256 | 48.91 | 0.0079 | 1.53 | 96.76 | 0.2226 | 1.524 | ||||||
| 100 | 12 | 2.42 | 0.0071 | 1.152 | 49.56 | 0.0079 | 1.338 | 246.47 | 0.4081 | 1.332 | ||||||
| 200 | 10 | 2.42 | 0.0062 | 1.222 | 94.83 | 0.0078 | 1.54 | 328.46 | 0.4879 | 1.54 | ||||||
| 500 | 10 | 6.03 | 0.0065 | 1.232 | 175.38 | 0.0078 | 1.55 | 1709.95 | 1.8287 | 1.55 | ||||||
| 1000 | 10 | 11.5 | 0.0066 | 1.21 | 319.14 | 0.008 | 1.56 | 8756.75 | 6.629 | 1.56 | ||||||
| PD | 100 | 8 | 459.01 | 0.0133 | 2.432 | 19.63 | 0.0065 | 2.432 | 100 | 0 | 14.03 | 0.0016 | 6.036 | 14.44 | 0.0566 | 2.668 |
| 100 | 10 | 520.53 | 0.014 | 2.234 | 27.47 | 0.0066 | 2.234 | 100 | 0 | 14.04 | 0.0016 | 5.862 | 14.66 | 0.0627 | 2.45 | |
| 100 | 12 | 604.85 | 0.0152 | 2.138 | 31.71 | 0.0064 | 2.138 | 100 | 0 | 14.04 | 0.0016 | 5.942 | 14.74 | 0.0642 | 2.354 | |
| 200 | 10 | 578.02 | 0.0128 | 2.02 | 46.7 | 0.0065 | 2.02 | 100 | 0 | 27.33 | 0.0016 | 6.28 | 28.85 | 0.1413 | 2.212 | |
| 500 | 10 | 964.63 | 0.0146 | 2.05 | 115.72 | 0.0064 | 2.05 | 100 | 0 | 51.41 | 0.0016 | 6.61 | 72.74 | 0.3731 | 2.222 | |
| 1000 | 10 | 2050.19 | 0.0118 | 2.11 | 307.17 | 0.0073 | 2.11 | 100 | 0 | 91.86 | 0.0017 | 6.91 | 180.89 | 0.9527 | 2.252 | |
| SE | 100 | 8 | 102.79 | 0.0079 | 4.914 | 2.34 | 0.003 | 4.914 | 100 | 0 | 3.38 | 0.0005 | 11.567 | 3.48 | 0.0383 | 6.816 |
| 100 | 10 | 103.82 | 0.0079 | 4.895 | 2.3 | 0.003 | 4.895 | 100 | 0 | 3.33 | 0.0005 | 11.543 | 3.45 | 0.0388 | 6.721 | |
| 100 | 12 | 107.31 | 0.0082 | 4.895 | 2.28 | 0.0029 | 4.895 | 100 | 0 | 3.39 | 0.0005 | 11.552 | 3.51 | 0.0451 | 6.721 | |
| 200 | 10 | 167.36 | 0.0093 | 5.381 | 4.56 | 0.0034 | 5.381 | 100 | 0 | 6.48 | 0.0004 | 11.881 | 6.69 | 0.0675 | 7.026 | |
| 500 | 10 | 221.26 | 0.0102 | 5.381 | 9.44 | 0.0034 | 5.381 | 100 | 0 | 12.39 | 0.0005 | 12.619 | 13.05 | 0.1695 | 6.478 | |
| 1000 | 10 | 335.9 | 0.0088 | 5.405 | 20.33 | 0.0041 | 5.405 | 100 | 0 | 22.81 | 0.0005 | 12.762 | 24.47 | 0.3866 | 6.407 |
* On CP and FI, CF-Maps uses significantly fewer than hyperrectangles; we therefore omit the budgeted variant, which would yield identical results.
- Which Born-Again Trees algorithm is used, and where in Vidal and Schiffer (2020) is the faster non-minimal variant specified?
We use the "Heuristic Born-Again Trees" algorithm described in Section 4.5 of Vidal and Schiffer (2020). It is an exact algorithm as it preserves global faithfulness to the original ensemble; however, it does not guarantee a partition into a minimal number of hyperrectangles (unlike the original born-again trees algorithm described in Section 3 of Vidal and Schiffer (2020)). We use this variant because it substantially reduces preprocessing cost, while non-minimality does not significantly affect the KD-Tree query time. Moreover, as discussed in the previous paragraph, we adapted it to respect a bound on its maximum expansion, thereby deriving the CFMaps(B) approach. This will be described in more detail in the final version of the manuscript.
- What value of k (KD-tree leaf capacity) was used, and how sensitive are preprocessing time and query latency to it?
In our experiments, we set , so each KD-tree leaf contains a single target hyperrectangle. Larger values of reduce the number of tree nodes and, therefore, the index construction cost and memory usage, but require evaluating several hyperrectangles whenever a leaf is reached. Thus, would control a trade-off between index size and query latency.
We did not conduct a dedicated sensitivity analysis because small values of would not substantially change the tree depth but would require extra work at the leaves. Moreover, the overall preprocessing time is dominated by extracting the hyperrectangular partition rather than constructing the KD-tree.
- Does the oceanpy implementation use Gurobi here, as in the original OCEAN package?
Yes. The "oceanpy" implementation is a refactoring of the OCEAN code, provided at the same GitHub link by the original authors. It uses the same MILP formulation and the same solver, Gurobi.
- Is the 43,000-second Pima Diabetes OCEAN runtime reproducible, or does it reflect the MIP runtime variance documented for OCEAN elsewhere?
Yes. This value is reproducible and does not correspond to a single anomalous MILP run. As reported in Table 2, is the cumulative query time for 1,000 counterfactuals, excluding preprocessing, and is averaged over five random seeds. Thus, seconds corresponds to approximately seconds per query. The higher runtime on Pima Diabetes is plausibly due to its greater number of numerical features, which lead to many distinct split levels and harder MILP instances.
Once again, thank you for your comments and suggestions. We hope that our responses address your concerns, and we remain available throughout the author-reviewer discussion period. Additionally, the budgeted variant of the hyperrectangle-extraction algorithm we included efficiently addresses the scalability concern, which was the key issue highlighted in the reviews. We are grateful if you consider revising your evaluation if those responses and changes addressed the key limitations you identified.
I thank the authors for their detailed response, in particular the depth 8 to 12 and 1000-tree results with the EECE baseline (Q1), and the clarifications on the BA-Trees variant (Q2), the KD-tree leaf capacity (Q3), and the OCEAN runtimes (Q4, Q5). I checked Section 4.5 in Vidal and Schiffer, and the budgeted variant's lower-bound is sound. I encourage the authors to incorporate these clarifications into the paper.
The new results confirm the concern my review raised: full extraction reaches 7,900 seconds on BC at 1000 trees. CF-Maps(B) solves this. The certificate degrades gracefully: each counterfactual is either provably optimal or carries a provable gap. A zero gap in every evaluated configuration is a strong result.
I would please ask the authors to incorporate in the final version: (1) specify CF-Maps(B) fully, including the priority rule and a short proof of the lower-bound claim; (2) report %OPT and the average gap at budgets below 10^6, so readers can see how the certificate degrades when the budget binds; and (3) state the extracted region counts at the new scales alongside Table 5's KD-tree statistics, with the k=1 leaf capacity stated.
Since my concerns have been largely addressed, I plan to raise my score.
- Rating
- 3/6
- Confidence
- 4/5
- Quality
- 2/4
- Clarity
- 3/4
- Significance
- 2/4
- Originality
- 2/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper introduce counterfactual maps via pre-computing a Voronoi-like partition of a tree ensemble's decision space into labeled hyperrectangles, then answering counterfactual queries via KD-tree nearest-region search. It addresses the central challenge of exact counterfactual generation for tree ensembles at interactive latency, provides one-time preprocessing, sublinear query time, globally optimal guarantees.
Strengths and weaknesses
The paper tackles with the problem of exact counterfactuals for tree ensembles at interactive latency and the technical execution is solid. The exactness proof (Theorem 3.1) is rigorous, the preprocessing-query separation is well-motivated, and the empirical speedup over OCEAN is reproducible. However, I have significant concerns about the originality claim that I don't think the paper adequately addresses. The paper positions itself exclusively against MIP-based exact methods and heuristic tree-traversal methods, which creates a misleadingly narrow picture of the related work landscape. The core operation of CF-Maps via precomputing target-class structures, find the nearest one at query time, project onto it, is structurally almost identical to prototype-based counterfactual generation, a well-established paradigm the paper completely ignores. Recent work on prototype counterfactuals applies the geometric nearest-class-structure logic across domains which are not discussed. Once CF-Maps is situated within broader literature, the contribution reduces to represent tree decisions as hyperrectangles (borrowed wholesale from BA-Trees, Vidal & Schiffer 2020), apply KD-tree nearest-region search (standard), project onto the result (closed-form for Lp norms).
The optimality certificate is real and is the paper's strongest claim to novelty but this needs to be defended explicitly against the prototype literature, not just against OCEAN. Additional weaknesses compound this concern. Preprocessing costs (up to 556s on BC, 467s on PD) are buried and underplayed, the paper frames query latency as the win without confronting scenarios where preprocessing itself becomes the bottleneck. Experiments are restricted to random forests despite GBTs being equally prominent in practice. EECE (Zhang & Zhong 2025) is cited but not benchmarked. Categorical feature distance semantics receive minimal treatment.
Questions
- How does CF-Maps differ fundamentally from prototype-based counterfactual methods? The core operation (precompute target-class structures, find nearest, project) is shared.
- Preprocessing costs on BC and PD exceed several minutes in some runs. What happens for forests with depth > 7 or > 100 trees? Is there a scaling wall where BA-Tree extraction becomes the bottleneck regardless of query efficiency?
- Why is EECE (Zhang & Zhong 2025) not benchmarked? It's the most recent directly comparable baseline.
- Can CF-Maps handle gradient boosted trees (XGBoost, LightGBM)? BA-Trees support them in principle, why restrict experiments to random forests?
- What is the theoretical sublinear query-time complexity as a function of the number of hyperrectangles? The claim needs formal backing beyond empirical observation.
Limitations
Not adequately addressed. The conclusion mentions preprocessing as a bottleneck but doesn't quantify its practical threshold. More critically, the paper completely omits the prototype-based counterfactual literature, which is the most relevant comparison class for the amortized inference paradigm being proposed and it affects the originality and significance assessments materially.
Formatting concerns
3 comments
Rebuttal
Thank you for your comments and suggestions. We address each concern below and include additional results regarding scalability to large tree ensembles.
How does CF-Maps differ fundamentally from prototype-based counterfactual methods?
Indeed, we agree that prototype-based methods are closely related to counterfactual generation with amortized preprocessing and will discuss them in our revised related work section. Yet, although both prototype-based methods and CF-Maps rely on preprocessing followed by nearest-object search, they index different objects. Prototype-based methods search over representative samples, whereas CF-Maps indexes an exhaustive, recursive description of the target-class decision regions, permitting optimality guarantees. We also note that one of our baselines, LIRE, can itself be viewed as a prototype-guided heuristic: among the training examples, it identifies the best explanation within the hyperrectangular decision region containing each example. Unlike standard black-box prototype methods, LIRE exploits white-box access to the tree ensemble to locate these regions, making it better than searching over training examples or prototypes alone.
What happens for forests with depth 7 or 100 trees? Is there a scaling wall where BA-Tree extraction becomes the bottleneck regardless of query efficiency?
In the table below, we report the preprocessing time , average query time , and average counterfactual distance for CF-Maps and the two best-performing baselines (LIRE and EECE), across the suggested regimes: up to trees and maximum depth up to . Recall that all counterfactuals returned by CF-Maps are globally optimal by construction.
CF-Maps remains applicable to forests of these sizes, but both preprocessing time and the number of decision regions increase substantially. Thus, as you anticipated, enumerating the complete hyperrectangular partition can eventually become the main bottleneck, and we will better discuss this aspect.
Motivated by this concern, we also implemented an additional budgeted (B) variant of the top-down BA-Trees extraction procedure. Starting from the full feature space, this variant iteratively splits regions that cannot yet be certified as pure, using a priority score based on their size and distance to already certified regions. The procedure stops once a prescribed budget of pure hyperrectangles has been reached. At termination, the feature space is partitioned into certified pure hyperrectangles and unresolved hyperrectangles. We construct one KD-tree map for each class from its certified regions, together with an extra KD-tree map containing the unresolved regions. For a query and a target class, the target-class KD-tree returns the nearest certified target region, yielding a valid counterfactual and an upper bound on the optimal distance. The unresolved-region KD-tree returns the distance to the nearest unresolved region. Since any closer target-class counterfactual not yet represented in the certified map must lie in an unresolved region, is a valid lower bound. When , the returned counterfactual is certified globally optimal; otherwise, provides a certified optimality gap. Generally, we observe that the lower and upper bounds coincide in most cases.
We include the budgeted variant of our method, denoted CF-Maps(B), to the table, along with the proportion of counterfactuals certified as globally optimal (%OPT) and the average optimality gap (). For these experiments, we used . On CP and FI specifically, the total number of hyperrectangles remains well below this limit, so CF-Maps(B) is identical to CF-Maps; we therefore omit separate results for these datasets for brevity. For the more challenging datasets, CF-Maps(B) reduces preprocessing time by an order of magnitude, demonstrating controlled scalability. Moreover, in those cases, all the returned counterfactuals were still certified as globally optimal, as indicated by a zero optimality gap. The final manuscript will present both the CF-Maps and CF-Maps(B) methodologies and experiments.
| Dataset | #trees | max. depth | CFMaps | CFMaps(B) | LiRE | EECE | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| %OPT | ||||||||||||||||
| BC | 100 | 8 | 532.38 | 0.032 | 8.062 | 14.74 | 0.0159 | 8.062 | 100 | 0 | 5.82 | 0.0011 | 13.432 | 5.98 | 0.037 | 9.422 |
| 100 | 10 | 595.31 | 0.0375 | 8.048 | 15.62 | 0.0166 | 8.048 | 100 | 0 | 5.82 | 0.0011 | 13.502 | 5.98 | 0.0389 | 9.284 | |
| 100 | 12 | 537.58 | 0.0319 | 8.046 | 16.94 | 0.0184 | 8.046 | 100 | 0 | 5.76 | 0.0011 | 13.488 | 5.92 | 0.0371 | 9.284 | |
| 200 | 10 | 1309.83 | 0.0415 | 8.65 | 30.48 | 0.0208 | 8.65 | 100 | 0 | 11.71 | 0.0012 | 14.36 | 12.04 | 0.0697 | 10.34 | |
| 500 | 10 | 2979.45 | 0.0419 | 8.75 | 82.54 | 0.0259 | 8.75 | 100 | 0 | 18.51 | 0.0012 | 13.92 | 19.43 | 0.1371 | 10.24 | |
| 1000 | 10 | 7882.77 | 0.0363 | 8.69 | 199.82 | 0.0286 | 8.69 | 100 | 0 | 36.03 | 0.0013 | 14.07 | 38.45 | 0.3625 | 10.02 | |
| CP | 100 | 8 | 0.21 | 0.0009 | 1.048 | * | 2.88 | 0.0008 | 1.092 | 3.66 | 0.1948 | 1.08 | ||||
| 100 | 10 | 0.25 | 0.001 | 1.042 | 2.93 | 0.0008 | 1.076 | 3.89 | 0.2372 | 1.062 | ||||||
| 100 | 12 | 0.25 | 0.0009 | 1.038 | 2.97 | 0.0008 | 1.074 | 3.97 | 0.241 | 1.058 | ||||||
| 200 | 10 | 0.38 | 0.001 | 1.04 | 5.65 | 0.0008 | 1.06 | 7.94 | 0.4684 | 1.06 | ||||||
| 500 | 10 | 0.82 | 0.0009 | 1.04 | 11.29 | 0.0008 | 1.06 | 53.92 | 1.242 | 1.05 | ||||||
| 1000 | 10 | 1.52 | 0.001 | 1.04 | 19.66 | 0.0009 | 1.07 | 173.79 | 2.794 | 1.07 | ||||||
| FI | 100 | 8 | 1.07 | 0.0071 | 1.295 | * | 48.99 | 0.0078 | 1.602 | 54.55 | 0.1132 | 1.59 | ||||
| 100 | 10 | 1.74 | 0.0076 | 1.256 | 48.91 | 0.0079 | 1.53 | 96.76 | 0.2226 | 1.524 | ||||||
| 100 | 12 | 2.42 | 0.0071 | 1.152 | 49.56 | 0.0079 | 1.338 | 246.47 | 0.4081 | 1.332 | ||||||
| 200 | 10 | 2.42 | 0.0062 | 1.222 | 94.83 | 0.0078 | 1.54 | 328.46 | 0.4879 | 1.54 | ||||||
| 500 | 10 | 6.03 | 0.0065 | 1.232 | 175.38 | 0.0078 | 1.55 | 1709.95 | 1.8287 | 1.55 | ||||||
| 1000 | 10 | 11.5 | 0.0066 | 1.21 | 319.14 | 0.008 | 1.56 | 8756.75 | 6.629 | 1.56 | ||||||
| PD | 100 | 8 | 459.01 | 0.0133 | 2.432 | 19.63 | 0.0065 | 2.432 | 100 | 0 | 14.03 | 0.0016 | 6.036 | 14.44 | 0.0566 | 2.668 |
| 100 | 10 | 520.53 | 0.014 | 2.234 | 27.47 | 0.0066 | 2.234 | 100 | 0 | 14.04 | 0.0016 | 5.862 | 14.66 | 0.0627 | 2.45 | |
| 100 | 12 | 604.85 | 0.0152 | 2.138 | 31.71 | 0.0064 | 2.138 | 100 | 0 | 14.04 | 0.0016 | 5.942 | 14.74 | 0.0642 | 2.354 | |
| 200 | 10 | 578.02 | 0.0128 | 2.02 | 46.7 | 0.0065 | 2.02 | 100 | 0 | 27.33 | 0.0016 | 6.28 | 28.85 | 0.1413 | 2.212 | |
| 500 | 10 | 964.63 | 0.0146 | 2.05 | 115.72 | 0.0064 | 2.05 | 100 | 0 | 51.41 | 0.0016 | 6.61 | 72.74 | 0.3731 | 2.222 | |
| 1000 | 10 | 2050.19 | 0.0118 | 2.11 | 307.17 | 0.0073 | 2.11 | 100 | 0 | 91.86 | 0.0017 | 6.91 | 180.89 | 0.9527 | 2.252 | |
| SE | 100 | 8 | 102.79 | 0.0079 | 4.914 | 2.34 | 0.003 | 4.914 | 100 | 0 | 3.38 | 0.0005 | 11.567 | 3.48 | 0.0383 | 6.816 |
| 100 | 10 | 103.82 | 0.0079 | 4.895 | 2.3 | 0.003 | 4.895 | 100 | 0 | 3.33 | 0.0005 | 11.543 | 3.45 | 0.0388 | 6.721 | |
| 100 | 12 | 107.31 | 0.0082 | 4.895 | 2.28 | 0.0029 | 4.895 | 100 | 0 | 3.39 | 0.0005 | 11.552 | 3.51 | 0.0451 | 6.721 | |
| 200 | 10 | 167.36 | 0.0093 | 5.381 | 4.56 | 0.0034 | 5.381 | 100 | 0 | 6.48 | 0.0004 | 11.881 | 6.69 | 0.0675 | 7.026 | |
| 500 | 10 | 221.26 | 0.0102 | 5.381 | 9.44 | 0.0034 | 5.381 | 100 | 0 | 12.39 | 0.0005 | 12.619 | 13.05 | 0.1695 | 6.478 | |
| 1000 | 10 | 335.9 | 0.0088 | 5.405 | 20.33 | 0.0041 | 5.405 | 100 | 0 | 22.81 | 0.0005 | 12.762 | 24.47 | 0.3866 | 6.407 |
* On CP and FI, CF-Maps uses significantly fewer than hyperrectangles; we therefore omit the budgeted variant, which would yield identical results.
Discussing limitations and preprocessing costs
Sure, we will make the preprocessing requirements and associated limitations much more explicit throughout the revision. In particular, exact partition extraction can become the main bottleneck for larger ensembles, although the budgeted variant discussed in the previous point substantially mitigates this issue. To the best of our knowledge, CF-Maps is the first counterfactual framework that combines preprocessing and amortized inference with theoretical guarantees: every returned counterfactual is valid, and either is globally optimal or is accompanied by a provable optimality gap (in the case of CF-Maps(B)).
Why is EECE (Zhang & Zhong 2025) not benchmarked?
Thank you for the suggestion. We now include EECE as an additional baseline. As shown in the results above, EECE sensibly outperforms LIRE. This is expected, since it combines LIRE with Feature Tweaking (FT). Nevertheless, CF-Maps (and CF-Maps(B)) consistently outperform both methods in query time and solution quality, and additionally provide optimality guarantees, whereas EECE does not. The final paper will include EECE in all relevant plots and tables.
Can CF-Maps handle gradient boosted trees (XGBoost, LightGBM)?
CF-Maps applies to any classifier whose decision regions can be represented as a finite union of axis-aligned hyperrectangles. Our current implementation was limited to random forests (RFs) for convenience, as it used the original BA-trees code repository, provided with an interface for RFs. Moreover, base learners used in RFs tend to be deeper than those in boosting algorithms, making the counterfactual search more challenging in those cases (especially at depths of 10 or 12, as suggested). We will include additional experiments on boosted ensembles in the appendix of the final version of this manuscript.
What is the theoretical sublinear query-time complexity as a function of the number of hyperrectangles?
Thank you for noting this. The sublinear query time highlighted in the manuscript results from our empirical observations rather than a worst-case theoretical guarantee. In the worst case, Algorithm~2 may visit all indexed hyperrectangles, yielding query time for fixed dimension. The observed sublinear behavior typically occurs when the KD-tree is reasonably balanced and the branch-and-bound bounds prune most subtrees, leaving only a constant number of nodes per level. We will revise the manuscript to make this distinction explicit and remove the imprecise claim of theoretical sublinear complexity.
Once again, thank you for your comments and suggestions. We hope our responses address your concerns, and we remain available throughout the discussion period. Finally, please consider revising your evaluation if you agree that these additions address the main limitations you identified.
I thank the authors for their detailed rebuttal, particularly for the prototype distinction clarification, the CF-Maps(B) variant, the EECE inclusion, and the honest correction of the sublinear complexity claim.
However, my rating remains unchanged for three reasons.
CF-Maps(B) is arguably the stronger contribution but appears here for the first time, a new method in a rebuttal cannot be properly evaluated. The GBT extension and prototype-based related work expansion are both promised but undelivered. The preprocessing bottleneck at scale (7882s for BC with 1000 trees) remains severe and the budget-optimality gap tradeoff is uncharacterized.
I encourage the authors to incorporate CF-Maps(B) as a core contribution and deliver on the promised experiments and related work in the final version. These are substantial revisions that cannot be verified at this stage.
Thank you for considering our submission and engaging with us during the rebuttal period.
Our rebuttal clearly explains why LIRE is a strictly dominating choice over prototype-based methods. Prototype methods search among representative samples, whereas LIRE uses white-box access to the ensemble and searches all the decision regions that contain the training samples. Experimental comparisons have already been conducted with LIRE, showing that CF-Maps is vastly superior in counterfactual quality while also returning certified globally optimal counterfactuals at millisecond latency. We even tested the additional EECE baseline you suggested, an extension of LIRE including additional feature tweaking.
Regarding the other two points on the budgeted variant. The reviewers stated that CF-Maps is a novel and interesting methodological contribution, but that its main limitation precluding publication was scalability. Therefore, following this guidance,
-
We provided additional results of the original method, notably on ensembles with 1000 trees of depth 10. Collectively, 1000 trees of depth 10 contain up to 1,024,000 leaves. This is not an ensemble size typically designed for interpretability, and the gain in predictive performance over, e.g., depth-8 trees, is marginal. We agreed to run these tests to follow your suggestion and test the limits of the method, but it is evident that explanation techniques (especially optimal ones) in those conditions require greater computational effort. We note, however, that although preprocessing takes longer, the online queries remain extremely fast even in that setting (≈30 ms), which is itself a very strong result for the original method.
-
We discussed a fairly straightforward adaptation of this method, CF-Maps(B), which can be conceptualized in 4 lines and addresses the scalability concern. This is not the main contribution of the paper, but it substantiates it by offering a way to reduce preprocessing. We provided complete results with this method in the rebuttal. An analysis of the budget-optimality gap trade-off could have been reported even during the rebuttal phase, had this been suggested earlier than on the final day of the discussion period.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Thank you for your comments and overall positive appreciation of our contribution. We have addressed, point by point, the different concerns raised by each reviewer in the rebuttals, as well as the key weakness identified in your meta-review.
1. Additional scalability experiments
We have conducted the additional scalability experiments suggested by the reviewers, namely up to 1,000 trees and a maximum depth of 12. The results, reported for all datasets in our responses to Reviewers Dc4g and iZTp, consistently show that CF-Maps can scale to larger ensembles while still outperforming existing methods in query time and guaranteeing optimal counterfactuals. Yet, both the preprocessing time and the number of decision regions increase substantially. Thus, as anticipated, enumerating the complete hyperrectangular partition can eventually become the main bottleneck. We will discuss this aspect more visibly in the paper to avoid underplaying it.
2. Budgeted variant of CF-Maps
Motivated by this concern, we have also provided results with an additional budgeted (B) variant of the top-down BA-Trees extraction procedure. Starting from the full feature space, this variant iteratively splits regions that cannot yet be certified as pure, using a priority score based on their size and distance to already certified regions.
The procedure stops once a prescribed budget of N pure hyperrectangles has been reached. At termination, the feature space is partitioned into certified pure hyperrectangles and unresolved hyperrectangles. We construct one KD-tree map for each class from its certified regions, together with an extra KD-tree map containing the unresolved regions.
For a query and a target class, the target-class KD-tree returns the nearest certified target region, yielding a valid counterfactual and an upper bound U on the optimal distance. The unresolved-region KD-tree returns the distance dunres to the nearest unresolved region. Since any closer target-class counterfactual not yet represented in the certified map must lie in an unresolved region, L=min(U,dunres) is a valid lower bound. When L=U, the returned counterfactual is certified globally optimal; otherwise, U−L provides a certified optimality gap.
In the additional results reported in our responses to Reviewers Dc4g and iZTp, we observe that our budgeted variant of CF-Maps, denoted CF-Maps(B), exhibits controlled scalability, yielding preprocessing times an order of magnitude faster than the original CF-Maps. In all evaluated configurations, CF-Maps(B) provides certifiably optimal counterfactuals, thereby completely addressing the scalability issue.
We believe that, together with the other suggestions made by the reviewers, these experiments broaden the scope and applicability of our method while addressing the main weakness identified in your meta-review. They will be carefully integrated into the final version of the manuscript. We remain available during the Author/Reviewer/AC discussion period, should any further questions arise. Thank you again for the time involved in evaluating and managing our manuscript.