Papers
Topics
Authors
Recent
Search
2000 character limit reached

Mirror-CFE: Counterfactual Image Explanations

Updated 12 July 2026
  • Mirror-CFE is a counterfactual explanation method that reflects image features across classifier decision boundaries to flip predictions.
  • It operates directly in the classifier’s feature space using geometric reflection and an inverse U-Net-based mapping to produce realistic image transitions.
  • The approach ensures counterfactual validity, input resemblance, and classifier faithfulness while revealing the model's internal decision structure.

Searching arXiv for Mirror-CFE and closely related counterfactual-explanation work. Mirror-CFE is a counterfactual explanation method for deep image classification models that generates explanations by operating directly in the classifier’s own feature space rather than in an external latent space. Its central construction treats the pairwise decision boundary between a source class and a target class as a geometric “mirror,” reflects the source feature across that hyperplane, and then learns an inverse mapping back to image space while preserving distance relationships. In this formulation, counterfactual validity, input resemblance, and faithfulness to the trained classifier are addressed jointly, and the method also yields step-wise transitions that visualize how features evolve as classification confidence changes (Chowdhury et al., 20 Sep 2025).

1. Problem setting and conceptual basis

Mirror-CFE is designed for the standard counterfactual question for deep image classifiers: what minimal change to an input image would flip the model’s decision from its original class ss to a target class tt (Chowdhury et al., 20 Sep 2025). In the formulation used by the method, a good counterfactual explanation should be valid, plausible, proximal, sparse, diverse, and faithful. The last of these is treated as the defining requirement: the explanation should reflect exactly what the classifier has learned, including both its feature representation and its decision boundaries.

The method is motivated by limitations attributed to earlier counterfactual pipelines. Earlier methods are described as typically following one of three patterns: exhaustive search in pixel or latent spaces, reliance on external generative models such as VAEs, GANs, or diffusion models, or region editing by example retrieval. In the Mirror-CFE formulation, such approaches usually ignore the actual decision boundaries and feature embeddings of the trained classifier, which can produce unfaithful explanations, including adversarial noise or unrealistic edits, and provide no direct access to the classifier’s own latent geometry.

The distinctive claim of Mirror-CFE is therefore not merely that it produces realistic edited images, but that it explains the intrinsic feature space and decision boundaries learned by the classifier. This suggests that the method should be understood primarily as a classifier-faithful explanation framework rather than as a generic image-editing pipeline.

2. Geometric formulation in classifier feature space

Mirror-CFE formalizes the classifier as a pretrained feature extractor F:XZF:\mathcal{X}\to\mathcal{Z}, with XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W} the image space and Z=RN\mathcal{Z}=\mathbb{R}^N the feature space, together with a final linear layer WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|} and bias bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}. The classifier probabilities are written as

p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.

For a source class ss and target class tt, Mirror-CFE defines the pairwise boundary parameters

tt0

so that the hyperplane tt1 is the pairwise decision boundary between tt2 and tt3 (Chowdhury et al., 20 Sep 2025).

Given a source feature tt4, the full reflection across this hyperplane is

tt5

Mirror-CFE further introduces a step factor tt6, producing intermediate feature points

tt7

This parameterization has an immediate decision-theoretic interpretation. When tt8, tt9 is the orthogonal projection of the source feature onto the mirror; when F:XZF:\mathcal{X}\to\mathcal{Z}0, it is the full reflection. Any F:XZF:\mathcal{X}\to\mathcal{Z}1 yields a valid counterfactual feature that flips classification to F:XZF:\mathcal{X}\to\mathcal{Z}2, whereas F:XZF:\mathcal{X}\to\mathcal{Z}3 yields a semi-factual that remains in class F:XZF:\mathcal{X}\to\mathcal{Z}4. The method thereby converts counterfactual generation into a controlled traversal of the classifier’s own decision geometry.

3. Inverse mapping and training objective

The feature-space construction alone does not produce images. Mirror-CFE therefore learns an inverse map F:XZF:\mathcal{X}\to\mathcal{Z}5, together with a small adversarial discriminator F:XZF:\mathcal{X}\to\mathcal{Z}6, so that F:XZF:\mathcal{X}\to\mathcal{Z}7 is a realistic image whose classifier feature is F:XZF:\mathcal{X}\to\mathcal{Z}8 (Chowdhury et al., 20 Sep 2025). The training objective combines five losses.

The classification loss enforces validity in feature space:

F:XZF:\mathcal{X}\to\mathcal{Z}9

The adversarial term promotes realism:

XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}0

The reconstruction loss imposes cycle consistency for real images:

XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}1

The feature-reconstruction loss imposes cycle consistency for counterfactual features:

XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}2

The triangulation loss encodes proximity and plausibility. For a source image XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}3, a target image XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}4, and a generated image XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}5, the ratio

XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}6

is used to constrain relative image-space distances through

XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}7

This is implemented as the one-sided hinge loss

XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}8

For semi-factuals with XRC×H×W\mathcal{X}\subset\mathbb{R}^{C\times H\times W}9, Mirror-CFE defines Z=RN\mathcal{Z}=\mathbb{R}^N0 relative to a random same-class sample Z=RN\mathcal{Z}=\mathbb{R}^N1, giving Z=RN\mathcal{Z}=\mathbb{R}^N2. The complete triangulation term is

Z=RN\mathcal{Z}=\mathbb{R}^N3

The generator objective is then

Z=RN\mathcal{Z}=\mathbb{R}^N4

with typical settings Z=RN\mathcal{Z}=\mathbb{R}^N5, Z=RN\mathcal{Z}=\mathbb{R}^N6, and Z=RN\mathcal{Z}=\mathbb{R}^N7 or Z=RN\mathcal{Z}=\mathbb{R}^N8 on some datasets. The overall design couples classifier consistency, visual realism, and geometric faithfulness in a single objective.

4. Architecture and optimization procedure

Mirror-CFE fixes the pretrained classifier Z=RN\mathcal{Z}=\mathbb{R}^N9 and does not fine-tune it during explanation generation, explicitly to guarantee faithfulness (Chowdhury et al., 20 Sep 2025). The decoder WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}0 is implemented as a U-Net with skip-connection controllers (SCC) that modulate the flow of high-frequency features from WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}1 to WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}2 through a small bottleneck, while a discriminator WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}3 evaluates realism.

Training alternates between generator and discriminator updates. The procedure samples real images and latent counterfactual points WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}4, computes WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}5, and WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}6, updates WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}7 with Adam at learning rate WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}8, and then updates WRN×C\mathbf{W}\in\mathbb{R}^{N\times|\mathcal{C}|}9 to maximize bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}0. Reported training schedules are approximately bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}1–bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}2 epochs on MNIST, Fashion-MNIST, and Blood-MNIST, and approximately bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}3 epochs on CelebA-HQ.

A notable architectural constraint is that the method requires a GAP-based architecture to compute CAM masks in the SCC module. Vision Transformers, which are described as lacking GAP or meaningful CAMs in this setting, would therefore require approximate attentional priors. This limitation is not incidental: it follows from the specific way Mirror-CFE reuses the classifier’s own internal structure to preserve faithfulness.

5. Evaluation protocol and empirical results

Mirror-CFE is evaluated against PGD, REVISE, CEM, ExpGAN, and C3LT on four datasets: MNIST, Fashion-MNIST, Blood-MNIST, and CelebA-HQ (Chowdhury et al., 20 Sep 2025). The reported metrics are Validity, Denoised Validity, Proximity measured by mean bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}4 distance, Sparsity measured by LPIPS, Realism measured by FID, and bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}5Fail, the fraction of test cases for which no counterfactual is found.

The paper reports results for two operating points: the first valid counterfactual at bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}6, and the full reflection at bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}7.

Dataset First valid CFE (bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}8) Full reflection (bRC\mathbf{b}\in\mathbb{R}^{|\mathcal{C}|}9)
MNIST p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.0, LPIPS p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.1, FID p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.2, D.Val. p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.3, Val. p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.4, Fail p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.5 p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.6, LPIPS p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.7, FID p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.8, D.Val. p(z)  =  σ(Wz+b)  ΔC1.\mathbf{p}(\mathbf{z}) \;=\;\sigma\bigl(\mathbf{W}^\top \mathbf{z} + \mathbf{b}\bigr)\;\in\Delta^{|\mathcal{C}|-1}.9, Val. ss0, Fail ss1
F-MNIST ss2, LPIPS ss3, FID ss4, D.Val. ss5, Val. ss6, Fail ss7 ss8, LPIPS ss9, FID tt0, D.Val. tt1, Val. tt2, Fail tt3
Blood-MNIST tt4, LPIPS tt5, FID tt6, D.Val. tt7, Val. tt8, Fail tt9 tt00, LPIPS tt01, FID tt02, D.Val. tt03, Val. tt04, Fail tt05
CelebA-HQ tt06, LPIPS tt07, FID tt08, D.Val. tt09, Val. tt10, Fail tt11 tt12, LPIPS tt13, FID tt14, D.Val. tt15, Val. tt16, Fail tt17

Across these experiments, Mirror-CFE is reported to achieve the highest validity and denoised validity among the compared methods while maintaining competitive proximity and perceptual similarity, without producing adversarial noise. The distinction between the first valid crossing and the full reflection is also significant: the former isolates the minimal class-flipping perturbation along the mirror direction, whereas the latter shows the endpoint of the geometric reflection procedure.

6. Interpretability, scope, and limitations

Mirror-CFE provides interpretability through step-wise transitions tt18 generated by varying tt19 from tt20 to tt21 (Chowdhury et al., 20 Sep 2025). These sequences begin at the original image, pass through the decision boundary, and end at the reflected feature, thereby revealing which features evolve as the target-class confidence changes. Reported examples include changes in strokes for MNIST, cell shape for Blood-MNIST, and mouth openness for CelebA-HQ.

The method also supports latent-trajectory analysis by plotting the confidence tt22 and the average pixel difference tt23 as functions of tt24. This allows the transition point where the target confidence crosses tt25 to be identified explicitly. For multi-class models, the reflection point can be refined with L-BFGS to ensure a true confidence swap between tt26 and tt27, and the resulting tt28 can be visualized with t-SNE to verify that it lies in the target cluster.

The method’s reported advantages are true faithfulness through reuse of the same tt29, tt30, and tt31; animated explanations rather than a single static counterfactual; robustness to adversarial shortcuts, reflected in high denoised validity; and a unified treatment of counterfactual, semi-factual, and factual explanations. Its stated limitations are the dependence on GAP-based architectures for CAM masks and the observation that high-resolution fidelity is governed by skip connections through tt32, so very high resolution may require richer style priors. Proposed future directions are adaptation to Transformer-based classifiers via learned attention masks, extension of the mirror-based reflection concept to structured-data classifiers, and incorporation of nonlinear “mirrors” through local second-order approximations.

A common misunderstanding would be to treat Mirror-CFE as merely a generator-assisted image-editing method. Its defining property is narrower and more technical: it constructs explanations by reflecting representations in the classifier’s own feature space and by decoding those reflected points back to images under explicit constraints designed to preserve classifier consistency, visual realism, and distance structure. This suggests that its contribution lies as much in explanation geometry as in image synthesis.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Mirror-CFE.