Counterfactual Case-Based Explanations
- Counterfactual case-based explanations are defined as local, contrastive justifications that alter a minimal set of features drawn from actual cases.
- They construct explanations by retrieving a 'twin case' from a case-base that differs only in a small, decision-relevant subset of features, ensuring both sparsity and plausibility.
- Empirical studies across modalities (tabular, text, and time series) show that these methods enhance explanatory coverage while maintaining decision-changing minimal interventions.
Searching arXiv for recent and foundational papers on counterfactual case-based explanations. Searching for specific papers referenced in the source material to ground the article. arxiv_search(query="counterfactual case-based explanations text classifiers counterfactual representations Native Guide case-based technique counterfactuals", max_results=10) arxiv_search(query="(Lemberger et al., 2024, Keane et al., 2020, Delaney et al., 2020, Fernández-Loría et al., 2020, Bertossi, 2020, Bertossi, 2020, Fatemi et al., 5 May 2025, Goethals et al., 6 Jan 2026)", max_results=10) Counterfactual case-based explanations are local explanations that justify a model decision by exhibiting an alternative case that is close to the queried instance, belongs to a different class or yields a different decision, and differs only in a small, decision-relevant subset of features. In this literature, the explanatory object is not only a hypothetical perturbation but a case: an actual or admissible instance from a case-base, or a representation that can be grounded in a nearest real example. The resulting explanations are contrastive, typically sparse, and often designed to remain plausible by reusing patterns from observed data rather than by arbitrary feature manipulation (Keane et al., 2020, Fernández-Loría et al., 2020, Lemberger et al., 2024).
1. Definition and formal criteria
A general decision-theoretic definition treats a counterfactual explanation as a subset of features whose alteration changes the system decision and is irreducible. Let an instance be with feature vector , and let be the decision rule. For a subset , one forms a modified instance by replacing each , , with a predefined counterfactual value . Then is a counterfactual explanation for the observed decision iff 0 and, for every proper subset 1, 2 (Fernández-Loría et al., 2020).
This definition is causal in a restricted operational sense: a feature set is explanatory because forcing those feature values to change changes the decision. The formulation does not require a structural causal model over the data-generating process; the causal claim is internal to the AI system and is established by direct intervention on the input to the system (Fernández-Loría et al., 2020).
The case-based variant replaces generic counterfactual values with values or patterns drawn from actual cases. One practical instantiation is to seek actual training cases 3 whose features are closest to 4 except for a small set 5 that differ and flip the decision. In the credit-denial example, if an approved applicant differs only in income and credit history, then 6 functions as a counterfactual explanation: if those features had matched that case, the decision would have changed (Fernández-Loría et al., 2020). This anchors the explanation in a “twin case,” combining causal minimality with the plausibility of observed data.
2. Case-base structure: counterfactual potential and explanatory coverage
A central issue in case-based counterfactual explanation is whether the case-base already contains enough “good” counterfactual pairs. Keane and Smyth formalize this with counterfactual potential and explanatory coverage (Keane et al., 2020).
For a case-base 7, a good counterfactual pair is any pair of cases that belong to different classes and differ in no more than 8 features, with 9. If 0 is the number of differing features, then the counterfactual potential is
1
The same work defines the explanatory coverage set
2
and explanatory coverage
3
These quantities distinguish between the presence of sparse cross-class pairs in the case-base and the proportion of cases that can actually be explained by at least one such pair (Keane et al., 2020).
The empirical motivation for these definitions is that raw case-bases often contain very few natural sparse counterfactuals. On 20 standard UCI datasets, “good” 4- or 5-feature pairs accounted for less than 6 of all counterfactual pairs in nearly every dataset. In a second experiment on Abalone, Bupa Liver, Yeast, Ecoli, and Wine, the baseline 7 was about 8, indicating that natural sparse counterfactuals were unavailable for most queries (Keane et al., 2020).
This motivates the shift from merely retrieving existing cross-class neighbors to constructing counterfactual cases by reusing patterns already present in the case-base. The case-base is therefore not only a repository of candidate explanations, but also a source of reusable difference-structures.
3. Generation by retrieval, reuse, and adaptation
The canonical case-based generation procedure begins by building an Explanation Case Base 9. For every ordered pair 0, if 1 and 2, one records an explanation case 3. Each explanation case stores the match-features 4 and the diff-features 5, with 6. By symmetry each unordered pair yields two ordered explanation cases (Keane et al., 2020).
Given a new query 7, the system retrieves 8 whose query component 9 is closest to 0 under a similarity measure such as normalized Manhattan using MAD. It then reuses the pattern of matches and differences from 1 to build a candidate counterfactual 2: for every 3, set 4; for every 5, set 6. By construction, 7, so the candidate is sparse (Keane et al., 2020).
Validation is explicit. If 8, the candidate is a valid counterfactual. If not, the method enters an adaptation stage: it orders nearest neighbours of 9 whose class matches 0, replaces the diff-features using each such neighbour in turn, and accepts the first 1 for which 2. If no such case flips the decision, it returns “no cf found” (Keane et al., 2020).
The design addresses two standard criteria. Sparsity is enforced by the restriction 3, with 4. Plausibility is enforced because all changed values are drawn from real cases in 5, so the method avoids arbitrary perturbations. The paper also states the implicit constraint 6, since the features of 7 are copied from existing cases (Keane et al., 2020).
4. Modality-specific realizations
In text classification, direct feature-level editing is often problematic because some attribute interventions do not align with plausible real-world events. Lemberger and Saillenfest address this by intervening in representation space. They posit a structural causal model with observed variables 8 (protected attribute), 9 (text embedding), 0 (classifier output), and noise variables 1, with graph 2. For an embedding 3, they decompose 4 into orthogonal subspaces 5 and 6, where 7 spans 8 and 9 is its complement. If 0 projects onto 1, then 2 and 3, with 4. For each target 5, they learn
6
and define the counterfactual representation
7
The method then retrieves the nearest real sentence in embedding space and presents that sentence as a case-based counterfactual explanation (Lemberger et al., 2024).
This is a distinctive case-based construction because the counterfactual is first generated as a representation and only then grounded in a genuine textual case. A plausible implication is that case-based explanation can be preserved even when the counterfactual itself is not directly editable in the original input space, provided the representation remains aligned with real examples.
For time-series classification, Native Guide is explicitly instance-based. Given a query series 8 with predicted class 9, it first retrieves a Nearest Unlike Neighbor whose label is the target class 0. It then uses Class Activation Mapping on the neural network’s Global Average Pooling layer to identify the single most-influential contiguous subsequence. Starting from that subsequence, it replaces the corresponding region of 1 with the same region from the guide, tests the classifier, and expands the window only if needed. In the worst case, the counterfactual becomes the guide itself (Delaney et al., 2020). Because only one contiguous segment is replaced, the construction is sparse by design, while plausibility is maintained by staying within the case-base.
Case-based instantiation also appears in more general decision-explanation frameworks. Fernández-Loría, Provost, and Han note that each feature in an explanatory set 2 may be replaced by its value in the nearest approved or opposite-decision case, rather than by a global mean or mode (Fernández-Loría et al., 2020). This establishes a direct bridge between irreducible-set counterfactual definitions and case-based reasoning.
5. Evaluation criteria and empirical evidence
The evaluation of counterfactual case-based explanations is organized around four recurring criteria: proximity, sparsity, plausibility, and coverage. In the original case-based technique, explanatory competence is the fraction of queries for which a good counterfactual is found, and counterfactual distance is the average 3 relative to the baseline average distance of natural counterfactuals in 4 (Keane et al., 2020). On the five representative UCI datasets, retrieval and reuse raised 5 from about 6 to about 7, and adaptation raised it to about 8 on average. The retrieved counterfactuals were on average 9 farther from the query than baseline natural counterfactuals, adaptation reduced this to about 0, and choosing the closer of reuse versus adaptation yielded 1 in all five datasets (Keane et al., 2020).
In text classification with counterfactual representations, the evaluation emphasizes fidelity to ground-truth counterfactuals and fairness analyses. On the synthetic EEEC+ dataset, the Proportion of Identical Predictions (PIP) for 2 was 3 for balanced gender and 4 for aggressive; the Average Total Variation (ATV) distance of 5’s output distribution was 6 for balanced gender and 7 for aggressive. Treatment Effect estimates computed via counterfactual representations closely tracked ground-truth counterfactuals, with Pearson 8 on at least 9 of examples. On the CEBaB sentiment task, the ground-truth 00 was approximately 01, CFRs yielded 02–03 in binary and ternary settings, and an “approximate CF” baseline yielded 04. On BiasInBios, the TPR-Gap analysis recovered 05 out of 06 known gender-bias pairs, and augmenting training with CFRs reduced TPR-Gap correlation from 07 to 08 and overall ATE from 09 to 10, without loss in accuracy (Lemberger et al., 2024).
In time series, Native Guide uses the Relative Counterfactual Distance
11
sparsity via the length of the replaced subsequence, plausibility via out-of-distribution detection, and diversity via pairwise distances among multiple explanations. Across CBF, Chinatown, Coffee, ECG200, and GunPoint, Native Guide produced counterfactuals with 12 in nearly all cases, often closer to the query than both the natural nearest unlike neighbor and a Wachter-style baseline. Its replaced subsequence length was typically a small fraction of the full series length, its counterfactuals were 13 in-distribution with 14 OOD flagged, and varying the seed guide produced diverse explanations (Delaney et al., 2020).
Taken together, these results show that case-based counterfactual explanation is not limited to one modality or one evaluation protocol. The same explanatory objectives recur, but the operationalization varies: feature differences for tabular data, representation shifts plus nearest-neighbour grounding for text, and localized subsequence replacement for time series.
6. Relation to causality, declarative methods, and common misconceptions
A recurrent misconception is that any feature-importance explanation can substitute for a counterfactual case-based explanation. The counterfactual literature distinguishes these objects sharply. Importance-weight methods such as SHAP and LIME explain the prediction score 15, not necessarily the decision 16. A feature may have a large importance weight for a prediction and still fail to affect the corresponding decision; moreover, weight vectors do not communicate whether features act conjunctively or disjunctively in changing the decision (Fernández-Loría et al., 2020). This is one reason counterfactual explanations are treated as better suited to explaining data-driven decisions in several of the reported case studies.
A second misconception is that plausibility can be ensured by sparsity alone. The literature instead separates sparsity from causal or manifold consistency. The case-based method of Keane and Smyth enforces plausibility by drawing changed feature values from real cases (Keane et al., 2020). In the text setting, plausibility is handled by generating a counterfactual representation whose distribution matches that of real sentences with the target attribute and then grounding it in a nearest real sentence (Lemberger et al., 2024). In adjacent causal work, BRACE enforces causal consistency through the constraint 17, so candidates lie on the structural causal model manifold, while a trade-off parameter 18 balances observed-space sparsity against latent-space fidelity (Fatemi et al., 5 May 2025). Although BRACE is not itself a case-based method, it clarifies the broader demand that counterfactuals respect generative structure rather than merely cross the decision boundary.
Declarative approaches make this issue explicit in another way. ASP-based frameworks define interventions over entities, compute counterfactual entities that change the classifier label, and optimize for minimal-cardinality interventions, yielding maximum-responsibility explanations (Bertossi, 2020, Bertossi, 2020). They can incorporate semantic or domain knowledge via hard constraints, such as forbidding changes to protected features or enforcing one-hot semantics. One extension states that each ASP solution, that is, each counterfactual example 19, is itself a “case” that can be stored, retrieved, or post-processed by a case-based reasoning system (Bertossi, 2020). This suggests that the boundary between case-based and declarative counterfactual explanation is methodological rather than conceptual.
The main open tension in the surveyed literature is therefore not whether explanations should be counterfactual or case-based, but how the counterfactual case should be constructed so that it is simultaneously sparse, plausible, proximate, and decision-changing. Different modalities answer this with different mechanisms: retrieval and adaptation in tabular CBR, representation-space intervention plus nearest-neighbour realization in text, contiguous segment transplantation in time series, and logic-based constrained search in declarative systems.