SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2510.14623 · NeurIPS · 2025

LeapFactual: Reliable Visual Counterfactual Explanation Using Conditional Flow Matching

Xuan Zhao, Ira Assent, Zhuo Cao, Lena Krieger, Hanno Scharr

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 1 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2510.14623.json · badge: /api/ran/2510.14623.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
caicairay/LeapFactual canonical (classifier label)
classifier basis: census
4 ran · 1 no recorded run
FunctionStatusWhere it lives
data_loader Ran
ran; our contract draft was wrong, not the code
caicairay/LeapFactual/training_scripts/experiments/utils.py
code served (permissive licence) · get_code("73a5cdcd89c29ee4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import pytorch_lightning as pl
from torch.utils.data import DataLoader, TensorDataset

torch.manual_seed(0)

# Create a minimal PyTorch Lightning module that uses the decorator
class MinimalLightningModule(pl.LightningModule):
    def __init__(self):
        super().__init__()
        self.layer = torch.nn.Linear(4, 2)
    
    def forward(self, x):
        return self.layer(x)
    
    def configure_optimizers(self):
        return torch.optim.SGD(self.parameters(), lr=0.01)

# Define a simple data loader function to be decorated
def simple_data_loader(self):
    """A simple data loader function that returns a DataLoader."""
    x = torch.randn(2, 4)
    y = torch.randint(0, 2, (2,))
    dataset = TensorDataset(x, y)
    return DataLoader(dataset, batch_size=2)

# The function `data_loader` takes one parameter: `fn` (a function)
ARGS = {
    "fn": simple_data_loader
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pytorch_lightning, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
frange_cycle_linear Ran
ran, honoured the contract we drafted
caicairay/LeapFactual/training_scripts/experiments/utils.py
code served (permissive licence) · get_code("8e0c5ef63327d48c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (100,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    'start': 0.1,
    'stop': 1.0,
    'n_epoch': 100,
    'n_cycle': 4,
    'ratio': 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (100,) — shape (100,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
frange_cycle_sigmoid Ran
ran, honoured the contract we drafted
caicairay/LeapFactual/training_scripts/experiments/utils.py
code served (permissive licence) · get_code("cdd92f206f764591")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (100,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    'start': 0.0,
    'stop': 1.0,
    'n_epoch': 100,
    'n_cycle': 4,
    'ratio': 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (100,) — shape (100,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_norm_layer Ran
ran; our contract draft was wrong, not the code
caicairay/LeapFactual/training_scripts/models/VAE/losses.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from amandinebtto/batvision-dataset, is pointer only (licence: CC-BY-SA-4.0) · get_code("b27dffc0609fbec0")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from amandinebtto/batvision-dataset, and CC-BY-SA-4.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

cal_gradient_penalty Not yet run
unverified (harvested, no recorded run)
caicairay/LeapFactual/training_scripts/models/VAE/losses.py
code served (permissive licence) · get_code("3452901b7c850dc8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 3 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
get_norm_layer 16 other papers
15 dated earlier, 1 later · 2 only as an assembly brick
1511.06434 (2015-11)
Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks
1909.08313 (2019-09)
Unsupervised Sketch-to-Photo Synthesis
2007.15651 (2020-07)
Contrastive Learning for Unpaired Image-to-Image Translation
and 13 more not named here
cal_gradient_penalty 1 other paper
1 dated earlier
2308.03979 (2023-08)
PAIF: Perception-Aware Infrared-Visible Image Fusion for Attack-Tolerant Semantic Segmentation

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The growing integration of machine learning (ML) and artificial intelligence (AI) models into high-stakes domains such as healthcare and scientific research calls for models that are not only accurate but also interpretable. Among the existing explainable methods, counterfactual explanations offer interpretability by identifying minimal changes to inputs that would alter a model's prediction, thus providing deeper insights. However, current counterfactual generation methods suffer from critical limitations, including gradient vanishing, discontinuous latent spaces, and an overreliance on the alignment between learned and true decision boundaries. To overcome these limitations, we propose LEAPFACTUAL, a novel counterfactual explanation algorithm based on conditional flow matching. LEAPFACTUAL generates reliable and informative counterfactuals, even when true and learned decision boundaries diverge. Following a model-agnostic approach, LEAPFACTUAL is not limited to models with differentiable loss functions. It can even handle human-inthe-loop systems, expanding the scope of counterfactual explanations to domains that require the participation of human annotators, such as citizen science. We provide extensive experiments on benchmark and real-world datasets highlighting that LEAPFACTUAL generates accurate and in-distribution counterfactual explanations that offer actionable insights. We observe, for instance, that our reliable counterfactual samples with labels aligning to ground truth can be beneficially used as new training data to enhance the model. The proposed method is diversely applicable and enhances scientific knowledge discovery as well as non-expert interpretability. The code is available on https://github.com/caicairay/LeapFactual.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2510.14623")
get_code_for_paper("2510.14623")
have("2510.14623")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2510.14623.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2510.14623.svg)](https://syntology.ai/paper/2510.14623)

Connect an agent — have() is free.