Manuscript Offprint
arXiv:2610.23577CLEAR: Cooperative Latent Flow for Visual Counterfactual Explanations with Accurate Region Preservation
Abstract
Visual counterfactual explanations (VCEs) should alter a classifier's prediction while remaining realistic and preserving decision-irrelevant content. Image-space methods provide high-quality counterfactuals but are computationally costly, whereas latent-space methods are more efficient but often less faithful. We identify two sources responsible for this gap. First, latent generation recovers a natural sample from a perturbed representation, whereas classifier guidance pushes it toward a target class, so their update directions may oppose. Second, VAE reconstruction can alter regions that should remain unchanged. We introduce CLEAR, a latent Flow Matching framework for VCEs. CLEAR uses Flow Matching's explicit instantaneous velocity as a reference for the generative direction to decompose classifier guidance into cooperative and conflicting components. It preserves the cooperative component and adaptively attenuates only the conflicting one according to conflict strength. We further analyze conflict frequency and strength throughout generation to reveal how classifier guidance interacts with the generative process. CLEAR also dynamically identifies editable regions, constrains latent modifications, and directly preserves factual content outside them to reduce VAE-induced changes. Across five bidirectional tasks on two datasets, CLEAR retains latent-space efficiency while achieving counterfactual quality comparable to or better than strong image-space baselines, with a speedup over the strongest baseline. Project page: https://yan-zen9.github.io/CLEAR/
1. Introduction
Visual counterfactual explanations (VCEs) address a question: what meaningful change to an input image would alter a classifier's prediction? [16, 42] Unlike attribution
Factual Image
No Smile → Smile
Additive Guidance
Hard Projection
CLEAR

Source: No Smile
Target Prob.: 0.96
Target Prob.: 0.53
Target Prob.: 0.99
Figure 1. Motivation for Cooperative Flow Guidance. Additive guidance may cause excessive editing, while hard projection can lead to insufficient editing. CLEAR adaptively regulates conflicting guidance to produce a natural and effective counterfactual.
methods that highlight potentially important regions, VCEs show the visual changes needed to produce an alternative prediction [13, 16, 39, 40]. A reliable counterfactual should change the classifier prediction while remaining realistic and preserving content unrelated to the target decision [25, 34, 45]. Diffusion models have improved VCE quality by keeping counterfactuals close to the natural image distribution [1, 2, 24, 25]. However, image-space methods repeatedly perform generation and classifier guidance in high-dimensional pixel space, leading to substantial computational and memory costs [17, 46]. Latent generation provides an efficient alternative by operating on compact representations [8, 30, 33, 38], but often at the cost of counterfactual fidelity. The challenge is to retain latent-space VCE efficiency while approaching the fidelity of image-space methods.
One key challenge is aligning classifier guidance with the generative process. Latent generation seeks to recover a natural sample from a perturbed representation, whereas classifier guidance pushes the sample toward a target class. During counterfactual generation, these objectives can produce opposing update directions. Importantly, such conflict does not mean that the entire classifier guidance is harmful:
Changlu and Oskar contributed equally to this work.
a single signal can contain both cooperative and conflicting components. Treating the whole guidance uniformly may either retain harmful conflict or discard useful information. CLEAR uses the explicit instantaneous velocity provided by Flow Matching [31] as a reference for the current generative direction. Unlike the sampler-dependent updates in DDPMs [21], this explicit direction allows CLEAR to decompose the components of classifier guidance with respect to the current generative flow. CLEAR preserves the cooperative component and adaptively attenuates only the conflicting component according to conflict strength. As shown in Fig. 1, this avoids both excessive editing from fully retained conflicting guidance, and insufficient modification from removing it entirely. We further analyze directional conflicts throughout generation by examining their frequency, strength, and effect on the final counterfactuals, showing how classifier guidance interacts with the generative process.
A second challenge comes from VAE reconstruction, which can modify regions that should remain unchanged [33, 37]. CLEAR therefore identifies editable regions dynamically and maps them to latent resolution to constrain classifier-guided modifications throughout generation. Outside this support, the latent trajectory follows the original flow, and the final content outside the editable support is directly preserved in image space, preventing VAE reconstruction and latent editing leakage from affecting pixels outside the estimated support. Our main contributions are:
• We propose Cooperative Flow Guidance, which uses the explicit velocity field of Flow Matching for component-wise, conflict-aware regulation of classifier guidance during counterfactual generation.
• We systematically analyze directional conflicts during counterfactual generation to clarify the interaction between classifier guidance and the generative process.
• We introduce Adaptive Support Preservation (ASP), which dynamically localizes editable regions and preserves decision-irrelevant factual content across latent and image spaces.
• On two CelebA-HQ attributes and three ImageNet class pairs, CLEAR improves FID and sFID over the evaluated latent-space baselines; the CelebA-HQ Smile benchmark demonstrates a favorable quality–efficiency trade-off against image-space methods.
Latent visual counterfactual explanations. Earlier approaches explored counterfactual editing through compact generative representations and latent traversals [8, 30]. LDCE [38] and ECED [33] are the closest latent VCE methods. LDCE improves efficiency through latent diffusion and introduces consensus guidance, which filters classifier gradients according to their agreement with the diffusion model's implicit classifier. This recognizes that classifier guidance may not always agree with the semantic signal provided by the generator, but it compares two discriminative signals and performs patch-level filtering rather than explicitly relating classifier guidance to the current generative direction or separating its useful and conflicting components. ECED [33] considers spatial localization and background preservation by restricting edits through visual explanations. To reduce VAE-induced reconstruction changes, it optimizes the background latent representation and fine-tunes the VAE decoder for each input, introducing test-time optimization that partially offsets the efficiency advantage of latent generation. Thus, LDCE primarily addresses classifier-gradient reliability, whereas ECED improves spatial and reconstruction fidelity; neither jointly resolves component-wise guidance conflict with the current generative direction and efficient preservation of decision-irrelevant content within a unified framework.
Classifier guidance and flow matching. Classifier guidance steers generative models using discriminative signals [11], while subsequent works extend guidance to external objectives [3, 15, 43] or adaptively control its behavior during generation [14, 29, 44]. However, these adaptive schemes mainly target general image generation and classifier-free guidance [20], rather than the component-wise interaction between external classifier guidance and the current generative direction in latent VCEs. Flow Matching [31] explicitly parameterizes an instantaneous velocity field, providing a natural reference for this directional relationship, and recent work has studied guidance in flow-based generation [12]. LeapFactual [5] further applies conditional flow matching to reliable model-agnostic counterfactual generation. In contrast, CLEAR uses the instantaneous latent flow direction to decompose external classifier guidance and selectively modulate only its generation-conflicting component, while adaptively preserving decision-irrelevant regions throughout counterfactual generation.
3. Method
3.1. Latent Flow Setup and Classifier View
Figure 2 provides an overview of CLEAR, which combines Cooperative Flow Guidance with Adaptive Support Preservation during latent flow generation.
Let E and D denote the encoder and decoder of a frozen VAE [37]. Given a factual image , we first obtain its latent representation
Rather than generating the counterfactual from pure noise, CLEAR starts from a partially noised version of the factual latent. Given Gaussian noise , the initial latent state is
Under the Flow Matching [31] parameterization used in this work, t = 0 corresponds to the noise endpoint and t = 1 to the clean data endpoint. Starting from an intermediate time retains factual semantic structure while leaving sufficient freedom for counterfactual modification.
Starting from , CLEAR evolves a single latent trajectory toward . At timestep , the Flow Matching model predicts the instantaneous velocity
which describes the current generative direction in latent space. Under the linear Flow Matching parameterization, we obtain a one-step estimate of the clean sample by extrapolating to the data endpoint and decoding it through the frozen VAE:
The resulting is an image-space estimate associated with the current latent state and is used to obtain classifier feedback during generation.
Let f denote the frozen target classifier. To focus its feedback on the current editable region, we construct the classifier view
where denotes the current editable support in image space. Its adaptive construction is described in Sec. 3.3. The classifier view provides the common image-space interface for the two core components of CLEAR: Cooperative Flow Guidance derives the classifier force acting on the latent trajectory, while Adaptive Support Preservation determines where counterfactual modification is permitted.
3.2. Cooperative Flow Guidance
CLEAR uses the instantaneous Flow Matching velocity as a reference to reconcile classifier guidance [11] with the current generative direction. Using the classifier view , we define
where is the classifier force applied to the latent trajectory and CE is the cross entropy. The classifier gradient is backpropagated through the frozen VAE decoder to the current latent state , allowing image-space classifier feedback to guide the latent trajectory.
As illustrated in Fig. 3, the sign of indicates whether the classifier force is cooperative, orthogonal, or conflicting with the current flow. Under conflict, CLEAR decomposes into components parallel and orthogonal to :
where is a small constant for numerical stability. Here, contains the opposing component under conflict, whereas does not directly counteract the generative flow.
CLEAR adapts the attenuation to the degree of directional conflict as
where controls conflict sensitivity. Thus, for non-conflicting directions, and increases with the degree of conflict. The reconciled classifier force is
Hence, CLEAR attenuates only the opposing parallel component while preserving non-conflicting classifier information.
Finally, we prevent classifier guidance from overwhelming the generative flow by bounding its magnitude:
Here, s is the maximum guidance scale.
Guided flow process (continuous time from 0.6 to 1)

