Papers › Diffeomorphic Counterfactuals with Generative Models

Diffeomorphic Counterfactuals with Generative Models

10 Jun 2022arXiv:2206.05075archive 2025-07-28

Ann-Kathrin Dombrowski, Jan E. Gerken, Klaus-Robert Müller, Pan Kessel

Counterfactuals can explain classification decisions of neural networks in a human interpretable way. We propose a simple but effective method to generate such counterfactuals. More specifically, we perform a suitable diffeomorphic coordinate transformation and then perform gradient ascent in these coordinates to find counterfactuals which are classified with great confidence as a specified target class. We propose two methods to leverage generative models to construct such suitable coordinate systems that are either exactly or approximately diffeomorphic. We analyze the generation process theoretically using Riemannian differential geometry and validate the quality of the generated counterfactuals using various qualitative and quantitative measures.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2206.05075")

Code

Syntology Ran 1 of 11 code samples harvested from 1 repository linked to this paper; 10 have no recorded run. Of those that ran: 1 ran · honoured contract.

By repository: official repository: 11 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

annahdo/counterfactuals officialmentioned in papermentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

11 samples harvested; 1 ran; 1 honoured the contract we drafted; 10 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
10unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from annahdo/counterfactuals. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

gaussian_sample annahdo/counterfactuals/counterfactuals/generative_models/flows/glow.py official repository ran · honoured contract fingerprinted Apache-2.0 (permissive) · 87324754644a55a3 · report
bits_per_dim annahdo/counterfactuals/counterfactuals/generative_models/flows/utils.py official repository unverified Apache-2.0 (permissive) · bd4a83f222c00aa0 · report
calc_z_shapes annahdo/counterfactuals/counterfactuals/generative_models/flows/utils.py official repository unverified Apache-2.0 (permissive) · f452bf17ed5cad17 · report
expl_to_image annahdo/counterfactuals/counterfactuals/utils.py official repository unverified Apache-2.0 (permissive) · 420f11cbc4c51411 · report
gaussian_log_p annahdo/counterfactuals/counterfactuals/generative_models/flows/glow.py official repository unverified Apache-2.0 (permissive) · 054f22912d47c960 · report
gaussian_sample_reverse annahdo/counterfactuals/counterfactuals/generative_models/flows/glow.py official repository unverified Apache-2.0 (permissive) · aec54cec3fae16e8 · report
get_data_info annahdo/counterfactuals/counterfactuals/data.py official repository unverified Apache-2.0 (permissive) · 7915efb518eff61f · report
make_dir annahdo/counterfactuals/counterfactuals/utils.py official repository unverified Apache-2.0 (permissive) · 060069f55f400577 · report
plot_grid_part annahdo/counterfactuals/counterfactuals/plot.py official repository unverified Apache-2.0 (permissive) · d55f7870292e9ceb · report
preprocessor annahdo/counterfactuals/counterfactuals/generative_models/flows/utils.py official repository unverified Apache-2.0 (permissive) · d366066ba90492c6 · report
torch_to_image annahdo/counterfactuals/counterfactuals/utils.py official repository unverified Apache-2.0 (permissive) · 11770569b6df7eb7 · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Counterfactuals

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections