Search arXiv⌕ Search

arXiv subjects

Jan Masłowski

Publications and source records attributed to Jan Masłowski.

2 recordsLinked to original sources

Explanations or Attacks? Beyond Adversarial Edits in Visual Counterfactual Explanations

Counterfactual explanations and adversarial examples address a similar question: what is the smallest change to an input that flips a classifier's decision? However, a key difference is that a useful explanation must convey a meaningful change recognizable beyond the explained classifier; otherwise, even a visually plausible counterfactual may be little more than an adversarial perturbation. To check if a counterfactual behaves like an adversarial edit, we introduce an evaluation protocol based on simple diagnostics, independent oracles, and robustness to image transformations, including diffusion purification. Our analysis shows that several state-of-the-art counterfactual methods behave more like adversarial attacks than useful explanations. We address this problem by proposing SeeShift, a method that learns to shift the semantic latent code of a diffusion autoencoder without directly optimizing pixels based on classifier gradients. The resulting edit is transferred to the original image as a localized residual, preserving content outside the edited region. Experiments on human (CelebA-HQ) and animal (AFHQ) faces, and on chest radiographs (NIH ChestX-ray14) show that SeeShift achieves higher oracle validity and robustness to image transformations than competing methods, while maintaining visual similarity to the input images. A blinded study with physicians further shows that SeeShift depicts the intended clinical changes more frequently and is preferred over competing explanations. Our findings demonstrate that classifier flips and pixel proximity alone are insufficient to establish the explanatory value of a counterfactual.

cs.CV↗

CounterFlowNet: From Minimal Changes to Meaningful Counterfactual Explanations

Counterfactual explanations (CFs) provide human-interpretable insights into model's predictions by identifying minimal changes to input features that would alter the model's output. However, existing methods struggle to generate multiple high-quality explanations that (1) affect only a small portion of the features, (2) can be applied to tabular data with heterogeneous features, and (3) are consistent with the user-defined constraints. We propose CounterFlowNet, a generative approach that formulates CF generation as sequential feature modification using conditional Generative Flow Networks (GFlowNet). CounterFlowNet is trained to sample CFs proportionally to a user-specified reward function that can encode key CF desiderata: validity, sparsity, proximity and plausibility, encouraging high-quality explanations. The sequential formulation yields highly sparse edits, while a unified action space seamlessly supports continuous and categorical features. Moreover, actionability constraints, such as immutability and monotonicity of features, can be enforced at inference time via action masking, without retraining. Experiments on eight datasets under two evaluation protocols demonstrate that CounterFlowNet achieves superior trade-offs between validity, sparsity, plausibility, and diversity with full satisfaction of the given constraints.

cs.LG↗