Figure 2. Overview of CLEAR. Starting from a partially noised factual latent, CLEAR evolves the counterfactual along a guided latent flow. At each timestep, the flow model provides the generative velocity and a one-step image estimate, from which the target classifier produces both the classifier force and the current decision-relevant support. The image-space support is mapped to the latent grid to constrain where classifier-driven modifications are introduced, while Cooperative Flow Guidance determines how the classifier force modifies the generative direction. Repeating these coupled updates yields a counterfactual that concentrates changes within the evolving editable support while preserving decision-irrelevant factual content.
3.3. Adaptive Support Preservation
VAE reconstruction may introduce changes outside regions intended for counterfactual editing. CLEAR therefore dynamically estimates an editable support and uses it to spatially constrain generation.
Let denote the image-space editable support. We compute the saliency map using GradCAM [39] with respect to the target class . The initial support is obtained from the factual image , while subsequent supports are updated from the current classifier view . For an Euler step of size ,
(11)
Here, retains the top fraction of pixels ranked by target-class Grad-CAM response, LCC extracts the largest connected component, and dilation provides spatial margin around the resulting support. The initial support is constructed analogously using target-class Grad-CAM on . The new support replaces the previous one, allowing it to adapt throughout generation.
Since the support represents spatial location rather than image content, we map it to the latent spatial resolution by average pooling,
where denotes average pooling. This maps the binary image-space support to a soft latent gate , providing smooth transitions near support boundaries.
The resulting latent gate restricts classifier-driven editing as
(13)
Thus, cooperative guidance acts inside the editable support, while the remaining region follows the original Flow Matching dynamics.
Finally, we remove residual reconstruction changes outside the final support by composing the output in image space:
where is the decoded final latent. This combines adaptive spatial editing with exact factual-pixel preservation outside the final support.
4. Experiments
4.1. Experimental Setup
Datasets and implementation. We follow the ACE protocol [25] for data splits, preprocessing, and classifier settings. Both CelebA-HQ [27, 32] and ImageNet [10] are evaluated at resolution.
(a) DDPM: Sampler-dependent update

(b) Flow Matching: Velocity-based update
Explicit velocity enables direct comparison with the classifier force
(c) Cooperative flow guidance
(i) No conflict
(ii) Mild conflict

(iii) Severe conflict


Figure 3. From sampler-dependent denoising to cooperative flow guidance. (a) In DDPMs, the predicted noise is converted into a state update through a chosen sampler, making the update direction sampler-dependent. (b) Flow Matching directly predicts the instantaneous velocity , providing an explicit generative direction for comparison with the classifier force. (c) CLEAR reconciles the classifier force according to its directional conflict with . In the non-conflicting case (i.e. ), illustrated here by an orthogonal example, is retained. Under mild or severe conflict, CLEAR decomposes into parallel and orthogonal components and increasingly attenuates only the opposing component as the conflict strength grows, yielding the reconciled force and guided velocity .
On CelebA-HQ, we consider the bidirectional Smile and Age tasks using a DenseNet-121 [22] classifier. On ImageNet, we use a ResNet-50 [18] classifier and evaluate sorrel↔zebra, Persian cat↔Egyptian cat, and cougar↔cheetah. Both datasets use the frozen stabilityai/sd-vae-ft-mse VAE [37] with publicly released pretrained Latent Flow Matching (LFM) checkpoints [9]. We use the unconditional DiT-L/2 checkpoint for CelebA-HQ and the class-conditional DiT-B/2 checkpoint for ImageNet, which is used unconditionally during counterfactual inference. All pretrained models remain frozen, and CLEAR requires no additional training or fine-tuning. For all tasks, CLEAR uses , uniform Euler steps ( ), and a maximum guidance scale . Cooperative Flow Guidance uses . Adaptive Support Preservation retains the top 5%, 12%, and 30% salient pixels for Smile, Age, and ImageNet, respectively, with a dilation radius of 4 for all tasks. The image-space support is mapped to the latent grid using average pooling. Except for the support ratio, all CLEAR hyperparameters are shared across tasks. All counterfactual inference and efficiency experiments are performed on the same AMD Instinct MI250X 64 GB GPU, and the reported efficiency measures counterfactual inference only.
Evaluation metrics. Following MaskDiME [17], we measure computational efficiency using wall-clock inference time and peak GPU memory. Following ACE [25], counterfactual validity is evaluated using flip rate (FR) and COUT, while FID [19] and sFID measure [35] distributional realism. On CelebA-HQ, FVA and face similarity (FS) [4] assess identity preservation, whereas MNAC and CD quantify non-target attribute changes and deviations from their natural co-variation. On ImageNet, [6] measures semantic similarity between factual and counterfactual images.
4.2. Computational Efficiency
Figure 4 compares the quality–efficiency trade-off of CLEAR with representative image-space VCE methods and the latent baseline LDCE-txt [38]. CLEAR achieves the lowest runtime and FID among the compared methods while maintaining a low peak GPU memory footprint. Compared with the image-space baselines, it provides and speedups over MaskDiME [17] and DiME [24], respectively. CLEAR is also substantially faster and achieves lower FID than LDCE-txt, demonstrating a stronger quality–efficiency trade-off than the existing latent baseline.
Table 1. Quantitative comparison on CelebA-HQ across the Smile and Age tasks. Methods marked with operate in latent space. Best and second-best results are highlighted in bold and underline, respectively.
| Method | Smile | Age | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| FID↓ | sFID↓ | FVA↑ | FS↑ | MNAC↓ | CD↓ | COUT↑ | FR(%)↑ | FID↓ | sFID↓ | FVA↑ | FS↑ | MNAC↓ | CD↓ | COUT↑ | FR(%)↑ | |
| DiVE [36] | 107.0 | - | 35.7 | - | 7.41 | - | - | - | 107.5 | - | 32.3 | - | 6.76 | - | - | - |
| STEEX [23] | 21.9 | - | 97.6 | - | 5.27 | - | - | - | 26.8 | - | 96.0 | - | 5.63 | - | - | - |
| DiME [24] | 18.1 | 27.7 | 96.7 | 0.67 | 2.63 | 1.82 | 0.65 | 97.0 | 18.7 | 27.8 | 95.0 | 0.66 | 2.10 | 4.29 | 0.56 | 97.0 |
| ACE [25] | 3.21 | 20.2 | 100.0 | 0.89 | 1.56 | 2.61 | 0.55 | 95.0 | 5.31 | 21.7 | 99.6 | 0.81 | 1.53 | 5.40 | 0.40 | 95.0 |
| ACE [25] | 6.93 | 22.0 | 100.0 | 0.84 | 1.87 | 2.21 | 0.60 | 95.0 | 16.4 | 28.2 | 99.6 | 0.77 | 1.92 | 4.21 | 0.53 | 95.0 |
| TiME [26] | 10.98 | 23.8 | 96.6 | 0.79 | 2.97 | 2.32 | 0.63 | 97.1 | 20.9 | 32.9 | 79.3 | 0.63 | 4.19 | 4.29 | 0.31 | 89.9 |
| RCSB [41] | 3.04 | 20.0 | 100.0 | 0.94 | 1.22 | 3.22 | 0.83 | 98.9 | 4.92 | 27.3 | 100.0 | 0.96 | 1.47 | 5.16 | 0.80 | 99.4 |
| MaskDiME [17] | 2.51 | 18.1 | 100.0 | 0.94 | 1.41 | 2.67 | 0.69 | 99.4 | 4.43 | 19.4 | 100.0 | 0.88 | 1.82 | 4.67 | 0.63 | 99.6 |
| LDCE-txt [38] | 13.6 | 25.8 | 99.1 | 0.76 | 2.44 | 1.68 | 0.34 | - | 14.2 | 25.6 | 98.0 | 0.73 | 2.12 | 4.02 | 0.33 | - |
| ECED [33] | 7.56 | 24.9 | 100.0 | 0.90 | 1.32 | 5.08 | 0.84 | - | 12.4 | 31.6 | 100.0 | 0.96 | 0.84 | 4.93 | 0.74 | - |
| CLEAR | 2.18 | 17.4 | 100.0 | 0.94 | 1.30 | 2.28 | 0.65 | 99.6 | 4.11 | 19.0 | 100.0 | 0.91 | 1.38 | 4.94 | 0.67 | 100.0 |

