Coming soon.
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 2.5× speedup over the strongest baseline.
Starting from a partially noised factual latent, CLEAR evolves a single latent trajectory along a guided flow. At each step, the flow model provides the generative velocity and a one-step image estimate, from which the frozen target classifier produces both the classifier force and the current decision-relevant support. Cooperative Flow Guidance determines how the classifier force modifies the generative direction, while Adaptive Support Preservation determines where the modification is allowed.
Overview of CLEAR. Repeating these coupled updates yields a counterfactual that concentrates changes within the evolving editable support while preserving decision-irrelevant factual content.
Flow Matching predicts an explicit instantaneous velocity vt, which can be compared directly with the classifier force ut = −gt, unlike the sampler-dependent updates of DDPMs. CLEAR decomposes ut into components parallel and orthogonal to vt, and attenuates only the opposing parallel component, with a strength that grows with the degree of conflict. Cooperative guidance is therefore preserved, and only harmful conflict is suppressed.
From sampler-dependent denoising to cooperative flow guidance. (a) In DDPMs the update direction depends on the chosen sampler. (b) Flow Matching directly predicts the velocity vt, an explicit generative direction. (c) Under mild or severe conflict, CLEAR increasingly attenuates only the opposing component as the conflict strength grows.
CLEAR estimates the editable support with target-class Grad-CAM on the classifier view, keeps the top salient pixels, extracts the largest connected component and dilates it. The support is refreshed at every step, so it adapts as the counterfactual evolves. Average-pooling it to the latent grid yields a soft gate: classifier-driven updates act inside the support, while the rest of the latent follows the original flow. Finally, the factual pixels outside the final support are copied back, so that VAE reconstruction cannot alter them.
On CelebA-HQ Smile, CLEAR achieves the lowest runtime and FID among the compared methods while keeping a low peak GPU memory footprint, with 2.5× and 58.1× speedups over MaskDiME and DiME, respectively. It is also substantially faster than the latent baseline LDCE-txt, with a clearly lower FID.
1,000 images at 256×256 resolution with a batch size of 3. Runtime and peak GPU memory measure counterfactual inference only. † denotes a latent-space method.
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.
| Method | Smile | Age | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| FID ↓ | sFID ↓ | FVA ↑ | FS ↑ | MNAC ↓ | CD ↓ | COUT ↑ | FR (%) ↑ | FID ↓ | sFID ↓ | FVA ↑ | FS ↑ | MNAC ↓ | CD ↓ | COUT ↑ | FR (%) ↑ | |
| DiVE | 107.0 | – | 35.7 | – | 7.41 | – | – | – | 107.5 | – | 32.3 | – | 6.76 | – | – | – |
| STEEX | 21.9 | – | 97.6 | – | 5.27 | – | – | – | 26.8 | – | 96.0 | – | 5.63 | – | – | – |
| DiME | 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 ℓ1 | 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 ℓ2 | 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 | 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 | 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 | 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† | 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† | 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 |
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.
CLEAR consistently outperforms existing latent-space methods in FID and sFID across all three semantic class pairs, while remaining competitive with the strongest image-space baselines. At the same time, CLEAR achieves the best or tied-best S3 with near-perfect flip rates, so its quality–efficiency advantage extends beyond localized facial edits to challenging global semantic transformations.
| Method | Sorrel – Zebra | Persian Cat – Egyptian Cat | Cougar – Cheetah | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| FID ↓ | sFID ↓ | S3 ↑ | COUT ↑ | FR (%) ↑ | FID ↓ | sFID ↓ | S3 ↑ | COUT ↑ | FR (%) ↑ | FID ↓ | sFID ↓ | S3 ↑ | COUT ↑ | FR (%) ↑ | |
| DiME | 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 ℓ1 | 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 ℓ2 | 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 | 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 | 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 | 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 | 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† | 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† | 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.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† | 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 |
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.
CLEAR produces localized edits with strong identity preservation on CelebA-HQ, and handles challenging global semantic transformations on ImageNet.
Qualitative comparison on CelebA-HQ using DenseNet-121. From left to right: the factual image and counterfactual images generated by MaskDiME and CLEAR.
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.
Directional conflict occurs frequently across all five bidirectional tasks and becomes more common toward the end of generation, which is counter-intuitive since the classifier force is expected to align better with the generative direction as target semantics emerge. Conflict strength follows task-dependent dynamics: ImageNet transformations show strong early conflicts that decrease rapidly, whereas CelebA-HQ edits start weaker, peak at intermediate stages and then decline. Conflict should therefore not be treated as a binary event, and its degree matters. Hard Projection and Additive Guidance retain 0% and 100% of the conflicting component, whereas CLEAR adaptively retains 83.3–88.8% across the five tasks.
Directional conflict analysis during generation. (a) Conflict frequency across Flow Matching timesteps. (b) Conflict strength, measured by ‖ut∥‖2 / ‖vt‖2. (c) Percentage of the conflicting component retained after Cooperative Flow Guidance.
The conflict regime also shapes the final counterfactual. When conflicts are weak, even a high conflict frequency leads to limited differences between guidance strategies. Low-frequency but strong conflicts are already enough to produce noticeable differences: Additive Guidance may cause excessive modification, whereas Hard Projection may over-suppress useful classifier guidance. When both frequency and strength are high, the differences are most pronounced, and CLEAR achieves a better balance between target modification and visual naturalness.
Qualitative results under different conflict regimes. Rows show examples with different combinations of conflict frequency and strength.
Additional results (supplementary). CelebA-HQ Age and ImageNet show the same consistent behavior across conflict settings.
We evaluate the main components of CLEAR on CelebA-HQ Smile. For Cooperative Flow Guidance, Additive Guidance disables conflict-aware attenuation (βt = 0), while Hard Projection completely removes the opposing component whenever it exists. Fully retaining conflicting guidance degrades realism and non-target preservation, while removing it entirely reduces counterfactual validity. For Adaptive Support Preservation, removing any of the three components degrades the overall performance.
| 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 |
MSE is measured outside each variant's final editable support and is zero by construction for variants using factual-pixel composition.
We vary one parameter at a time from the default configuration (τ = 0.5, ts = 0.6, N = 20, s = 8, ρ = 5%) on CelebA-HQ Smile. The results show substantial trade-offs between counterfactual validity, realism, and preservation, so parameter selection matters. This single-task analysis does not establish robustness across datasets.
| 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 |
Hyperparameter sensitivity on CelebA-HQ Smile (supplementary). A smaller τ or s, a later ts, fewer steps, or a smaller ρ lower the flip rate, whereas a larger τ or s and an earlier ts raise validity at the cost of FID and MNAC. The default balances validity, realism, and preservation.
The editable support concentrates changes in target-relevant regions while preserving the remaining factual content. Since CLEAR reuses the factual pixels outside the final support, the error in these regions is zero by construction. This verifies the composition operation, but it does not independently validate support accuracy or continuity at the composition boundary.
Visualization of localized counterfactual editing (supplementary).
Exact preservation with Adaptive Support Preservation (supplementary). From left to right: factual image, CLEAR counterfactual, and pixel-wise difference map. Pixels outside the editable support remain unchanged.
Coming soon.