Figure 4. Inference efficiency and counterfactual quality on CelebA-HQ Smile. All methods are evaluated on 1,000 images at resolution with a batch size of 3. Runtime and peak GPU memory measure counterfactual inference only. denotes a latent-space method.
4.3. Counterfactual Quality
Having established the computational advantage of CLEAR, we next examine whether this efficiency compromises counterfactual quality.
CelebA-HQ. As shown in Table 1, CLEAR achieves the best FID and sFID on both Smile and Age, while maintaining near-perfect validity and strong identity preservation. Compared with existing latent VCE methods, CLEAR substantially improves realism and approaches or surpasses strong image-space baselines, narrowing the fidelity gap between latent- and image-space counterfactual generation while avoiding excessive non-target changes. The qualitative results in Fig. 5 further demonstrate localized edits with strong identity preservation.
ImageNet. Table 2 shows that CLEAR consistently outperforms existing latent-space methods [33, 38] in FID and sFID across all three semantic class pairs, while remain- ing competitive with the strongest image-space baselines. At the same time, CLEAR achieves the best or tied-best with near-perfect flip rates. These results show that CLEAR preserves its quality–efficiency advantage beyond localized facial edits, extending to challenging global semantic transformations. Figure 6 further shows that CLEAR handles challenging global semantic transformations.

(a) No Smile → Smile
(b) Smile → No Smile
(c) Young → Old
(d) Old → Young
Figure 5. Qualitative comparison on CelebA-HQ using DenseNet-121. From left to right: the factual image and counterfactual images generated by MaskDiME and CLEAR.
4.4. Directional Conflict Analysis
Figure 7 reveals the interaction between classifier guidance and the current generative flow. As shown in Fig. 7(a), directional conflict occurs frequently across all five bidirectional tasks and becomes more common toward the end of the generation process. This is counter-intuitive, since the classifier force is expected to become more aligned with the generative direction as target-class semantics emerge. Instead, directional disagreement becomes more frequent, in-
Table 2. Quantitative comparison on ImageNet across three semantic class pairs. Methods marked with operate in latent space. Best and second-best results are highlighted in bold and underline, respectively.
| Method | Sorrel - Zebra | Persian Cat - Egyptian Cat | Cougar - Cheetah | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| FID↓ | sFID↓ | COUT↑ | FR(%)↑ | FID↓ | sFID↓ | COUT↑ | FR(%)↑ | FID↓ | sFID↓ | COUT↑ | FR(%)↑ | ||||
| DiME [24] | 222.9 | 243.2 | 0.19 | -0.31 | 0.0 | 322.8 | 352.1 | 0.44 | -0.05 | 0.0 | 268.2 | 292.0 | 0.11 | -0.16 | 0.0 |
| ACE [25] | 84.5 | 122.7 | 0.92 | -0.45 | 47.0 | 93.6 | 156.7 | 0.85 | 0.25 | 85.0 | 70.2 | 100.5 | 0.91 | 0.02 | 77.0 |
| ACE [25] | 67.7 | 98.4 | 0.90 | -0.25 | 81.0 | 107.3 | 160.4 | 0.78 | 0.34 | 97.0 | 74.1 | 102.5 | 0.88 | 0.12 | 95.0 |
| FastDiME [46] | 96.5 | 103.5 | 0.22 | -0.44 | 14.0 | 193.6 | 207.1 | 0.10 | 0.01 | 20.0 | 133.0 | 141.1 | 0.12 | -0.11 | 18.0 |
| DVCE [1] | 33.1 | 43.9 | 0.62 | -0.21 | 57.8 | 46.6 | 59.2 | 0.59 | 0.60 | 98.5 | 46.9 | 54.1 | 0.70 | 0.49 | 99.0 |
| RCSB [41] | 8.0 | 16.2 | 0.88 | 0.74 | 94.7 | 23.0 | 40.0 | 0.87 | 0.92 | 100.0 | 17.2 | 26.6 | 0.92 | 0.92 | 100.0 |
| MaskDiME [17] | 32.5 | 39.7 | 0.94 | 0.85 | 99.7 | 36.2 | 50.1 | 0.87 | 0.89 | 100.0 | 37.4 | 46.3 | 0.93 | 0.92 | 100.0 |
| LDCE-cls [38] | 84.2 | 107.2 | 0.78 | -0.06 | 88.0 | 102.7 | 140.7 | 0.63 | 0.52 | 99.0 | 71.0 | 91.8 | 0.62 | 0.51 | 100.0 |
| LDCE-txt [38] | 82.4 | 107.2 | 0.71 | -0.21 | 81.0 | 121.7 | 162.4 | 0.61 | 0.56 | 99.0 | 91.2 | 117.0 | 0.59 | 0.34 | 98.0 |
| ECED-v [33] | 33.0 | 45.2 | 0.95 | 0.77 | 98.0 | 27.4 | 53.5 | 0.98 | 0.85 | 100.0 | 23.3 | 37.3 | 0.95 | 0.83 | 99.5 |
| ECED-r [33] | 63.1 | 97.8 | 0.86 | 0.68 | 98.5 | 44.3 | 71.2 | 0.94 | 0.81 | 100.0 | 47.0 | 76.6 | 0.96 | 0.82 | 100.0 |
| CLEAR | 24.3 | 31.3 | 0.96 | 0.77 | 99.9 | 26.7 | 42.1 | 0.98 | 0.82 | 100.0 | 21.6 | 35.5 | 0.96 | 0.84 | 100.0 |

(a) Sorrel → Zebra
(c) Persian Cat → Egyptian Cat
(e) Cougar → Cheetah

(b) Zebra → Sorrel
(d) Egyptian Cat → Persian Cat
(f) Cheetah → Cougar
Figure 6. Qualitative results on ImageNet using ResNet-50. Each pair shows a factual image and the corresponding counterfactual generated by CLEAR for the paired target class.
dicating that simply determining whether is insufficient to characterize the effect of conflict.
Figure 7(b) further shows the conflict strength relative to the current generative velocity, measured as . ImageNet transformations exhibit strong early conflicts that rapidly decrease, whereas CelebA-HQ Smile and Age edits start with weaker conflicts, peak at intermediate stages, and then decline. This reflects their different semantic changes: global ImageNet transformations require stronger classi- fier correction early on, while localized facial edits induce stronger conflict as the target attribute emerges. Despite these different dynamics, individual conflicts generally become weaker toward the end of generation, as target semantics stabilize and less classifier correction is required.
The different trends of conflict frequency and strength show that directional conflict should not be treated as a binary event, but its degree should also be considered. As shown in Fig. 7(c), Hard Projection and Additive Guidance retain 0% and 100% of the conflicting component respectively, whereas CLEAR adaptively retains 83.3–88.8% across the five tasks.
Figure 8 further illustrates the effect of different conflict regimes on the final counterfactuals. When conflicts are weak, even high conflict frequency leads to only limited differences between guidance strategies. In contrast, low-frequency but strong conflicts are already sufficient to produce noticeable differences: Additive Guidance may cause excessive modification, whereas Hard Projection may over-suppress useful classifier guidance. When both conflict frequency and strength are high, these differences become most pronounced. CLEAR instead adaptively attenuates the opposing component according to conflict strength, achieving a better balance between target modification and visual naturalness. Additional qualitative results for the effects of conflict on ImageNet are provided in the Appendix.
4.5. Ablation Studies
We evaluate the main components of CLEAR on CelebA-HQ Smile. For Cooperative Flow Guidance, Additive Guidance disables conflict-aware attenuation by setting , while Hard Projection completely removes the opposing component whenever . For Adaptive Support Preservation, Fixed Mask keeps the initial support unchanged, W/o Masked View evaluates the classifier and
(a) Conflict frequency

(b) Conflict strength

(c) Retained conflicting component

Figure 7. Directional conflict analysis during generation. (a) Conflict frequency across Flow Matching timesteps. (b) Conflict strength, measured by the relative magnitude . (c) Percentage of the conflicting component retained after Cooperative Flow Guidance, with Hard Projection and Additive Guidance corresponding to and retention, respectively.

Figure 8. Qualitative results under different conflict regimes. Rows show examples with different combinations of conflict frequency and strength. CLEAR consistently produces more natural and effective counterfactuals.
saliency directly on , W/o Latent Mask removes spatial gating of the guided latent update, and W/o Pixel Reuse omits the final factual-pixel composition.
Cooperative guidance. Table 3 confirms that both extremes are suboptimal: fully retaining conflicting guidance degrades realism and non-target preservation, while removing it entirely reduces counterfactual validity. This supports CLEAR's central design of attenuating the conflicting component according to its strength rather than treating conflict as a binary event.
Adaptive support preservation. Removing any of the three ASP components degrades the overall performance.
Table 3. Main ablation on CelebA-HQ Smile. Each variant changes only the specified component while keeping all other settings fixed. MSE is measured outside each variant's final editable support and is zero by construction for variants using factual-pixel composition.
| Variant | FID↓ | MNAC↓ | COUT↑ | FR(%)↑ | MSE↓ |
|---|---|---|---|---|---|
| CLEAR | 2.18 | 1.30 | 0.65 | 99.6 | 0.000 |
| Cooperative guidance | |||||
| Additive Guidance | 4.47 | 2.16 | 0.71 | 99.7 | 0.000 |
| Hard Projection | 3.66 | 1.63 | 0.64 | 95.6 | 0.000 |
| Adaptive Support Preservation | |||||
| Fixed Mask | 3.40 | 1.57 | 0.61 | 93.7 | 0.000 |
| W/o Masked View | 9.74 | 3.07 | 0.73 | 99.6 | 0.000 |
| W/o Latent Mask | 6.42 | 2.48 | 0.58 | 92.8 | 0.000 |
| W/o Pixel Reuse | 3.52 | 1.61 | 0.60 | 99.6 | 0.011 |
In particular, removing pixel reuse produces non-zero MSE outside the editable support, revealing residual VAE reconstruction changes in the background. CLEAR directly reuses factual pixels outside the final support, so zero MSE in these regions is guaranteed by construction. This verifies the composition operation, but does not independently validate support accuracy or continuity at the composition boundary. Further preservation visualizations and sensitivity analyses for , , N, s, and are provided in the Appendix.
5. Conclusion and Limitations
CLEAR improves latent visual counterfactual generation by addressing directional conflicts between classifier guidance and the generative flow, as well as reconstruction leakage outside the editable region. Cooperative Flow Guidance uses the instantaneous Flow Matching direction to preserve useful guidance while selectively attenuating components that conflict with the generative process. We further provide a novel way to systematically analyze directional conflicts throughout counterfactual generation and clarify the interaction between classifier guidance and the generative process. Adaptive Support Preservation constrains guided updates in latent space and directly preserves factual content outside the final editable region. Experiments on CelebA-HQ and ImageNet show that CLEAR achieves high counterfactual quality while retaining the efficiency of latent generation.
Our evaluation covers a limited range of counterfactual tasks, and the quantitative ablation studies focus on CelebA-HQ Smile. Extending the evaluation and ablations to more diverse tasks is a direction for future work.
References
[1] Maximilian Augustin, Valentyn Boreiko, Francesco Croce, and Matthias Hein. Diffusion visual counterfactual explanations. Advances in Neural Information Processing Systems, 35:364–377, 2022. 1, 2, 7
[2] Maximilian Augustin, Yannic Neuhaus, and Matthias Hein. Dig-in: Diffusion guidance for investigating networks – uncovering classifier differences, neuron visualisations and visual counterfactual explanations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11093–11103, 2024. 1, 2
[3] Arpit Bansal, Hong-Min Chu, Avi Schwarzschild, Soumyadip Sengupta, Micah Goldblum, Jonas Geiping, and Tom Goldstein. Universal guidance for diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 843–852, 2023. 2
[4] Qiong Cao, Li Shen, Weidi Xie, Omkar M. Parkhi, and Andrew Zisserman. VGGFace2: A dataset for recognising faces across pose and age. In Proceedings of the IEEE International Conference on Automatic Face and Gesture Recognition, pages 67–74, 2018. 5
[5] Zhuo Cao, Xuan Zhao, Lena Krieger, Hanno Scharr, and Ira Assent. LeapFactual: Reliable visual counterfactual explanation using conditional flow matching. In Advances in Neural Information Processing Systems, 2025. 2
[6] Xinlei Chen and Kaiming He. Exploring simple Siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 15750–15758, 2021. 5
[7] Townim Chowdhury, Vu Minh Hieu Phan, Kewen Liao, Nanyu Dong, Minh-Son To, Anton van den Hengel, Johan W. Verjans, and Zhibin Liao. Looking in the mirror: A faithful counterfactual explanation method for interpreting deep image classification models. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2239–2249, 2025. 2
[8] Joseph Paul Cohen, Rupert Brooks, Sovann En, Evan Zucker, Anuj Pareek, Matthew P. Lungren, and Akshay Chaudhari. Gifsplanation via latent shift: A simple autoencoder approach to counterfactual generation for chest x-rays. In Proceedings of the Fourth Conference on Medical Imaging with Deep Learning, pages 74–104, 2021. 1, 2
[9] Quan Dao, Hao Phung, Binh Nguyen, and Anh Tran. Flow matching in latent space. arXiv preprint arXiv:2307.08698, 2023. 5
[10] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 248–255, 2009. 4
[11] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat GANs on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021. 2, 3
[12] Ruiqi Feng, Chenglei Yu, Wenhao Deng, Peiyan Hu, and Tailin Wu. On the guidance of flow matching. In Pro-ceedings of the 42nd International Conference on Machine Learning, pages 16993–17029. PMLR, 2025. 2
[13] Ruth C. Fong and Andrea Vedaldi. Interpretable explanations of black boxes by meaningful perturbation. In Proceedings of the IEEE International Conference on Computer Vision, pages 3429–3437, 2017. 1
[14] Jiayang Gao, Tianyi Zheng, Jiayang Zou, Fengxiang Yang, Shice Liu, Luyao Fan, Zheyu Zhang, Hao Zhang, Jinwei Chen, Peng-Tao Jiang, Bo Li, and Jia Wang. : Control classifier-free guidance via score discrepancy analysis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 34398–34407, 2026. 2
[15] Hyojun Go, Yunsung Lee, Jin-Young Kim, Seunghyun Lee, Myeongho Jeong, Hyun Seung Lee, and Seungtaek Choi. Towards practical plug-and-play diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1962–1971, 2023. 2
[16] Yash Goyal, Ziyan Wu, Jan Ernst, Dhruv Batra, Devi Parikh, and Stefan Lee. Counterfactual visual explanations. In International Conference on Machine Learning, pages 2376–2384, 2019. 1, 2
[17] Changlu Guo, Anders Nymark Christensen, Anders Bjorholm Dahl, and Morten Rieger Hannemose. MaskDiME: Adaptive masked diffusion for precise and efficient visual counterfactual explanations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 24118–24128, 2026. 1, 2, 5, 6, 7
[18] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 770–778, 2016. 5
[19] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. Advances in Neural Information Processing Systems, 30, 2017. 5
[20] Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022. 2
[21] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020. 2
[22] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q. Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4700–4708, 2017. 5
[23] Paul Jacob, Éloi Zablocki, Hedi Ben-Younes, Mickaël Chen, Patrick Pérez, and Matthieu Cord. STEEX: Steering counterfactual explanations with semantics. In European Conference on Computer Vision, pages 387–403, 2022. 6
[24] Guillaume Jeanneret, Loïc Simon, and Frédéric Jurie. Diffusion models for counterfactual explanations. In Proceedings of the Asian Conference on Computer Vision, pages 858–876, 2022. 1, 2, 5, 6, 7
[25] Guillaume Jeanneret, Loïc Simon, and Frédéric Jurie. Adversarial counterfactual visual explanations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pat-
tern Recognition, pages 16425–16435, 2023. 1, 2, 4, 5, 6, 7
[26] Guillaume Jeanneret, Loïc Simon, and Frédéric Jurie. Text-to-image models for counterfactual explanations: A black-box approach. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 4757–4767, 2024. 6
[27] Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017. 4
[28] Siwon Kim, Jinoh Oh, Sungjin Lee, Seunghak Yu, Jaeyoung Do, and Tara Taghavi. Grounding counterfactual explanation of image classifiers to textual concept space. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10942–10950, 2023. 2
[29] Mingi Kwon, Shin seong Kim, Jaeseok Jeong, Yi Ting Hsiao, and Youngjung Uh. Tcfg: Tangential damping classifier-free guidance. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2620–2629, 2025. 2
[30] Oran Lang, Yossi Gandelsman, Michal Yarom, Yoav Wald, Gal Elidan, Avinatan Hassidim, William T. Freeman, Phillip Isola, Amir Globerson, Michal Irani, and Inbar Mosseri. Explaining in style: Training a gan to explain a classifier in stylespace. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 693–702, 2021. 1, 2
[31] Yaron Lipman, Ricky T. Q. Chen, Heli Ben-Hamu, Maximilian Nickel, and Matthew Le. Flow matching for generative modeling. In International Conference on Learning Representations, 2023. 2, 3
[32] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pages 3730–3738, 2015. 4
[33] Tung Luu, Nam Le, Duc Le, and Bac Le. From visual explanations to counterfactual explanations with latent diffusion. In Proceedings of the Winter Conference on Applications of Computer Vision, pages 420–429, 2025. 1, 2, 6, 7
[34] Thomas Melistas, Nikos Spyrou, Nefeli Gkouti, Pedro Sanchez, Athanasios Vlontzos, Yannis Panagakis, Giorgos Papanastasiou, and Sotirios A. Tsaftaris. Benchmarking counterfactual image generation. Advances in Neural Information Processing Systems, 37:133207–133230, 2024. 1
[35] Charlie Nash, Jacob Menick, Sander Dieleman, and Peter Battaglia. Generating images with sparse representations. In Proceedings of the 38th International Conference on Machine Learning, pages 7958–7968. PMLR, 2021. 5
[36] Pau Rodriguez, Massimo Caccia, Alexandre Lacoste, Lee Zamparo, Issam Laradji, Laurent Charlin, and David Vazquez. Beyond trivial counterfactual explanations with diverse valuable explanations. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1056–1065, 2021. 6
[37] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022. 2, 3, 5
[38] Simon Schrodi, Karim Farid, Max Argus, and Thomas Brox. Latent diffusion counterfactual explanations. In German Conference on Pattern Recognition, pages 295–311, 2024. 1, 2, 5, 6, 7
[39] Ramprasaath R. Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision, pages 618–626, 2017. 1, 4
[40] Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013. 1
[41] Bartłomiej Sobieski, Jakub Grzywaczewski, Bartłomiej Sadlej, Matthew Tivnan, and Przemysław Biecek. Rethinking visual counterfactual explanations through region constraint. In International Conference on Learning Representations, 2025. 6, 7
[42] Sandra Wachter, Brent Mittelstadt, and Chris Russell. Counterfactual explanations without opening the black box: Automated decisions and the GDPR. Harvard Journal of Law & Technology, 31(2):841–887, 2017. 1
[43] Bram Wallace, Akash Gokul, Stefano Ermon, and Nikhil Naik. End-to-end diffusion latent optimization improves classifier guidance. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 7280–7290, 2023. 2
[44] Hanyang Wang, Yiyang Liu, Jiawei Chi, Fangfu Liu, Ran Xue, and Yueqi Duan. CFG-Ctrl: Control-based classifier-free diffusion guidance. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11437–11447, 2026. 2
[45] Pei Wang and Nuno Vasconcelos. Scout: Self-aware discriminant counterfactual explanations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8981–8990, 2020. 1, 2
[46] Nina Weng, Paraskevas Pegios, Eike Petersen, Aasa Feragen, and Siavash Bigdeli. Fast diffusion-based counterfactuals for shortcut removal and generation. In European Conference on Computer Vision, pages 338–357, 2024. 1, 2, 7
[47] Lintong Zhang, Kang Yin, and Seong-Whan Lee. Towards fine-grained interpretability: Counterfactual explanations for misclassification with saliency partition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 30053–30062, 2025. 2

Figure S1. Additional qualitative results under different conflict regimes. Results on CelebA-HQ Age and ImageNet further demonstrate the consistent behavior of CLEAR across different conflict settings.

Figure S2. Visualization of localized counterfactual editing. The editable support concentrates changes in target-relevant regions while preserving the remaining factual content.
A. Additional Analysis
A.1. Additional Qualitative Results under Different Conflict Regimes
Figure S1 extends the qualitative conflict analysis in Fig. 8 of the main paper to CelebA-HQ Age and ImageNet. The examples cover different combinations of conflict frequency and strength for both localized facial editing and global semantic transformations. Consistent with the observations in the main paper, weak conflicts produce relatively small differences between guidance strategies, whereas stronger conflicts lead to more visible differences in the resulting counterfactuals. Additive Guidance can introduce excessive modification, while Hard Projection may suppress useful classifier guidance. CLEAR instead adaptively attenuates the conflicting component according to its strength, producing natural and effective counterfactuals across these different settings.

(a) No smile → Smile

(b) Smile → No smile

(c) Young → Old

(d) Old → Young
Figure S3. Exact preservation with Adaptive Support Preservation. From left to right: factual image, CLEAR counterfactual, and pixel-wise difference map. Pixels outside the editable support remain unchanged.
A.2. Adaptive Support Preservation
Latent-space editing alone does not guarantee exact preservation of decision-irrelevant content. Even when classifier-driven updates are spatially restricted in latent space, VAE decoding can still introduce reconstruction changes outside the intended editable region. Adaptive Support Preservation (ASP) addresses this issue at both the latent and image levels. During generation, it restricts classifier-driven updates to a dynamically estimated editable support, while after generation it directly reuses factual pixels outside the final support.
Figure S2 visualizes the editable support together with the resulting counterfactual changes. The modifications closely follow the identified target-relevant regions, showing that ASP localizes counterfactual editing rather than allowing unnecessary changes across the image. This is particularly important for latent VCEs, where restricting the latent trajectory alone does not necessarily prevent recon-
Table S1. Hyperparameter sensitivity on CelebA-HQ Smile. The default configuration uses , , , , and .
| Setting | FID↓ | MNAC↓ | COUT↑ | FR(%)↑ |
|---|---|---|---|---|
| Default | 2.18 | 1.30 | 0.65 | 99.6 |
| Conflict sensitivity | ||||
| τ = 0.25 | 2.54 | 1.33 | 0.59 | 95.2 |
| τ = 1.0 | 4.28 | 1.71 | 0.68 | 99.7 |
| Starting-time sensitivity | ||||
| ts=0.4 | 5.42 | 3.27 | 0.74 | 99.9 |
| ts=0.8 | 3.40 | 1.42 | 0.65 | 86.4 |
| Sampling-step sensitivity | ||||
| N=10 | 2.98 | 1.35 | 0.57 | 90.1 |
| N=40 | 3.66 | 1.51 | 0.68 | 99.5 |
| Guidance-scale sensitivity | ||||
| s=4 | 2.21 | 1.30 | 0.44 | 93.5 |
| s=12 | 5.82 | 3.40 | 0.72 | 99.7 |
| Support-ratio sensitivity | ||||
| ρ=3% | 2.12 | 1.29 | 0.42 | 88.0 |
| ρ=8% | 2.63 | 1.48 | 0.67 | 99.6 |
struction changes introduced by the VAE decoder.
Figure S3 further illustrates the preservation behavior across additional Smile and Age examples. Although CLEAR performs counterfactual generation in latent space and decodes the final latent through a VAE, pixels outside the final editable support are taken directly from the factual image. These regions are therefore exactly preserved and unaffected by VAE reconstruction. Compared with approximate preservation obtained only through latent constraints, factual-pixel reuse provides exact pixel-level preservation outside the estimated support. This guarantee does not establish that the support correctly separates decision-relevant and decision-irrelevant content.
A.3. Hyperparameter Sensitivity
Table S1 evaluates the sensitivity of CLEAR to , , , , and on CelebA-HQ Smile, varying one parameter at a time from the default configuration. The results show substantial trade-offs between counterfactual validity, realism, and preservation, indicating that parameter selection matters. This single-task analysis does not establish robustness across datasets.
The conflict threshold controls how strongly the conflicting classifier component is attenuated. A smaller value () applies stronger attenuation and reduces the flip rate from to . Conversely, retains more classifier influence and reaches flip rate, but increases FID and MNAC to 4.28 and 1.71, respectively. This supports moderate conflict-dependent attenu- ation rather than either aggressively suppressing or largely retaining conflicting guidance.
The starting time determines how much generative freedom is available for counterfactual modification. Starting earlier () produces strong validity (FR = 99.9%, COUT = 0.74), but substantially worsens FID and MNAC. Starting later () keeps the trajectory closer to the factual image, but restricts the target edit and reduces the flip rate to 86.4%. The default therefore provides a better balance between sufficient editing freedom and factual preservation.
A similar trade-off appears for the number of sampling steps . Using only limits classifier-driven modification and reduces the flip rate to , whereas increasing to restores high validity but does not improve realism or preservation over the default . Additional sampling steps therefore provide limited benefit once sufficient guidance has been applied.
The guidance scale controls the maximum strength of classifier guidance. With , weaker guidance preserves realism but produces insufficient target modification, as reflected by COUT = 0.44 and FR = 93.5%. Increasing the scale to improves validity (COUT = 0.72, FR = 99.7%), but considerably degrades FID and MNAC. This behavior is consistent with the motivation of Cooperative Flow Guidance: classifier guidance should be strong enough to achieve the target change without overwhelming the generative trajectory.
Finally, the support ratio controls the spatial extent of counterfactual editing. A small support () achieves low FID and MNAC but restricts the editable region too strongly, reducing the flip rate to . Increasing the support to restores high validity, but slightly increases FID and MNAC as modifications are allowed over a larger region. The default provides a balanced compromise between localized editing and successful counterfactual generation.
Taken together, these results show that the default configuration provides a consistent balance between validity, realism, and preservation. The observed sensitivity trends also agree with the intended roles of the two main components of CLEAR: Cooperative Flow Guidance controls how strongly classifier information modifies the trajectory, while Adaptive Support Preservation controls where those modifications are allowed.